Login Register Wishes Forum About
Language Reference » Drawing functions » drawPolygon
Help topics
Latest updates
4669d  replaceImageMapTitle
4669d  replaceImageMapValues
4669d  createFunctionSerie
4669d  setAbsicssaPosition
4669d  negateValues
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
drawPolygon - Draw polygons

This function allows you to draw aliased polygons on your pictures. It is possible to tune the rendering by playing with the $Format array. To learn more about this please read the Format array guide. Lines like all simple drawing functions are supporting anti-alias and shadows.

This function is also used internally by a lot of drawing functions (arrows, ...).

Calling this function
Where :

Points is an array of points.
Format is an array containing the drawing parameters of the polygon.

Customisation array - Tune up your polygon!

It is possible to customize the line rendering by playing with this array. Providing a detailled configuration is not mandatory, by default the polygon will be drawn black with no transparency.

The background color can be set with R, G, B.
The alpha transparency factor can be set with Alpha.
You can specify the border color BorderR,BorderG,BorderB parameter.
The alpha transparency factor of the border can be set with BorderAlpha.
You can use the Surrounding option to define the border color. This value will be added to the R,G,B factors to define the border color.

Sample script

 /* Enable shadow support */

 $White = array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-100);

 $Step  = 8;
   $Points = "";
     $Points[] = cos(deg2rad($j))*50+($i*140);
     $Points[] = sin(deg2rad($j))*50+120;
   $Step = $Step * 2;

This will draw 4 polygons. As the shadow support is enabled on line 2, the polygons will be surrounded by a small (+2,+2) shadow.
Last updated on 07/12/2010 
by Jean-Damien 
Linked resources
  There is no linked topic yet.
Community comments
  No comments have been posted yet.
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 415 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.