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
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php