i have to draw a filled polygon into a .png-file. i chose ruby-GD to do
this.
i experimented around and saw that the line drawn by image.polygon was too
thin, so i made a brush (is there a more intelligent way to get the line to
be more thick??):
#— begin of code —
make a brush for drawing the arbeitsbereich-polygon
brush = GD::Image.new(6,6)
white = brush.colorAllocate(255,255,255)
blue = brush.colorAllocate(0,0,255)
brush.transparent(white)
brush.filledEllipse(3,3,4,4,0,360,blue)
image.setBrush(brush)
draw arbeitsbereich-polygon
image.polygon(arbeitsbereich,GD::Brushed);
#— end of code —
everything worked and the result i got was:
http://members.aon.at/zesar/tmp/arbeitsbereich.png
however, i am curios if anyone can think of a way to achieve the greater
thickness of the line more convenient.
and my other problem is: the blue line surrounding the red area is not
really smooth - it’s not a pleasure to look at - whatever. is there a way to
do some kind of anti-aliasing while drawing (maybe with a brush with
transparent edges - but how???)?
i’m not very familiar with ruby-gd or with the usage of any kind of graphics
libraries so could somebody please help me?
i was searching the web for approaches to my problem and found the GRb
(gruby) library which seems to provide a more easy approach to my problem.
but i found no documentation for it, the examples gave me no hints, and i’m
not that experienced in ruby so i can’t think of how to use the lib from
looking at the source…
the thing i’m dreaming of is (in pseudo-code):
style = "smooth"
width = 5
color = "blue"
polygon.draw(color, width, style)
however - any help 'd be much apprecciated, thx beforehand
patrick
ps: is the ruby-GD project still alive? it’s raa-entry hasn’t been updated
for ages…
the recent release of the GD-library promises new features like “smooth line
drawing” - it would be cool to have that in ruby-GD…