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

This function allows you to draw filled rectangle, optionally you can set a border color. It is possible to tune the rendering by playing with the $Format array. To learn more about this please read the Format array guide. This functions are supporting anti-alias and shadows.

Calling this function
Where :

X1,Y1 are the start coordinate of the rectangle.
X2,Y2 are the end coordinate of the rectangle.
Format is an array containing the drawing parameters.

Customisation array - Tune up your area!

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

The fill color can be set with R, G, B.
The line color can be set with BorderR, BorderG, BorderB.
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.
The alpha transparency factor can be set with Alpha.
You can draw dashed border lines using the Ticks parameter.
You can enable zebra lines setting Dash to TRUE.
you can set the zebra steps with DashStep.
you can set the zebra color with DashR, DashG, DashB.

Sample script

 /* Enable shadow support */

 /* Left green box */
 $RectangleSettings = array("R"=>150,"G"=>200,"B"=>170,"Dash"=>TRUE,"DashR"=>170,"DashG"=>220,"DashB"=>190,"BorderR"=>255, "BorderG"=>255,"BorderB"=>255);

 /* Left orange surrounding box with an alpha factor of 30% */
 $RectangleSettings = array("R"=>209,"G"=>134,"B"=>27,"Alpha"=>30);

 /* Right Red box */
 $RectangleSettings = array("R"=>209,"G"=>31,"B"=>27,"Alpha"=>100,"Surrounding"=>30);

 /* Right Orange box */
 $RectangleSettings = array("R"=>209,"G"=>125,"B"=>27,"Alpha"=>100,"Surrounding"=>30);

  /* Right Yellow box */
 $RectangleSettings = array("R"=>209,"G"=>198,"B"=>27,"Alpha"=>100,"Surrounding"=>30,"Ticks"=>2);

 /* Right Green box */
 $RectangleSettings = array("R"=>134,"G"=>209,"B"=>27,"Alpha"=>100,"Surrounding"=>30,"Ticks"=>2);

This will draw some transparency test on the left side of the picture and 4 colored boxes on the right. The right boxes will be surrounded by a +30 colored border (R+30,G+30,B+30). Shadow support is enabled on a (+1,+1) basis.
Last updated on 11/29/2010 
by Jean-Damien 
Linked resources
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,02 seconds. Wiki revision 1.37.