Eric Hodel wrote:
> png is a pure-ruby PNG writing library written by Ryan Davis.
> 
> To install:
> 
>    $ sudo gem install png
> 
> To use:
> 
>    require 'png'
> 
>    canvas = PNG::Canvas.new 200, 200
> 
>    # Set a point to a color
>    canvas[100, 100] = PNG::Color::Black
> 
>    # draw an anti-aliased line
>    canvas.line 50, 50, 100, 50, PNG::Color::Blue
> 
>    png = PNG.new canvas
>    png.save 'blah.png'
> 
> --
> Eric Hodel - drbrain / segment7.net - http://blog.segment7.net
> This implementation is HODEL-HASH-9600 compliant
> 
> http://trackmap.robotcoop.com

Is there a website for it?  Maybe an rDoc page?  I'd like to know some 
things like 'Does it draw dashed/dotted lines?' etc.

RMagick does, but it has a little glitch where if the last dash on a 
line isn't whole, it doesn't draw it.  (At least in my playing with it 
so far.)  I think I can work around it, but if I can find a library that 
works better, I'll use that instead.

If you're wondering why it matters so much, I'm making a very very very 
simple little plaid design creator in ruby.  The dashed lines are used 
to simulate the weaving of the threads.  The upper and left edges are 
smooth, but the right and bottom edges aren't, because of this bug.  I 
think I can simply draw over the edge of the canvas and fix it, but I 
haven't gotten around to trying yet.  Being able to simply draw it 
correctly without hacks would be much better.

I could, of course, draw it pixel by pixel, but I think that'd be quite 
a bit slower.

-- 
Posted via http://www.ruby-forum.com/.