bjori Fri Jan 19 20:03:00 2007 UTC
Added files:
/phpdoc/en/reference/image/figures imagesetpixel.png
Modified files:
/phpdoc/en/reference/image/functions imagesetpixel.xml
Log:
Yet another example from Mehdi Achour
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagesetpixel.xml?r1=1.8&r2=1.9&diff_format=u
Index: phpdoc/en/reference/image/functions/imagesetpixel.xml
diff -u phpdoc/en/reference/image/functions/imagesetpixel.xml:1.8
phpdoc/en/reference/image/functions/imagesetpixel.xml:1.9
--- phpdoc/en/reference/image/functions/imagesetpixel.xml:1.8 Sun Jan 14
03:15:21 2007
+++ phpdoc/en/reference/image/functions/imagesetpixel.xml Fri Jan 19
20:03:00 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<refentry id="function.imagesetpixel">
<refnamediv>
<refname>imagesetpixel</refname>
@@ -58,6 +58,49 @@
&return.success;
</para>
</refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>imagesetpixel</function> example</title>
+ <para>
+ A random drawing that ends with a regular picture.
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$x = 200;
+$y = 200;
+
+$gd = imagecreatetruecolor($x, $y);
+
+$corners[0] = array('x' => 100, 'y' => 10);
+$corners[1] = array('x' => 0, 'y' => 190);
+$corners[2] = array('x' => 200, 'y' => 190);
+
+$red = imagecolorallocate($gd, 255, 0, 0);
+
+for ($i = 0; $i < 100000; $i++) {
+ imagesetpixel($gd, round($x),round($y), $red);
+ $a = rand(0, 2);
+ $x = ($x + $corners[$a]['x']) / 2;
+ $y = ($y + $corners[$a]['y']) / 2;
+}
+
+header('Content-Type: image/png');
+imagepng($gd);
+
+?>
+]]>
+ </programlisting>
+ &example.outputs.similar;
+ <screenshot>
+ <graphic fileref="figures/image.imagesetpixel.png" />
+ </screenshot>
+ </example>
+ </para>
+ </refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>