まつもと ゆきひろです.
In message "[ruby-list:1813] Re: rectangle of canvas widget"
on 97/01/22, sinara / blade.nagaokaut.ac.jp <sinara / blade.nagaokaut.ac.jp> writes:
|
|原です。
|> GD.pmを参考にちょいちょいとつくったら,明日にでも完成しそう
|> です.で,このモジュールを私の代わりにテスト,デバッグ,メン
|> テを行ってくださるボランティアを募集します.
できちゃいました.ああ,現実逃避.
perlのデモから作った以下のスクリプトは動いているようです.
次のリリースにはextの下に置きます.今の内にgd1.2をゲットして
おいてください.で,gd*.hを/usr/local/includeにlibgd.aを
/usr/local/libにおいておく必要があります.
# 当然ドキュメントはないです.^^;;
まつもと ゆきひろ /:|)
#!/usr/local/bin/ruby
require "GD"
# create a new image
im = GD::Image.new(100,100)
# allocate some colors
white = im.colorAllocate(255,255,255);
black = im.colorAllocate(0,0,0);
red = im.colorAllocate(255,0,0);
blue = im.colorAllocate(0,0,255);
# make the background transparent and interlaced
im.transparent(white);
im.interlace = TRUE;
# Put a black frame around the picture
im.rectangle(0,0,99,99,black);
# Draw a blue oval
im.arc(50,50,95,75,0,360,blue);
# And fill it with red
im.fill(50,50,red);
# Convert the image to GIF and print it on standard output
im.gif STDOUT;