cvs: phpdoc /en/reference/image/figures imagecopy.gif imagerectangle.jpg /en/reference/image/functions imagecolorstotal.xml imagecopy.xml
imagecopymerge.xml imagecopymergegray.xml imagefontheight.xml imagefontwidth.xml imagegammacorrect.xml imageinterlace.xml imagerectangle.xml
| From: | Kalle Sommer Nielsen | Date: | Thu, 07 Aug 2008 12:34:02 +0000 |
| Subject: | cvs: phpdoc /en/reference/image/figures imagecopy.gif imagerectangle.jpg /en/reference/image/functions imagecolorstotal.xml imagecopy.xml imagecopymerge.xml imagecopymergegray.xml imagefontheight.xml imagefontwidth.xml imagegammacorrect.xml imageinterlace.xml imagerectangle.xml |
||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-1999@lists.php.net to get a copy of this message | ||
kalle Thu Aug 7 12:34:02 2008 UTC
Added files:
/phpdoc/en/reference/image/figures imagecopy.gif imagerectangle.jpg
Modified files:
/phpdoc/en/reference/image/functions imagecolorstotal.xml
imagecopy.xml
imagecopymerge.xml
imagecopymergegray.xml
imagefontheight.xml
imagefontwidth.xml
imagegammacorrect.xml
imageinterlace.xml
imagerectangle.xml
Log:
Added examples for GD (imagecopy* + imagerectangle examples by Ross Masters):
* imagecolorstotal
* imagecopy
* imagecopymerge
* imagecopymergegray
* imagefontheight
* imagefontwidth
* imagegammacorrect
* imageinterlace
* imagerectangle
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecolorstotal.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/image/functions/imagecolorstotal.xml diff -u phpdoc/en/reference/image/functions/imagecolorstotal.xml:1.7 phpdoc/en/reference/image/functions/imagecolorstotal.xml:1.8 --- phpdoc/en/reference/image/functions/imagecolorstotal.xml:1.7 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imagecolorstotal.xml Thu Aug 7 12:34:01 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.imagecolorstotal" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecolorstotal</refname> @@ -30,6 +30,33 @@ truecolor images. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Getting total number of colors in an image using <function>imagecolorstotal</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instance +$im = imagecreatefromgif('php.gif'); + +echo 'Total colors in image: ' . imagecolorstotal($im); + +// Free image +imagedestroy($im); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Colors: 128 +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopy.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/image/functions/imagecopy.xml diff -u phpdoc/en/reference/image/functions/imagecopy.xml:1.7 phpdoc/en/reference/image/functions/imagecopy.xml:1.8 --- phpdoc/en/reference/image/functions/imagecopy.xml:1.7 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecopy.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.imagecopy" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecopy</refname> @@ -105,6 +105,40 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + + <example> + <title>Cropping the PHP.net logo</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instances +$src = imagecreatefromgif('php.gif'); +$dest = imagecreatetruecolor(80, 40); + +// Copy +imagecopy($dest, $src, 0, 0, 20, 13, 80, 40); + +// Output and free from memory +header('Content-Type: image/gif'); +imagegif($dest); + +imagedestroy($dest); +imagedestroy($src); +?> +]]> + </programlisting> + &example.outputs.similar; + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.imagecopy.gif"/> + </imageobject> + </mediaobject> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopymerge.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagecopymerge.xml diff -u phpdoc/en/reference/image/functions/imagecopymerge.xml:1.8 phpdoc/en/reference/image/functions/imagecopymerge.xml:1.9 --- phpdoc/en/reference/image/functions/imagecopymerge.xml:1.8 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecopymerge.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagecopymerge" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecopymerge</refname> @@ -118,6 +118,33 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Merging two copies of the PHP.net logo with 75% transparency</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instances +$dest = imagecreatefromgif('php.gif'); +$src = imagecreatefromgif('php.gif'); + +// Copy and merge +imagecopymerge($dest, $src, 10, 10, 0, 0, 100, 47, 75); + +// Output and free free from memory +header('Content-Type: image/gif'); +imagegif($dest); + +imagedestroy($dest); +imagedestroy($src); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopymergegray.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagecopymergegray.xml diff -u phpdoc/en/reference/image/functions/imagecopymergegray.xml:1.8 phpdoc/en/reference/image/functions/imagecopymergegray.xml:1.9 --- phpdoc/en/reference/image/functions/imagecopymergegray.xml:1.8 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecopymergegray.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagecopymergegray" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecopymergegray</refname> @@ -106,11 +106,11 @@ <term><parameter>pct</parameter></term> <listitem> <para> - The two images will be merged according to <parameter>pct</parameter> - which can range from 0 to 100. When <parameter>pct</parameter> = 0, - no action is taken, when 100 this function behaves identically - to <function>imagecopy</function> for pallete images, while it - implements alpha transparency for true colour images. + The <parameter>src_im</parameter> will be changed to grayscale according + to <parameter>pct</parameter> where 0 is fully grayscale and 100 is + unchanged. When <parameter>pct</parameter> = 100 this function behaves + identically to <function>imagecopy</function> for pallete images, while + it implements alpha transparency for true colour images. </para> </listitem> </varlistentry> @@ -123,6 +123,33 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>imagecopymergegray</function> usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instances +$dest = imagecreatefromgif('php.gif'); +$src = imagecreatefromgif('php.gif'); + +// Copy and merge - Gray = 20% +imagecopymergegray($dest, $src, 10, 10, 0, 0, 100, 47, 20); + +// Output and free free from memory +header('Content-Type: image/gif'); +imagegif($dest); + +imagedestroy($dest); +imagedestroy($src); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagefontheight.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/image/functions/imagefontheight.xml diff -u phpdoc/en/reference/image/functions/imagefontheight.xml:1.5 phpdoc/en/reference/image/functions/imagefontheight.xml:1.6 --- phpdoc/en/reference/image/functions/imagefontheight.xml:1.5 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imagefontheight.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry xml:id="function.imagefontheight" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagefontheight</refname> @@ -29,6 +29,46 @@ Returns the height of the pixel. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Using <function>imagefontheight</function> on built-in fonts</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Font height: ' . imagefontheight(4); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font height: 16 +]]> + </screen> + </example> + <example> + <title>Using <function>imagefontheight</function> together with <function>imageloadfont</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Load a .gdf font +$font = imageloadfont('anonymous.gdf'); + +echo 'Font height: ' . imagefontheight($font); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font height: 43 +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagefontwidth.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/image/functions/imagefontwidth.xml diff -u phpdoc/en/reference/image/functions/imagefontwidth.xml:1.5 phpdoc/en/reference/image/functions/imagefontwidth.xml:1.6 --- phpdoc/en/reference/image/functions/imagefontwidth.xml:1.5 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imagefontwidth.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry xml:id="function.imagefontwidth" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagefontwidth</refname> @@ -29,6 +29,46 @@ Returns the width of the pixel </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Using <function>imagefontwidth</function> on built-in fonts</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Font width: ' . imagefontwidth(4); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font width: 8 +]]> + </screen> + </example> + <example> + <title>Using <function>imagefontwidth</function> together with <function>imageloadfont</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Load a .gdf font +$font = imageloadfont('anonymous.gdf'); + +echo 'Font width: ' . imagefontwidth($font); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font width: 23 +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagegammacorrect.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagegammacorrect.xml diff -u phpdoc/en/reference/image/functions/imagegammacorrect.xml:1.8 phpdoc/en/reference/image/functions/imagegammacorrect.xml:1.9 --- phpdoc/en/reference/image/functions/imagegammacorrect.xml:1.8 Tue Aug 5 07:32:05 2008 +++ phpdoc/en/reference/image/functions/imagegammacorrect.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagegammacorrect" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagegammacorrect</refname> @@ -48,6 +48,29 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>imagegammacorrect</function> usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instance +$im = imagecreatefromgif('php.gif'); + +// Correct gamma, out = 1.537 +imagegammacorrect($im, 1.0, 1.537); + +// Save and free image +imagegif($im, './php_gamma_corrected.gif'); +imagedestroy($im); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imageinterlace.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/image/functions/imageinterlace.xml diff -u phpdoc/en/reference/image/functions/imageinterlace.xml:1.6 phpdoc/en/reference/image/functions/imageinterlace.xml:1.7 --- phpdoc/en/reference/image/functions/imageinterlace.xml:1.6 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imageinterlace.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry xml:id="function.imageinterlace" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imageinterlace</refname> @@ -43,6 +43,29 @@ Returns 1 if the interlace bit is set for the image, 0 otherwise. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Turn on interlancing using <function>imageinterlace</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create an image instance +$im = imagecreatefrom('php.gif'); + +// Enable interlancing +imageinterlace($im); + +// Save the interfaced image +imagegif($im, './php_interlaced.gif'); +imagedestroy($im); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagerectangle.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagerectangle.xml diff -u phpdoc/en/reference/image/functions/imagerectangle.xml:1.8 phpdoc/en/reference/image/functions/imagerectangle.xml:1.9 --- phpdoc/en/reference/image/functions/imagerectangle.xml:1.8 Tue Aug 5 07:32:05 2008 +++ phpdoc/en/reference/image/functions/imagerectangle.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagerectangle" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagerectangle</refname> @@ -77,6 +77,44 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Simple <function>imagerectangle</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a 200 x 200 image +$canvas = imagecreatetruecolor(200, 200); + +// Allocate colors +$pink = imagecolorallocate($canvas, 255, 105, 180); +$white = imagecolorallocate($canvas, 255, 255, 255); +$green = imagecolorallocate($canvas, 132, 135, 28); + +// Draw three rectangles each with its own color +imagerectangle($canvas, 50, 50, 150, 150, $pink); +imagerectangle($canvas, 45, 60, 120, 100, $white); +imagerectangle($canvas, 100, 120, 75, 160, $green); + +// Output and free from memory +header('Content-Type: image/jpeg'); + +imagejpeg($canvas); +imagedestroy($canvas); +?> +]]> + </programlisting> + &example.outputs.similar; + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.imagerectangle.jpg"/> + </imageobject> + </mediaobject> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecolorstotal.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/image/functions/imagecolorstotal.xml diff -u phpdoc/en/reference/image/functions/imagecolorstotal.xml:1.7 phpdoc/en/reference/image/functions/imagecolorstotal.xml:1.8 --- phpdoc/en/reference/image/functions/imagecolorstotal.xml:1.7 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imagecolorstotal.xml Thu Aug 7 12:34:01 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.imagecolorstotal" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecolorstotal</refname> @@ -30,6 +30,33 @@ truecolor images. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Getting total number of colors in an image using <function>imagecolorstotal</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instance +$im = imagecreatefromgif('php.gif'); + +echo 'Total colors in image: ' . imagecolorstotal($im); + +// Free image +imagedestroy($im); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Colors: 128 +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopy.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/image/functions/imagecopy.xml diff -u phpdoc/en/reference/image/functions/imagecopy.xml:1.7 phpdoc/en/reference/image/functions/imagecopy.xml:1.8 --- phpdoc/en/reference/image/functions/imagecopy.xml:1.7 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecopy.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.imagecopy" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecopy</refname> @@ -105,6 +105,40 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + + <example> + <title>Cropping the PHP.net logo</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instances +$src = imagecreatefromgif('php.gif'); +$dest = imagecreatetruecolor(80, 40); + +// Copy +imagecopy($dest, $src, 0, 0, 20, 13, 80, 40); + +// Output and free from memory +header('Content-Type: image/gif'); +imagegif($dest); + +imagedestroy($dest); +imagedestroy($src); +?> +]]> + </programlisting> + &example.outputs.similar; + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.imagecopy.gif"/> + </imageobject> + </mediaobject> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopymerge.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagecopymerge.xml diff -u phpdoc/en/reference/image/functions/imagecopymerge.xml:1.8 phpdoc/en/reference/image/functions/imagecopymerge.xml:1.9 --- phpdoc/en/reference/image/functions/imagecopymerge.xml:1.8 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecopymerge.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagecopymerge" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecopymerge</refname> @@ -118,6 +118,33 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Merging two copies of the PHP.net logo with 75% transparency</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instances +$dest = imagecreatefromgif('php.gif'); +$src = imagecreatefromgif('php.gif'); + +// Copy and merge +imagecopymerge($dest, $src, 10, 10, 0, 0, 100, 47, 75); + +// Output and free free from memory +header('Content-Type: image/gif'); +imagegif($dest); + +imagedestroy($dest); +imagedestroy($src); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagecopymergegray.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagecopymergegray.xml diff -u phpdoc/en/reference/image/functions/imagecopymergegray.xml:1.8 phpdoc/en/reference/image/functions/imagecopymergegray.xml:1.9 --- phpdoc/en/reference/image/functions/imagecopymergegray.xml:1.8 Tue Aug 5 07:32:04 2008 +++ phpdoc/en/reference/image/functions/imagecopymergegray.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagecopymergegray" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagecopymergegray</refname> @@ -106,11 +106,11 @@ <term><parameter>pct</parameter></term> <listitem> <para> - The two images will be merged according to <parameter>pct</parameter> - which can range from 0 to 100. When <parameter>pct</parameter> = 0, - no action is taken, when 100 this function behaves identically - to <function>imagecopy</function> for pallete images, while it - implements alpha transparency for true colour images. + The <parameter>src_im</parameter> will be changed to grayscale according + to <parameter>pct</parameter> where 0 is fully grayscale and 100 is + unchanged. When <parameter>pct</parameter> = 100 this function behaves + identically to <function>imagecopy</function> for pallete images, while + it implements alpha transparency for true colour images. </para> </listitem> </varlistentry> @@ -123,6 +123,33 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>imagecopymergegray</function> usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instances +$dest = imagecreatefromgif('php.gif'); +$src = imagecreatefromgif('php.gif'); + +// Copy and merge - Gray = 20% +imagecopymergegray($dest, $src, 10, 10, 0, 0, 100, 47, 20); + +// Output and free free from memory +header('Content-Type: image/gif'); +imagegif($dest); + +imagedestroy($dest); +imagedestroy($src); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagefontheight.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/image/functions/imagefontheight.xml diff -u phpdoc/en/reference/image/functions/imagefontheight.xml:1.5 phpdoc/en/reference/image/functions/imagefontheight.xml:1.6 --- phpdoc/en/reference/image/functions/imagefontheight.xml:1.5 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imagefontheight.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry xml:id="function.imagefontheight" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagefontheight</refname> @@ -29,6 +29,46 @@ Returns the height of the pixel. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Using <function>imagefontheight</function> on built-in fonts</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Font height: ' . imagefontheight(4); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font height: 16 +]]> + </screen> + </example> + <example> + <title>Using <function>imagefontheight</function> together with <function>imageloadfont</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Load a .gdf font +$font = imageloadfont('anonymous.gdf'); + +echo 'Font height: ' . imagefontheight($font); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font height: 43 +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagefontwidth.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/image/functions/imagefontwidth.xml diff -u phpdoc/en/reference/image/functions/imagefontwidth.xml:1.5 phpdoc/en/reference/image/functions/imagefontwidth.xml:1.6 --- phpdoc/en/reference/image/functions/imagefontwidth.xml:1.5 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imagefontwidth.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry xml:id="function.imagefontwidth" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagefontwidth</refname> @@ -29,6 +29,46 @@ Returns the width of the pixel </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Using <function>imagefontwidth</function> on built-in fonts</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Font width: ' . imagefontwidth(4); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font width: 8 +]]> + </screen> + </example> + <example> + <title>Using <function>imagefontwidth</function> together with <function>imageloadfont</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Load a .gdf font +$font = imageloadfont('anonymous.gdf'); + +echo 'Font width: ' . imagefontwidth($font); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Font width: 23 +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagegammacorrect.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagegammacorrect.xml diff -u phpdoc/en/reference/image/functions/imagegammacorrect.xml:1.8 phpdoc/en/reference/image/functions/imagegammacorrect.xml:1.9 --- phpdoc/en/reference/image/functions/imagegammacorrect.xml:1.8 Tue Aug 5 07:32:05 2008 +++ phpdoc/en/reference/image/functions/imagegammacorrect.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagegammacorrect" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagegammacorrect</refname> @@ -48,6 +48,29 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>imagegammacorrect</function> usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create image instance +$im = imagecreatefromgif('php.gif'); + +// Correct gamma, out = 1.537 +imagegammacorrect($im, 1.0, 1.537); + +// Save and free image +imagegif($im, './php_gamma_corrected.gif'); +imagedestroy($im); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imageinterlace.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/image/functions/imageinterlace.xml diff -u phpdoc/en/reference/image/functions/imageinterlace.xml:1.6 phpdoc/en/reference/image/functions/imageinterlace.xml:1.7 --- phpdoc/en/reference/image/functions/imageinterlace.xml:1.6 Wed Jun 20 22:24:38 2007 +++ phpdoc/en/reference/image/functions/imageinterlace.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry xml:id="function.imageinterlace" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imageinterlace</refname> @@ -43,6 +43,29 @@ Returns 1 if the interlace bit is set for the image, 0 otherwise. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Turn on interlancing using <function>imageinterlace</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create an image instance +$im = imagecreatefrom('php.gif'); + +// Enable interlancing +imageinterlace($im); + +// Save the interfaced image +imagegif($im, './php_interlaced.gif'); +imagedestroy($im); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/functions/imagerectangle.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/image/functions/imagerectangle.xml diff -u phpdoc/en/reference/image/functions/imagerectangle.xml:1.8 phpdoc/en/reference/image/functions/imagerectangle.xml:1.9 --- phpdoc/en/reference/image/functions/imagerectangle.xml:1.8 Tue Aug 5 07:32:05 2008 +++ phpdoc/en/reference/image/functions/imagerectangle.xml Thu Aug 7 12:34:02 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry xml:id="function.imagerectangle" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>imagerectangle</refname> @@ -77,6 +77,44 @@ &return.success; </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Simple <function>imagerectangle</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Create a 200 x 200 image +$canvas = imagecreatetruecolor(200, 200); + +// Allocate colors +$pink = imagecolorallocate($canvas, 255, 105, 180); +$white = imagecolorallocate($canvas, 255, 255, 255); +$green = imagecolorallocate($canvas, 132, 135, 28); + +// Draw three rectangles each with its own color +imagerectangle($canvas, 50, 50, 150, 150, $pink); +imagerectangle($canvas, 45, 60, 120, 100, $white); +imagerectangle($canvas, 100, 120, 75, 160, $green); + +// Output and free from memory +header('Content-Type: image/jpeg'); + +imagejpeg($canvas); +imagedestroy($canvas); +?> +]]> + </programlisting> + &example.outputs.similar; + <mediaobject> + <imageobject> + <imagedata fileref="figures/image.imagerectangle.jpg"/> + </imageobject> + </mediaobject> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file