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

From: Date: Sat, 16 Aug 2003 19:29:17 +0000
Subject: cvs: phpdoc /en/reference/image/functions imagecolorallocatealpha.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969355848@lists.php.net to get a copy of this message
cece Sat Aug 16 15:29:17 2003 EDT Modified files: /phpdoc/en/reference/image/functions imagecolorallocatealpha.xml Log: added example (incorporated from user notes) Index: phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml diff -u phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml:1.2 phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml:1.3 --- phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml:1.2 Fri Jun 20 10:37:21 2003 +++ phpdoc/en/reference/image/functions/imagecolorallocatealpha.xml Sat Aug 16 15:29:17 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="function.imagecolorallocatealpha"> <refnamediv> <refname>imagecolorallocatealpha</refname> @@ -26,6 +26,49 @@ <para> Returns &false; if the allocation failed. </para> + <para> + <example> + <title>Example of using <function>imagecolorallocatealpha</function></title> + <programlisting role="php"> +<![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; + +// 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 ); + +// 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); +?> +]]> + </programlisting> + </example> + <para> <para> See also <function>imagecolorallocate</function> and <function>imagecolordeallocate</function>.

« previous php.doc (#969355848) next »