cvs: phpdoc /en/reference/image/functions imagecolorallocatealpha.xml

From: Date: Sat, 16 Aug 2003 21:19:31 +0000
Subject: cvs: phpdoc /en/reference/image/functions imagecolorallocatealpha.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969355852@lists.php.net to get a copy of this message
cece Sat Aug 16 17:19:31 2003 EDT Modified files: /phpdoc/en/reference/image/functions imagecolorallocatealpha.xml Log: Applying PEAR coding standards on example code. Index: phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml diff -u phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml:1.4 phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml:1.5 --- phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml:1.4 Sat Aug 16 15:34:05 2003 +++ phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml Sat Aug 16 17:19:31 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry id="function.imagecolorallocatealpha"> <refnamediv> <refname>imagecolorallocatealpha</refname> @@ -33,37 +33,38 @@ <![CDATA[ <?php $size = 300; -$Image=imagecreatetruecolor($size, $size); -// something to get a white background -$back = imagecolorallocate( $Image, 255, 255, 255 ); -$border = imagecolorallocate( $Image, 0, 0, 0); -imagefilledrectangle ( $Image, 0, 0, $size-1, $size-1, $back); -imagerectangle ( $Image, 0, 0, $size-1, $size-1, $border); - -$yellowX = 100; -$yellowY = 75; -$redX = 120; -$redY = 165; -$blueX = 187; -$blueY = 125; -$radius = 150; +$image=imagecreatetruecolor($size, $size); + +// something to get a white background with black border +$back = imagecolorallocate($image, 255, 255, 255); +$border = imagecolorallocate($image, 0, 0, 0); +imagefilledrectangle($image, 0, 0, $size - 1, $size - 1, $back); +imagerectangle($image, 0, 0, $size - 1, $size - 1, $border); + +$yellow_x = 100; +$yellow_y = 75; +$red_x = 120; +$red_y = 165; +$blue_x = 187; +$blue_y = 125; +$radius = 150; // allocate colors with alpha values -$yellow = imagecolorallocateAlpha ( $Image, 255, 255, 0,75); -$red = ImageColorAllocateAlpha( $Image, 255, 0, 0, 75 ); -$blue = ImageColorAllocateAlpha ( $Image, 0, 0, 255,75 ); +$yellow = imagecolorallocatealpha($image, 255, 255, 0, 75); +$red = imagecolorallocatealpha($image, 255, 0, 0, 75); +$blue = imagecolorallocatealpha($image, 0, 0, 255, 75); // drawing 3 overlapped circle -ImageFilledEllipse($Image, $yellowX, $yellowY,$radius,$radius,$yellow); -ImageFilledEllipse($Image, $redX, $redY,$radius,$radius,$red); -ImageFilledEllipse($Image, $blueX, $blueY,$radius,$radius,$blue); - -// don't forget to output correct header! -header('Content-Type: image/png'); - -// output the result -ImagePNG($Image); -ImageDestroy($Image); +imagefilledellipse($image, $yellow_x, $yellow_y, $radius, $radius, $yellow); +imagefilledellipse($image, $red_x, $red_y, $radius, $radius, $red); +imagefilledellipse($image, $blue_x, $blue_y, $radius, $radius, $blue); + +// don't forget to output a correct header! +header('Content-type: image/png'); + +// and finally, output the result +imagepng($image); +imagedestroy($image); ?> ]]> </programlisting>

« previous php.doc (#969355852) next »