Contents
Login Register Wishes Forum About
Language Reference » Drawing functions » drawRoundedRectangle
Help topics
Latest updates
1998d  replaceImageMapTitle
1998d  replaceImageMapValues
1998d  createFunctionSerie
1998d  setAbsicssaPosition
1998d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
drawRoundedRectangle - boxes with rounded corners

This function allows you to draw rectangles with rounded corners. 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
drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="");
Where :

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


Customisation array - Tune up your box!

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

The line color can be set with R, G, B.
The alpha transparency factor can be set with Alpha.


Sample script



 /* Enable shadow support */
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 

 /* Left green box */
 $RectangleSettings = array("R"=>181,"G"=>209,"B"=>27,"Alpha"=>100);
 $myPicture->drawRoundedRectangle(20,60,400,170,10,$RectangleSettings);

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

 /* Right Red box */
 $RectangleSettings = array("R"=>209,"G"=>31,"B"=>27,"Alpha"=>100);
 $myPicture->drawRoundedRectangle(480,50,650,80,5,$RectangleSettings);

 /* Right Orange box */
 $RectangleSettings = array("R"=>209,"G"=>125,"B"=>27,"Alpha"=>100);
 $myPicture->drawRoundedRectangle(480,90,650,120,5,$RectangleSettings);

  /* Right Yellow box */
 $RectangleSettings = array("R"=>209,"G"=>198,"B"=>27,"Alpha"=>100);
 $myPicture->drawRoundedRectangle(480,130,650,160,5,$RectangleSettings);

 /* Right Green box */
 $RectangleSettings = array("R"=>134,"G"=>209,"B"=>27,"Alpha"=>100);
 $myPicture->drawRoundedRectangle(480,170,650,200,5,$RectangleSettings);

This will draw some transparency test on the left side of the picture and 4 colored boxes on the right. Shadow support is enabled on a (+1,+1) basis.
Last updated on 10/15/2009 
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. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.