Team,
I copied two drawings, one from The Ruby Way 2nd edition and one from
the
RMagick website.
I try to run the pgms but I get nothing. I mean nothing, no errors, I
just
get the cursor back.
The first sample (The Ruby Way 2nd edition), and which I named
magia01.rbfollows:
I run this pgm by typing: ruby magia01.rb. This is under MS Windows
XP.
require ‘RMagick’
img = Magick::ImageList.new
img.new_image(500, 500)
purplish = “#ff55ff”
yuck = “#5fff62”
bleah = “#3333ff”
line = Magick::Draw.new
50.step(450, 50) do |n|
line.line(n,50, n,450)
line.draw(img)
line.line(50,n, 450,n)
line.draw(img)
end
Draw circle
cir = Magick::Draw.new
cir.fill(purplish)
cir.stroke(‘black’).stroke_width(1)
cir.circle(250,200, 250,310)
cir.draw(img)
#Draw rectangle
rect = Magick::Draw.new
rect.stroke(‘black’).stroke_width(1)
rect.fill(yuck)
rect.rectangle(340,380, 237,110)
rect.draw(img)
#Draw triangle
tri = Magick::Draw.new
tri.stroke(‘black’).stroke_width(1)
tri.fill(bleah)
tri.polygon(90,320,160,370,390,120)
tri.draw(img)
img = img.quantize(256,Magick::GRAYColorspace)
img.write(“drawing.gif”)
Any help will be appreciated.
Thank you
Victor