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*


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@265143 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kalle Sommer Nielsen 2008-08-20 00:08:24 +00:00
parent ad7d582a65
commit 0cac5f6eb9
6 changed files with 102 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

View file

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

View file

@ -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>

View file

@ -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 @@ imagedestroy($im);
&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">

View file

@ -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