ading an example

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@143884 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2003-11-06 10:58:47 +00:00
parent 5f98a5dd9e
commit db9961247e

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
<refentry id="function.imagepolygon">
<refnamediv>
@ -22,6 +22,40 @@
= x1, points[3] = y1, etc. <parameter>num_points</parameter> is
the total number of points (vertices).
</para>
<para>
<example>
<title><function>imagepolygon</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// create a blank image
$image = imagecreate(400,300);
// fill the background color
$bg = imagecolorallocate($image,0,0,0);
// choose a color for the polygon
$col_poly = imagecolorallocate($image,255,255,255);
// draw the polygon
imagepolygon($image,
array (
0, 0,
100, 200,
300, 200
),
3,
$col_poly);
// output the picture
header("Content-type: image/png");
imagepng($image);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>imagecreate</function> and
<function>imagecreatetruecolor</function>.