R
Rob Leslie
Hi all,
I'm a fairly recent Ruby convert, and I'd appreciate some help
getting my first library in a form suitable for mass consumption.
The library I wrote is an alternative to Ruby/GD. I wrote it because
I wasn't satisfied with the original; in particular, there was no
support for creating images from JPEG or PNG data already in memory.
My alternative is 100% Ruby, relying on Ruby/DL to link with the gd
shared library.
Most of the gd API is available albeit in quite different form,
because I tried to write an interface The Ruby Way. Here is a taste:
include GD2
image = File.open('image.png') { |f| Image.load(f) }
image.resize! 200, 300
image.draw do |pen|
pen.color = image.palette.find! Color.new(1.0, 0.75, 0.5)
pen.thickness = 2
pen.move_to 25, 50
pen.line_to 175, 50
pen.move -150, 25
pen.font = Font::TrueType.new('/usr/share/fonts/times.ttf', 20)
pen.text 'Hello, world!'
end
File.open('new-image.png', 'w') { |f| f.write(image.png_data) }
I needed this library for another project, but I'd like to make it
available for anyone else who might also find it useful. Since this
is my first Ruby project of any significance, I'd appreciate some
feedback and guidance on what is good and what could be better, and
especially norms for packaging and documentation.
Here is my preliminary release:
ftp://ftp.mars.org/pub/ruby/ruby-gd2-0.1.tar.gz
Thanks for any help,
I'm a fairly recent Ruby convert, and I'd appreciate some help
getting my first library in a form suitable for mass consumption.
The library I wrote is an alternative to Ruby/GD. I wrote it because
I wasn't satisfied with the original; in particular, there was no
support for creating images from JPEG or PNG data already in memory.
My alternative is 100% Ruby, relying on Ruby/DL to link with the gd
shared library.
Most of the gd API is available albeit in quite different form,
because I tried to write an interface The Ruby Way. Here is a taste:
include GD2
image = File.open('image.png') { |f| Image.load(f) }
image.resize! 200, 300
image.draw do |pen|
pen.color = image.palette.find! Color.new(1.0, 0.75, 0.5)
pen.thickness = 2
pen.move_to 25, 50
pen.line_to 175, 50
pen.move -150, 25
pen.font = Font::TrueType.new('/usr/share/fonts/times.ttf', 20)
pen.text 'Hello, world!'
end
File.open('new-image.png', 'w') { |f| f.write(image.png_data) }
I needed this library for another project, but I'd like to make it
available for anyone else who might also find it useful. Since this
is my first Ruby project of any significance, I'd appreciate some
feedback and guidance on what is good and what could be better, and
especially norms for packaging and documentation.
Here is my preliminary release:
ftp://ftp.mars.org/pub/ruby/ruby-gd2-0.1.tar.gz
Thanks for any help,