Language Reference » Drawing functions » drawSpline
drawSpline - Chain bezier curves
This function allows you to draw splines composed of many bezier curves 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.
A spline is a curve composed of mandatory way points. All other positions of the curve are computed using the bezier algorithm. As you may have noticed, you can‘t specify the control points used to compute the bezier segments, those points are computed internally using a trigonometric algorithm. The force applied to the control points can be adjusted with the Force parameter of the configuration array.
Calling this function
Coordinates is an array of arrays containing the way points. (see bellow)
Format is an array containing the drawing parameters of the pixel.
The coordinates must be specified in an array or points, a point is a two dimension array :
/* This is a point, X=10 and Y=30 */ $Point = array(10,30); /* This is a list of points (10,30) , (20,50) , (30,70) */ $Coordinates = array(array(10,30),array(20,50),array(30,70));
Customisation array - Tune up your spline!
It is possible to customize the pixel rendering by playing with this array. Providing a detailled configuration is not mandatory, by default the spline will be drawn black with no transparency.
The pixel color can be set with R, G, B.
The alpha transparency factor can be set with Alpha.
The force of the direction algorithm can be set with Force, default is 30.
If you want to display the computed control points, turn ShowControl to TRUE.
You can optionally provide the number of Segments that will compose the spline. It is not recommended to force this value, the best eye-candy / speed ratio is automatically computed based on the spline length.
You can draw dashed curves using the Ticks parameter.
/* Enable shadow support on a (+1,+1) basis */ $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); /* 1st spline drawn in white with control points visible */ $SplineSettings = array("R"=>255,"G"=>255,"B"=>255,"ShowControl"=>TRUE); $Coordinates = array(array(40,80),array(280,60),array(340,166),array(590,120)); $myPicture->drawSpline($Coordinates,$SplineSettings); /* 2nd spline dashed drawn in white with control points visible */ $SplineSettings = array("R"=>255,"G"=>255,"B"=>255,"ShowControl"=>TRUE,"Ticks"=>4); $Coordinates = array(array(250,50),array(250,180),array(350,180),array(350,50)); $myPicture->drawSpline($Coordinates,$SplineSettings);
This will draw two splines with visible control points. As the shadow support is enabled on line 2, the arrow will be surrounded by a small (+1,+1) shadow.
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.