php-doc-en/reference/image/functions/imagefilledpolygon.xml
2005-08-10 04:48:11 +00:00

88 lines
2.5 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
<refentry id="function.imagefilledpolygon">
<refnamediv>
<refname>imagefilledpolygon</refname>
<refpurpose>Draw a filled polygon</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>imagefilledpolygon</methodname>
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
<methodparam><type>array</type><parameter>points</parameter></methodparam>
<methodparam><type>int</type><parameter>num_points</parameter></methodparam>
<methodparam><type>int</type><parameter>color</parameter></methodparam>
</methodsynopsis>
<para>
<function>imagefilledpolygon</function> creates a filled polygon
in image <parameter>image</parameter>.
</para>
<para>
<parameter>points</parameter> is an array containing the
<literal>x</literal> and <literal>y</literal> co-ordinates
of the polygons vertices consecutively.
</para>
<para>
The parameter <parameter>num_points</parameter> is the total
number of vertices, which must be larger than 3.
</para>
<para>
<example>
<title><function>imagefilledpolygon</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// set up array of points for polygon
$values = array(
40, 50, // Point 1 (x, y)
20, 240, // Point 2 (x, y)
60, 60, // Point 3 (x, y)
240, 20, // Point 4 (x, y)
50, 40, // Point 5 (x, y)
10, 10 // Point 6 (x, y)
);
// create image
$image = imagecreatetruecolor(250, 250);
// some colors
$bg = imagecolorallocate($image, 200, 200, 200);
$blue = imagecolorallocate($image, 0, 0, 255);
// draw a polygon
imagefilledpolygon($image, $values, 6, $blue);
// flush image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->