cvs: phpdoc /en/reference/image/figures dashedline.png imagecolortransparent.png imagedashedline.png imagefilledrectangle.png
/en/reference/image/functions imagecolortransparent.xml imagedashedline.xml imagefilledrectangle.xml

From: Date: Wed, 20 Aug 2008 00:08:24 +0000
Subject: cvs: phpdoc /en/reference/image/figures dashedline.png imagecolortransparent.png imagedashedline.png imagefilledrectangle.png
/en/reference/image/functions imagecolortransparent.xml imagedashedline.xml imagefilledrectangle.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2059@lists.php.net to get a copy of this message
kalle Wed Aug 20 00:08:24 2008 UTC Added files: /phpdoc/en/reference/image/figures imagecolortransparent.png imagedashedline.png imagefilledrectangle.png Removed files: /phpdoc/en/reference/image/figures dashedline.png Modified files: /phpdoc/en/reference/image/functions imagecolortransparent.xml imagedashedline.xml imagefilledrectangle.xml Log: Added examples for gd documentation: * imagecolortransparent * imagefilledrectangle * Alternative to deprecated function imagedashedline Also changed dashedline.png to imagedashedline.png so all figures are named image* http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecolortransparent.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/image/functions/imagecolortransparent.xml diff -u phpdoc/en/reference/image/functions/imagecolortransparent.xml:1.11 phpdoc/en/reference/image/functions/imagecolortransparent.xml:1.12 --- phpdoc/en/reference/image/functions/imagecolortransparent.xml:1.11 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecolortransparent.xml Wed Aug 20 00:08:24 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <refentry xml:id="function.imagecolortransparent" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecolortransparent</refname> @@ -40,6 +40,40 @@ transparent color is returned. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>imagecolortransparent</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a 55x30 image +$im = imagecreatetruecolor(55, 30); +$red = imagecolorallocate($im, 255, 0, 0); +$black = imagecolorallocate($im, 0, 0, 0); + +// Make the background transparent +imagecolortransparent($im, $black); + +// Draw a red rectangle +imagefilledrectangle($im, 4, 4, 50, 25, $red); + +// Save the image +imagepng($im, './imagecolortransparent.png'); +imagedestroy($im); +?> +]]> + </programlisting> + &example.outputs.similar; + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.imagecolortransparent.png"/> + </imageobject> + </mediaobject> + </example> + </para> + </refsect1> <refsect1 role="notes"> &reftitle.notes; <note> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagedashedline.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/image/functions/imagedashedline.xml diff -u phpdoc/en/reference/image/functions/imagedashedline.xml:1.10 phpdoc/en/reference/image/functions/imagedashedline.xml:1.11 --- phpdoc/en/reference/image/functions/imagedashedline.xml:1.10 Thu Aug 14 10:08:22 2008 +++ phpdoc/en/reference/image/functions/imagedashedline.xml Wed Aug 20 00:08:24 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <refentry xml:id="function.imagedashedline" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagedashedline</refname> @@ -101,10 +101,44 @@ &example.outputs.similar; <mediaobject> <imageobject> - <imagedata fileref="figures/image.dashedline.png"/> + <imagedata fileref="figures/image.imagedashedline.png"/> </imageobject> </mediaobject> </example> + <example> + <title>Alternative to <function>imagedashedline</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a 100x100 image +$im = imagecreatetruecolor(100, 100); +$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF); + +// Define our style: First 4 pixels is white and the +// next 4 is transparent. This creates the dashed line effect +$style = Array( + $white, + $white, + $white, + $white, + IMG_COLOR_TRANSPARENT, + IMG_COLOR_TRANSPARENT, + IMG_COLOR_TRANSPARENT, + IMG_COLOR_TRANSPARENT + ) + +imagesetstyle($im, $style); + +// Draw the dashed line +imageline($im, 50, 25, 50, 75, IMG_COLOR_STYLED); + +// Save the image +imagepng($im, './imageline.png'); +imagedestroy($im); +?> +]]> + </programlisting> + </example> </para> </refsect1> <refsect1 role="seealso"> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagefilledrectangle.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/image/functions/imagefilledrectangle.xml diff -u phpdoc/en/reference/image/functions/imagefilledrectangle.xml:1.9 phpdoc/en/reference/image/functions/imagefilledrectangle.xml:1.10 --- phpdoc/en/reference/image/functions/imagefilledrectangle.xml:1.9 Tue Aug 5 07:32:05 2008 +++ phpdoc/en/reference/image/functions/imagefilledrectangle.xml Wed Aug 20 00:08:24 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <refentry xml:id="function.imagefilledrectangle" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagefilledrectangle</refname> @@ -77,6 +77,36 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>imagefilledrectangle</function> usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a 55x30 image +$im = imagecreatetruecolor(55, 30); +$white = imagecolorallocate($im, 255, 255, 255); + +// Draw a white rectangle +imagefilledrectangle($im, 4, 4, 50, 25, $white); + +// Save the image +imagepng($im, './imagefilledrectangle.png'); +imagedestroy($im); +?> +]]> + </programlisting> + &example.outputs.similar; + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.imagefilledrectangle.png"/> + </imageobject> + </mediaobject> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#2059) next »