> Hi all, > > I used colorAllocateAlpha to specify a transparent color. After > filling a circle with it, I don't see the background line which is > drawn > before. The code is pasted below. What did I do wrong here? Thanks.
I rewrote your script to write to the hard drive. The background line is there when I viewed it in xview. What did you use to view the image? Owen (see below for rewritten code) > > ############## Code ####################### > > print "Content-type: text/plain; charset-iso-8859-1\n\n"; > > > > use GD; > > my $img = new GD::Image(100,100); > > > > $black = $img->colorAllocateAlpha(0,0,0,0); > > $blue = $img->colorAllocateAlpha(0,0,255,0); > > $redTrans = $img->colorAllocateAlpha(255,0,0,100); > > > > $img->rectangle(0,0,99,99,$black); > > $img->fill(50,50,$blue); > > $img->line(0,0,100,100,$black); > > # draw a transparent circle > > $img->filledArc(50,50,50,50,0,360, $redTrans); > > > > binmode STDOUT; > > print $img->png; > > > ============Rewritten================= #!/usr/bin/perl use strict; use warnings; use GD; my $img = new GD::Image(100,100); my $black = $img->colorAllocateAlpha(0,0,0,0); my $blue = $img->colorAllocateAlpha(0,0,255,0); my $redTrans = $img->colorAllocateAlpha(255,0,0,100); $img->rectangle(0,0,99,99,$black); $img->fill(50,50,$blue); $img->line(0,0,100,100,$black); $img->filledArc(50,50,50,50,0,360, $redTrans); open(my $IMG, '>', "test.png") or die "$1\n"; binmode $IMG; print $IMG $img->png; close($IMG); -- Owen -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/