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

From: Date: Wed, 16 Oct 2002 23:47:42 +0000
Subject: cvs: phpdoc /en/reference/image/functions imagecolorat.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349149@lists.php.net to get a copy of this message
mfischer Wed Oct 16 19:47:42 2002 EDT Modified files: /phpdoc/en/reference/image/functions imagecolorat.xml Log: - Document the behaviour on TrueColor images. Index: phpdoc/en/reference/image/functions/imagecolorat.xml diff -u phpdoc/en/reference/image/functions/imagecolorat.xml:1.3 phpdoc/en/reference/image/functions/imagecolorat.xml:1.4 --- phpdoc/en/reference/image/functions/imagecolorat.xml:1.3 Thu Apr 18 13:13:09 2002 +++ phpdoc/en/reference/image/functions/imagecolorat.xml Wed Oct 16 19:47:42 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/image.xml, last change in rev 1.36 --> <refentry id="function.imagecolorat"> <refnamediv> @@ -17,6 +17,26 @@ <para> Returns the index of the color of the pixel at the specified location in the image specified by <parameter>image</parameter>. + </para> + <para> + If PHP is compiled against GD library 2.0 or higher and the image is a + truecolor image, this function returns the RGB value of that pixel as + integer. Use bitshifting and masking to access the distinct red, green and blue + component values: + <example> + <title>Access distinct RGB values</title> + <programlisting role="php"> +<![CDATA[ +<?php +$im = ImageCreateFromPng("rockym.png"); +$rgb = ImageColorAt($im, 100, 100); +$r = ($rgb >> 16) & 0xFF; +$g = ($rgb >> 8) & 0xFF; +$b = $rgb & 0xFF; +?> +]]> + </programlisting> + </example> </para> <para> See also <function>imagecolorset</function> and

« previous php.doc (#969349149) next »