On Thursday 22 Apr 2010 12:12:34 CHAN, KENNETH 1 [AG/7721] wrote:
> 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 think the Alpha color was drawn above the line, as the canvas of GD is not 
multi-layered. Otherwise, here are some comments on your code:

> 
> 
> 
> Regards,
> 
> Kenneth
> 
> 
> 
> 
> 
> ############## Code #######################
> 
> print "Content-type: text/plain; charset-iso-8859-1\n\n";
> 

Please add "use strict;" and "use warnings;" and correct all the problems.

Also use CGI.pm or something like that. You also probably want to print a head 
with an "image/png" (IIRC) content-type instead of "text/plain".

Otherwise, looks fine.

Regards,

        Shlomi Fish

> 
> 
> 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;
> 
> 
> ---------------------------------------------------------------------------
> ------------------------------ This e-mail message may contain privileged
> and/or confidential information, and is intended to be received only by
> persons entitled to receive such information. If you have received this
> e-mail in error, please notify the sender immediately. Please delete it
> and all attachments from any servers, hard drives or any other media.
> Other use of this e-mail by you is strictly prohibited.
> 
> 
> All e-mails and attachments sent and received are subject to monitoring,
> reading and archival by Monsanto, including its subsidiaries. The
> recipient of this e-mail is solely responsible for checking for the
> presence of "Viruses" or other "Malware". Monsanto, along with its
> subsidiaries, accepts no liability for any damage caused by any such code
> transmitted by or accompanying this e-mail or any attachment.
> --------------------------------------------------------------------------
> -------------------------------

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Understand what Open Source is - http://shlom.in/oss-fs

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to