Ara.T.Howard wrote:

> On Mon, 2 Feb 2004, Charles Comstock wrote:
> 
> 
>>Date: Mon, 02 Feb 2004 18:27:32 -0600
>>From: Charles Comstock <cc1 / cec.wustl.edu>
>>Newsgroups: comp.lang.ruby
>>Subject: Re: graphics lib?
>>
>>Simon Strandgaard wrote:
>>
>>>On Sun, 01 Feb 2004 16:18:50 -0600, Charles Comstock wrote:
>>>
>>>
>>>
>>>>Simon Strandgaard wrote:
>>>>
>>>>
>>>>>On Sun, 01 Feb 2004 02:12:43 +0900, Alwin Blok wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hello,
>>>>>>
>>>>>>What would be the best choice for 2d vector graphics with ruby?
>>>>>>My needs are as follows:
>>>>>>2D vector (SVG/ pdf/ postscript like), Animation, Offscreen rendering.
>>>>>
>>>>>
>>>>>
>>>>>I can recommend RMagic.
>>>>>http://rmagick.rubyforge.org/
>>>>>
>>>>>Don't know about animation though.
>>>>>
>>>>>
>>>>>You may see what I have made using RMagick, here:
>>>>>http://aeditor.rubyforge.org/softwrap.html
>>>>>
>>>>>--
>>>>>Simon Strandgaard
>>>>
>>>>I have used RMagic in the past, but it doesn't quite seem suited to per 
>>>>pixel editing.  I was trying to do an AI project of RedEye detection for 
>>>> a class, and I did succeed to use it but I had to add a couple methods 
>>>>to more easily edit individual pixels.  It just didn't seem to be really 
>>>>set up to do per pixel calculations or modifications very nicely.  I was 
>>>>  curious if anyone else has suggestions on what would be most 
>>>>appropriate for that?
>>>
>>>
>>>
>>>It's possible with RMagick.. get/set pixel methods  :-)
>>>http://www.simplesystems.org/RMagick/doc/image.html#Image.get_pixels
>>>
>>>
>>>--
>>>Simon Strandgaard
>>>
>>
>>Right I have used that function it's just very cumbersome, it would be 
>>much easier to directly edit the values in the real array they are in. 
>>Exporting a pixel array is really not a very efficient operation, not to 
>>mention the need to reimport them later.  Not to mention the fact it 
>>returns a flat array which while it's easy to write an accessor that 
>>2d's it, it still is not particularly friendly towards doing image analysis.
>>
>>Charlie
> 
> 
> i'm in total agreement.  what i have done is to create a class the memory maps
> images using guy's mmap module in 'r+' mode (read/write) and created a class
> that '2ds' the pixel indexes - using this i have written some ruby programs
> which run faster that some of our C programs (due to stupid i/o ops).  if you
> really are doing pixel level operations i'd consider this approach.
> 
> -a

You don't happen to have some code for example of this?  I'm not quite 
following is this through a C extension or just raw ruby?  My solution I 
  did last time was wrap the get/set pixel methods so they only grabbed 
a 1x1 range, and then I could access them directly, but this somehow 
seems like it probably incites horrible performance.
	Charles Comstock