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
-- 

ATTN: please update your address books with address below!

===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| STP     :: http://www.ngdc.noaa.gov/stp/
| NGDC    :: http://www.ngdc.noaa.gov/
| NESDIS  :: http://www.nesdis.noaa.gov/
| NOAA    :: http://www.noaa.gov/
| US DOC  :: http://www.commerce.gov/
|
| The difference between art and science is that science is what we
| understand well enough to explain to a computer.  
| Art is everything else.  
|   -- Donald Knuth, "Discover"
|
| /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' 
===============================================================================