Contents
Login Register Wishes Forum About
Language Reference » Drawing functions » drawGradientArea
Help topics
Latest updates
2147d  replaceImageMapTitle
2147d  replaceImageMapValues
2147d  createFunctionSerie
2147d  setAbsicssaPosition
2147d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
drawGradientArea - Rectangular gradient area

This function allows you to draw rectangular gradient areas. Most of the time, you‘ll use this function to build your image background. 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
drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="");
Where :

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


Customisation array - Tune up your gradient area!

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

The start color can be set with StartR, StartG, StartB.
The end color can be set with EndR, EndG, EndB.
The alpha transparency factor can be set with Alpha.
If Levels is specified, this will override the end colors by adding this value to the start colors. Levels can be either a positive or negative integer.


Sample script



 /* Left areas*/
 $GradientSettings = array("StartR"=>181,"StartG"=>209,"StartB"=>27,"Alpha"=>100,"Levels"=>-50);
 $myPicture->drawGradientArea(20,60,400,170,DIRECTION_HORIZONTAL,$GradientSettings);

 $GradientSettings = array("StartR"=>209,"StartG"=>134,"StartB"=>27,"Alpha"=>30,"Levels"=>-50);
 $myPicture->drawGradientArea(30,30,200,200,DIRECTION_VERTICAL,$GradientSettings);

  /* Right areas*/
 $GradientSettings = array("StartR"=>209,"StartG"=>31,"StartB"=>27,"Alpha"=>100,"Levels"=>50);
 $myPicture->drawGradientArea(480,50,650,80,DIRECTION_HORIZONTAL,$GradientSettings);

 $GradientSettings = array("StartR"=>209,"StartG"=>125,"StartB"=>27,"Alpha"=>100,"Levels"=>50);
 $myPicture->drawGradientArea(480,90,650,120,DIRECTION_VERTICAL,$GradientSettings);

 $GradientSettings = array("StartR"=>209,"StartG"=>198,"StartB"=>27,"Alpha"=>100,"Levels"=>50);
 $myPicture->drawGradientArea(480,130,650,160,DIRECTION_HORIZONTAL,$GradientSettings);

 $GradientSettings = array("StartR"=>134,"StartG"=>209,"StartB"=>27,"Alpha"=>100,"Levels"=>50);
 $myPicture->drawGradientArea(480,170,650,200,DIRECTION_HORIZONTAL,$GradientSettings);

This will draw 5 gradient areas with different directions and alpha factors.
Last updated on 10/13/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.