develooper Front page | perl.beginners | Postings from April 2010

Transparent color

Thread Next
From:
CHAN, KENNETH 1 [AG/7721]
Date:
April 22, 2010 02:12
Subject:
Transparent color
Message ID:
B841D737E5D5594B88982211F59683D403347EB9@AP6000EXM01.ap.ds.monsanto.com
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.

 

Regards,

Kenneth

 

 

############## 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;


---------------------------------------------------------------------------------------------------------
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.
---------------------------------------------------------------------------------------------------------


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About