2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-08-10 04:48:11 +00:00
|
|
|
<!-- $Revision: 1.10 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
|
|
|
|
<refentry id="function.imagepolygon">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>imagepolygon</refname>
|
|
|
|
<refpurpose>Draw a polygon</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
2005-06-23 16:53:27 +00:00
|
|
|
<type>bool</type><methodname>imagepolygon</methodname>
|
2002-04-18 17:13:10 +00:00
|
|
|
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
|
2002-04-15 00:12:54 +00:00
|
|
|
<methodparam><type>array</type><parameter>points</parameter></methodparam>
|
|
|
|
<methodparam><type>int</type><parameter>num_points</parameter></methodparam>
|
2003-02-12 17:49:07 +00:00
|
|
|
<methodparam><type>int</type><parameter>color</parameter></methodparam>
|
2002-04-15 00:12:54 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
<function>imagepolygon</function> creates a polygon in image id.
|
2002-04-18 17:13:10 +00:00
|
|
|
<parameter>points</parameter> is a PHP array containing the
|
2003-12-17 14:32:39 +00:00
|
|
|
polygon's vertices, i.e. points[0] = x0, points[1] = y0, points[2]
|
2002-04-18 17:13:10 +00:00
|
|
|
= x1, points[3] = y1, etc. <parameter>num_points</parameter> is
|
2003-01-20 01:36:05 +00:00
|
|
|
the total number of points (vertices).
|
2002-04-15 00:12:54 +00:00
|
|
|
</para>
|
2003-11-06 10:58:47 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>imagepolygon</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// create a blank image
|
2005-08-10 04:48:11 +00:00
|
|
|
$image = imagecreatetruecolor(400, 300);
|
2003-11-06 10:58:47 +00:00
|
|
|
|
|
|
|
// fill the background color
|
2003-12-18 17:46:56 +00:00
|
|
|
$bg = imagecolorallocate($image, 0, 0, 0);
|
2003-11-06 10:58:47 +00:00
|
|
|
|
|
|
|
// choose a color for the polygon
|
2003-12-18 17:46:56 +00:00
|
|
|
$col_poly = imagecolorallocate($image, 255, 255, 255);
|
2003-11-06 10:58:47 +00:00
|
|
|
|
|
|
|
// 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>
|
2002-04-15 00:12:54 +00:00
|
|
|
<para>
|
2003-01-20 01:36:05 +00:00
|
|
|
See also <function>imagecreate</function> and
|
|
|
|
<function>imagecreatetruecolor</function>.
|
2002-04-15 00:12:54 +00:00
|
|
|
</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
|
|
|
|
-->
|