Blame | Letzte Änderung | Log anzeigen | RSS feed
<style type="text/css"><!--A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}th {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}//--></style><hr><a name="_C_SHAPE"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>Shape</b></div><i>(Defined in: jpgraph_canvtools.php : 69)</i><table border=1><tr><td> <a href="Shape.html" style="font-family:arial;font-weight:bold;color:darkblue;">Shape</a> </td></tr><tr><td valign=top> <a href="Shape.html#_SHAPE_BEZIER">Bezier()</a> <br> <a href="Shape.html#_SHAPE_CIRCLE">Circle()</a> <br> <a href="Shape.html#_SHAPE_FILLEDCIRCLE">FilledCircle()</a> <br> <a href="Shape.html#_SHAPE_FILLEDPOLYGON">FilledPolygon()</a> <br> <a href="Shape.html#_SHAPE_FILLEDRECTANGLE">FilledRectangle()</a> <br> <a href="Shape.html#_SHAPE_FILLEDROUNDEDRECTANGLE">FilledRoundedRectangle()</a> <br> <a href="Shape.html#_SHAPE_INDENTEDRECTANGLE">IndentedRectangle()</a> <br> <a href="Shape.html#_SHAPE_LINE">Line()</a> <br> <a href="Shape.html#_SHAPE_POLYGON">Polygon()</a> <br> <a href="Shape.html#_SHAPE_RECTANGLE">Rectangle()</a> <br> <a href="Shape.html#_SHAPE_ROUNDEDRECTANGLE">RoundedRectangle()</a> <br> <a href="Shape.html#_SHAPE_SETCOLOR">SetColor()</a> <br> <a href="Shape.html#_SHAPE_SETTEXTALIGN">SetTextAlign()</a> <br> <a href="Shape.html#_SHAPE_SHADOWRECTANGLE">ShadowRectangle()</a> <br> <a href="Shape.html#_SHAPE_SHAPE">Shape()</a> <br></td></tr></table> <p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>This is mainly awrapper class around thye current image class used. It is meant to make it easier to work with a Canvas graph and a Canvas scale. Basically the class uses the specified scale to trasnalte coordinates which is then passed on to the standard Image routines.<p> <div style="font-weight:bold;font-family:arial;font-size:85%;">See also related classes:</div><a href="CanvasScale.html">CanvasScale</a> <p> <hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_BEZIER"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function Bezier($p,$aSteps)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a bezier curve </i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$p</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Array with control points</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$aSteps</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">40</font></td><td>Number of line segments in curve</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a Bezier line with specified in the $p array. The points are specified according to the current scale. The positions in the array has the following meaning<p>(0,1) x0,y0 (First point on curver)<br>(2,3) x,y, (Control point 1)<br>(4,5) x,y, (Control point 2)<br>(6,7) x,y, (End point of curve)<br><p>See example in canvasbezierex1.php <br><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">$p = array(3,6,6,9,5,3,7,4); <br /> <br />$shape->SetColor('black'); <br />$shape->Bezier($p); <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_CIRCLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function Circle($x1,$y1,$r)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a circle</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Center X-coordinate</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Center Y-coordinate</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$r</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Radius</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a circle onto the canvas <br> <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_CIRCLE">Image::Circle</a><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">// The shape class is wrapper around the Imgae class which translates <br />// the coordinates for us <br />$shape = new Shape($g,$scale); <br />$shape->SetColor('black'); <br /> <br /> <br />// .. and a circle (x,y,diameter) <br />$shape->Circle(5,14,2); <br /> <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_FILLEDCIRCLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function FilledCircle($x1,$y1,$r)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a filled circle to a canvas</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Center X-coordinate</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Center Y-coordinate</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$r</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Radius</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled circle on the canvas using the specified scale.<p>Note: If you are using GD1.xx you will see moire-patterns in large circles. This is due to the lack of a proper filled circle function in GD 1.xx. Using GD 2.xx will avoid this problem. <br> <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_FILLEDCIRCLE">Image::FilledCircle</a><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">// The shape class is wrapper around the Imgae class which translates <br />// the coordinates for us <br />$shape = new Shape($g,$scale); <br />$shape->SetColor('black'); <br /> <br /> <br />// .. and a circle (x,y,diameter) <br />$shape->FilledCircle(5,14,2); <br /> <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_FILLEDPOLYGON"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function FilledPolygon($p)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a filled polygon</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$p</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Polygon array</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled polygon <br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_FILLEDRECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function FilledRectangle($x1,$y1,$x2,$y2)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a filled rectangle on the canvas</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled rectangle on the canvas using the current sclae. <br><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000"><br />// .. add a rectangle <br />$shape->SetColor('green'); <br />$shape->FilledRectangle(15,8,19,14); <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_FILLEDROUNDEDRECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function FilledRoundedRectangle($x1,$y1,$x2,$y2,$r)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Create a filled rectangle with rounded corners</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$r</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">null</font></td><td>Corner radius</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Create a filled rectangle with rounded corners <br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_INDENTEDRECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function IndentedRectangle($xt,$yt,$w,$h,$iw,$ih,$aCorner,$aFillColor,$r)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>A filled rectangle with one corner 'indented'</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$xt</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$yt</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$w</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Width</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$h</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Height</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$iw</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">0</font></td><td>Indented width</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$ih</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">0</font></td><td>Indeted height</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$aCorner</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">3</font></td><td>Corner to indent</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$aFillColor</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">""</font></td><td>Fill color</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$r</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">4</font></td><td>Corner radius</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>A rounded rectangle where one of the corner has been moved "into" the rectangle. The indention is determined by the two argument'iw' width and 'ih' height.<p>The corners (as used in the $aCorner) are numbered as0=Top left, 1=top right, 2=bottom right, 3=bottom left <br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_LINE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function Line($x1,$y1,$x2,$y2)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a line between</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>X1</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Y1</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>X2</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Y2</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a line between two points in the canvas using the current scale. <br> <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_LINE">Image::Line</a><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000"><br />// Add a black line <br />$shape->SetColor('black'); <br />$shape->Line(0,0,20,20); <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_POLYGON"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function Polygon($p,$aClosed)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a closed polygon</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$p</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Array of points in polygon</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$aClosed</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">false</font></td><td>No description available</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a closed polygon <br><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">$p = array(3,6,6,9,5,3,7,4); <br />$shape->SetColor('blue:0.35'); <br />$shape->Polygon($p);</font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_RECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function Rectangle($x1,$y1,$x2,$y2)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a rectangle on the canvas</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a rectangle on the canvas using the current scale. <br><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">// .. add a rectangle <br />$shape->SetColor('green'); <br />$shape->Rectangle(15,8,19,14); <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_ROUNDEDRECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function RoundedRectangle($x1,$y1,$x2,$y2,$r)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a rectangle with rounded corners</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$r</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">null</font></td><td>Corner radius</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a rectangle with rounded corners <br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_SETCOLOR"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function SetColor($aColor)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Specify color to use when drawing shapes</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$aColor</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Color specification</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify color to use when drawing shapes <br> <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="RGB.html#_RGB_COLOR">RGB::Color</a><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">// Add a black line <br />$shape->SetColor('black'); <br />$shape->Line(0,0,20,20); <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_SETTEXTALIGN"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function SetTextAlign($halign,$valign)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Specify bae point for StrokeText()</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$halign</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Horizontal position for basepoint</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$valign</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">"bottom"</font></td><td>Vertical position for base point</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specifies how the coordinate for the text should be interpretated. Possible values for horizontal base-position are<ul><li> "left"<li> "center"<li> "right"</ul>and for vertical<ul><li> "top"<li> "center"<li> "bottom"</ul> <br><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">// Interpret the text coordinate as beeing the <br />// top left corner of the bounding box for the text <br />$shape->SetTextAlign('left','top'); <br /> <br />$shape->StrokeText(....) <br /></font></span><br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_SHADOWRECTANGLE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function ShadowRectangle($x1,$y1,$x2,$y2,$fcolor,$shadow_width,$shadow_color)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Draw a filled rectangle with a drop shadow</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y1</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$x2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$y2</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$fcolor</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">false</font></td><td>Fill color</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$shadow_width</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">null</font></td><td>Shadow width</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">$shadow_color</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">array(102,102,102)</font></td><td>Shadow color</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled rectangle with a drop shadow <br><p><p> <p> <span style='font-size:110%;'><a name="_SHAPE_SHAPE"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">function Shape(&$aGraph,&$scale)</font></b></div></a></span><span style='font-family:arial;font-size:90%;'><i>Methods to draw shapes on canvas</i></span><p><table cellspacing=0 style='border:black solid 1pt;' width=100%><tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">&$aGraph</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Canvas graph</td></tr><tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">&$scale</font></td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Canvas scale</td></tr></table><div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Create a new shape class used to draw siple shape onto a canvas using the specified scale. <br> <div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="CanvasGraph.html#_CANVASGRAPH_CANVASGRAPH">CanvasGraph::CanvasGraph</a> and <a href="CanvasScale.html#_CANVASSCALE_CANVASSCALE">CanvasScale::CanvasScale</a><div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">// Setup a basic canvas we can work <br />$g = new CanvasGraph(400,200,'auto'); <br />$g->SetMargin(5,11,6,11); <br />$g->SetShadow(); <br />$g->SetMarginColor("teal"); <br /> <br />// We need to stroke the plotarea and margin before we add the <br />// text since we otherwise would overwrite the text. <br />$g->InitFrame(); <br /> <br />// Create a new scale <br />$scale = new CanvasScale($g); <br />$scale->Set(0,$xmax,0,$ymax); <br /> <br />// The shape class is wrapper around the Imgae class which translates <br />// the coordinates for us <br />$shape = new Shape($g,$scale); <br /></font></span><br><p> <hr> <p>