| 1 |
lars |
1 |
<style type="text/css">
|
|
|
2 |
<!--
|
|
|
3 |
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
4 |
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
5 |
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
|
|
|
6 |
th {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
|
|
7 |
//-->
|
|
|
8 |
</style><hr><a name="_C_SHAPE"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>Shape</b></div>
|
|
|
9 |
<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>
|
|
|
10 |
<a href="Shape.html#_SHAPE_CIRCLE">Circle()</a> <br>
|
|
|
11 |
<a href="Shape.html#_SHAPE_FILLEDCIRCLE">FilledCircle()</a> <br>
|
|
|
12 |
<a href="Shape.html#_SHAPE_FILLEDPOLYGON">FilledPolygon()</a> <br>
|
|
|
13 |
<a href="Shape.html#_SHAPE_FILLEDRECTANGLE">FilledRectangle()</a> <br>
|
|
|
14 |
<a href="Shape.html#_SHAPE_FILLEDROUNDEDRECTANGLE">FilledRoundedRectangle()</a> <br>
|
|
|
15 |
<a href="Shape.html#_SHAPE_INDENTEDRECTANGLE">IndentedRectangle()</a> <br>
|
|
|
16 |
<a href="Shape.html#_SHAPE_LINE">Line()</a> <br>
|
|
|
17 |
<a href="Shape.html#_SHAPE_POLYGON">Polygon()</a> <br>
|
|
|
18 |
<a href="Shape.html#_SHAPE_RECTANGLE">Rectangle()</a> <br>
|
|
|
19 |
<a href="Shape.html#_SHAPE_ROUNDEDRECTANGLE">RoundedRectangle()</a> <br>
|
|
|
20 |
<a href="Shape.html#_SHAPE_SETCOLOR">SetColor()</a> <br>
|
|
|
21 |
<a href="Shape.html#_SHAPE_SETTEXTALIGN">SetTextAlign()</a> <br>
|
|
|
22 |
<a href="Shape.html#_SHAPE_SHADOWRECTANGLE">ShadowRectangle()</a> <br>
|
|
|
23 |
<a href="Shape.html#_SHAPE_SHAPE">Shape()</a> <br>
|
|
|
24 |
</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.
|
|
|
25 |
<p>
|
|
|
26 |
<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>
|
|
|
27 |
<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">
|
|
|
28 |
function Bezier($p,$aSteps)</font>
|
|
|
29 |
</b></div></a></span>
|
|
|
30 |
|
|
|
31 |
<span style='font-family:arial;font-size:90%;'><i>Draw a bezier curve </i></span><p>
|
|
|
32 |
|
|
|
33 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
34 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
35 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
36 |
$p</font>
|
|
|
37 |
|
|
|
38 |
</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>
|
|
|
39 |
|
|
|
40 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
41 |
$aSteps</font>
|
|
|
42 |
|
|
|
43 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
44 |
40</font>
|
|
|
45 |
</td><td>Number of line segments in curve</td></tr>
|
|
|
46 |
</table>
|
|
|
47 |
|
|
|
48 |
<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
|
|
|
49 |
<p>
|
|
|
50 |
(0,1) x0,y0 (First point on curver)<br>
|
|
|
51 |
(2,3) x,y, (Control point 1)<br>
|
|
|
52 |
(4,5) x,y, (Control point 2)<br>
|
|
|
53 |
(6,7) x,y, (End point of curve)<br>
|
|
|
54 |
<p>
|
|
|
55 |
See example in canvasbezierex1.php
|
|
|
56 |
|
|
|
57 |
<br>
|
|
|
58 |
|
|
|
59 |
<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">
|
|
|
60 |
$p = array(3,6,6,9,5,3,7,4);
<br />
<br />$shape->SetColor('black');
<br />$shape->Bezier($p);
<br /></font>
|
|
|
61 |
</span><br>
|
|
|
62 |
<p>
|
|
|
63 |
<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">
|
|
|
64 |
function Circle($x1,$y1,$r)</font>
|
|
|
65 |
</b></div></a></span>
|
|
|
66 |
|
|
|
67 |
<span style='font-family:arial;font-size:90%;'><i>Draw a circle</i></span><p>
|
|
|
68 |
|
|
|
69 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
70 |
|
|
|
71 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Center X-coordinate</td></tr>
|
|
|
75 |
|
|
|
76 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
</table>
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
<br>
|
|
|
89 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_CIRCLE">Image::Circle</a>
|
|
|
90 |
|
|
|
91 |
// 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>
|
|
|
92 |
</span><br>
|
|
|
93 |
<p>
|
|
|
94 |
<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">
|
|
|
95 |
function FilledCircle($x1,$y1,$r)</font>
|
|
|
96 |
</b></div></a></span>
|
|
|
97 |
|
|
|
98 |
<span style='font-family:arial;font-size:90%;'><i>Draw a filled circle to a canvas</i></span><p>
|
|
|
99 |
|
|
|
100 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
101 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
102 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
103 |
$x1</font>
|
|
|
104 |
|
|
|
105 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Center X-coordinate</td></tr>
|
|
|
106 |
|
|
|
107 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
108 |
$y1</font>
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
$r</font>
|
|
|
114 |
|
|
|
115 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Radius</td></tr>
|
|
|
116 |
</table>
|
|
|
117 |
|
|
|
118 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled circle on the canvas using the specified scale.
|
|
|
119 |
|
|
|
120 |
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.
|
|
|
121 |
<br>
|
|
|
122 |
|
|
|
123 |
<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">
|
|
|
124 |
|
|
|
125 |
</span><br>
|
|
|
126 |
<p>
|
|
|
127 |
|
|
|
128 |
function FilledPolygon($p)</font>
|
|
|
129 |
</b></div></a></span>
|
|
|
130 |
|
|
|
131 |
<span style='font-family:arial;font-size:90%;'><i>Draw a filled polygon</i></span><p>
|
|
|
132 |
|
|
|
133 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
134 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
135 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
136 |
$p</font>
|
|
|
137 |
|
|
|
138 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Polygon array</td></tr>
|
|
|
139 |
</table>
|
|
|
140 |
|
|
|
141 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled polygon <br>
|
|
|
142 |
<p>
|
|
|
143 |
<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">
|
|
|
144 |
function FilledRectangle($x1,$y1,$x2,$y2)</font>
|
|
|
145 |
</b></div></a></span>
|
|
|
146 |
|
|
|
147 |
<span style='font-family:arial;font-size:90%;'><i>Draw a filled rectangle on the canvas</i></span><p>
|
|
|
148 |
|
|
|
149 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
150 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
151 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
157 |
$y1</font>
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr>
|
|
|
165 |
|
|
|
166 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
167 |
$y2</font>
|
|
|
168 |
|
|
|
169 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr>
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled rectangle on the canvas using the current sclae.
|
|
|
173 |
<br>
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
<br />// .. add a rectangle
<br />$shape->SetColor('green');
<br />$shape->FilledRectangle(15,8,19,14);
<br /></font>
|
|
|
177 |
|
|
|
178 |
<p>
|
|
|
179 |
<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">
|
|
|
180 |
|
|
|
181 |
</b></div></a></span>
|
|
|
182 |
|
|
|
183 |
<span style='font-family:arial;font-size:90%;'><i>Create a filled rectangle with rounded corners</i></span><p>
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
187 |
|
|
|
188 |
$x1</font>
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
193 |
|
|
|
194 |
|
|
|
195 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr>
|
|
|
196 |
|
|
|
197 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr>
|
|
|
201 |
|
|
|
202 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
203 |
$y2</font>
|
|
|
204 |
|
|
|
205 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr>
|
|
|
206 |
|
|
|
207 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
null</font>
|
|
|
212 |
</td><td>Corner radius</td></tr>
|
|
|
213 |
</table>
|
|
|
214 |
|
|
|
215 |
|
|
|
216 |
<p>
|
|
|
217 |
|
|
|
218 |
function IndentedRectangle($xt,$yt,$w,$h,$iw,$ih,$aCorner,$aFillColor,$r)</font>
|
|
|
219 |
</b></div></a></span>
|
|
|
220 |
|
|
|
221 |
<span style='font-family:arial;font-size:90%;'><i>A filled rectangle with one corner 'indented'</i></span><p>
|
|
|
222 |
|
|
|
223 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
224 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
225 |
|
|
|
226 |
$xt</font>
|
|
|
227 |
|
|
|
228 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr>
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
$yt</font>
|
|
|
232 |
|
|
|
233 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr>
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
$w</font>
|
|
|
237 |
|
|
|
238 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Width</td></tr>
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
$h</font>
|
|
|
242 |
|
|
|
243 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Height</td></tr>
|
|
|
244 |
|
|
|
245 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
0</font>
|
|
|
250 |
</td><td>Indented width</td></tr>
|
|
|
251 |
|
|
|
252 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
0</font>
|
|
|
257 |
</td><td>Indeted height</td></tr>
|
|
|
258 |
|
|
|
259 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
263 |
|
|
|
264 |
</td><td>Corner to indent</td></tr>
|
|
|
265 |
|
|
|
266 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
267 |
$aFillColor</font>
|
|
|
268 |
|
|
|
269 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
270 |
|
|
|
271 |
</td><td>Fill color</td></tr>
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
$r</font>
|
|
|
275 |
|
|
|
276 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
277 |
|
|
|
278 |
</td><td>Corner radius</td></tr>
|
|
|
279 |
</table>
|
|
|
280 |
|
|
|
281 |
<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
|
|
|
282 |
'iw' width and 'ih' height.
|
|
|
283 |
<p>
|
|
|
284 |
|
|
|
285 |
0=Top left, 1=top right, 2=bottom right, 3=bottom left
|
|
|
286 |
<br>
|
|
|
287 |
|
|
|
288 |
<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">
|
|
|
289 |
function Line($x1,$y1,$x2,$y2)</font>
|
|
|
290 |
</b></div></a></span>
|
|
|
291 |
|
|
|
292 |
<span style='font-family:arial;font-size:90%;'><i>Draw a line between</i></span><p>
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
296 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
297 |
$x1</font>
|
|
|
298 |
|
|
|
299 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>X1</td></tr>
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
$y1</font>
|
|
|
303 |
|
|
|
304 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Y1</td></tr>
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
$x2</font>
|
|
|
308 |
|
|
|
309 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>X2</td></tr>
|
|
|
310 |
|
|
|
311 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
312 |
$y2</font>
|
|
|
313 |
|
|
|
314 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Y2</td></tr>
|
|
|
315 |
</table>
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="Image.html#_IMAGE_LINE">Image::Line</a>
|
|
|
319 |
|
|
|
320 |
<br />// Add a black line
<br />$shape->SetColor('black');
<br />$shape->Line(0,0,20,20);
<br /></font>
|
|
|
321 |
</span><br>
|
|
|
322 |
<p>
|
|
|
323 |
<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">
|
|
|
324 |
|
|
|
325 |
</b></div></a></span>
|
|
|
326 |
|
|
|
327 |
<span style='font-family:arial;font-size:90%;'><i>Draw a closed polygon</i></span><p>
|
|
|
328 |
|
|
|
329 |
|
|
|
330 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
331 |
|
|
|
332 |
$p</font>
|
|
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
|
337 |
$aClosed</font>
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
false</font>
|
|
|
341 |
</td><td>No description available</td></tr>
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a closed polygon <br>
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
$p = array(3,6,6,9,5,3,7,4);
<br />$shape->SetColor('blue:0.35');
<br />$shape->Polygon($p);</font>
|
|
|
348 |
</span><br>
|
|
|
349 |
<p>
|
|
|
350 |
<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">
|
|
|
351 |
function Rectangle($x1,$y1,$x2,$y2)</font>
|
|
|
352 |
</b></div></a></span>
|
|
|
353 |
|
|
|
354 |
<span style='font-family:arial;font-size:90%;'><i>Draw a rectangle on the canvas</i></span><p>
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
358 |
|
|
|
359 |
$x1</font>
|
|
|
360 |
|
|
|
361 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr>
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
$y1</font>
|
|
|
365 |
|
|
|
366 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr>
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
$x2</font>
|
|
|
370 |
|
|
|
371 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr>
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
$y2</font>
|
|
|
375 |
|
|
|
376 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr>
|
|
|
377 |
</table>
|
|
|
378 |
|
|
|
379 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a rectangle on the canvas using the current scale. <br>
|
|
|
380 |
|
|
|
381 |
<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">
|
|
|
382 |
// .. add a rectangle
<br />$shape->SetColor('green');
<br />$shape->Rectangle(15,8,19,14);
<br /></font>
|
|
|
383 |
</span><br>
|
|
|
384 |
<p>
|
|
|
385 |
|
|
|
386 |
function RoundedRectangle($x1,$y1,$x2,$y2,$r)</font>
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
<span style='font-family:arial;font-size:90%;'><i>Draw a rectangle with rounded corners</i></span><p>
|
|
|
390 |
|
|
|
391 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
392 |
|
|
|
393 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
394 |
|
|
|
395 |
|
|
|
396 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr>
|
|
|
397 |
|
|
|
398 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
399 |
|
|
|
400 |
|
|
|
401 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr>
|
|
|
402 |
|
|
|
403 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
404 |
|
|
|
405 |
|
|
|
406 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr>
|
|
|
407 |
|
|
|
408 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
409 |
$y2</font>
|
|
|
410 |
|
|
|
411 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right Y</td></tr>
|
|
|
412 |
|
|
|
413 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
414 |
$r</font>
|
|
|
415 |
|
|
|
416 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
417 |
null</font>
|
|
|
418 |
</td><td>Corner radius</td></tr>
|
|
|
419 |
</table>
|
|
|
420 |
|
|
|
421 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a rectangle with rounded corners <br>
|
|
|
422 |
<p>
|
|
|
423 |
|
|
|
424 |
function SetColor($aColor)</font>
|
|
|
425 |
|
|
|
426 |
|
|
|
427 |
<span style='font-family:arial;font-size:90%;'><i>Specify color to use when drawing shapes</i></span><p>
|
|
|
428 |
|
|
|
429 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
430 |
|
|
|
431 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Color specification</td></tr>
|
|
|
435 |
|
|
|
436 |
|
|
|
437 |
|
|
|
438 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also</div><a href="RGB.html#_RGB_COLOR">RGB::Color</a>
|
|
|
439 |
<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">
|
|
|
440 |
|
|
|
441 |
</span><br>
|
|
|
442 |
|
|
|
443 |
<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">
|
|
|
444 |
function SetTextAlign($halign,$valign)</font>
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
450 |
|
|
|
451 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
452 |
$halign</font>
|
|
|
453 |
|
|
|
454 |
</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>
|
|
|
455 |
|
|
|
456 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
457 |
$valign</font>
|
|
|
458 |
|
|
|
459 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
460 |
"bottom"</font>
|
|
|
461 |
|
|
|
462 |
</table>
|
|
|
463 |
|
|
|
464 |
<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
|
|
|
465 |
|
|
|
466 |
<ul>
|
|
|
467 |
<li> "left"
|
|
|
468 |
|
|
|
469 |
<li> "right"
|
|
|
470 |
</ul>
|
|
|
471 |
|
|
|
472 |
and for vertical
|
|
|
473 |
|
|
|
474 |
|
|
|
475 |
<ul>
|
|
|
476 |
<li> "top"
|
|
|
477 |
<li> "center"
|
|
|
478 |
<li> "bottom"
|
|
|
479 |
</ul>
|
|
|
480 |
<br>
|
|
|
481 |
|
|
|
482 |
<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">
|
|
|
483 |
// 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>
|
|
|
484 |
|
|
|
485 |
<p>
|
|
|
486 |
|
|
|
487 |
function ShadowRectangle($x1,$y1,$x2,$y2,$fcolor,$shadow_width,$shadow_color)</font>
|
|
|
488 |
</b></div></a></span>
|
|
|
489 |
|
|
|
490 |
<span style='font-family:arial;font-size:90%;'><i>Draw a filled rectangle with a drop shadow</i></span><p>
|
|
|
491 |
|
|
|
492 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
493 |
|
|
|
494 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
495 |
$x1</font>
|
|
|
496 |
|
|
|
497 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left X</td></tr>
|
|
|
498 |
|
|
|
499 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
500 |
$y1</font>
|
|
|
501 |
|
|
|
502 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Top left Y</td></tr>
|
|
|
503 |
|
|
|
504 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
505 |
$x2</font>
|
|
|
506 |
|
|
|
507 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Bottom right X</td></tr>
|
|
|
508 |
|
|
|
509 |
|
|
|
510 |
$y2</font>
|
|
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
|
514 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
515 |
$fcolor</font>
|
|
|
516 |
|
|
|
517 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
518 |
false</font>
|
|
|
519 |
|
|
|
520 |
|
|
|
521 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
522 |
$shadow_width</font>
|
|
|
523 |
|
|
|
524 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
525 |
null</font>
|
|
|
526 |
</td><td>Shadow width</td></tr>
|
|
|
527 |
|
|
|
528 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
529 |
$shadow_color</font>
|
|
|
530 |
|
|
|
531 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
532 |
|
|
|
533 |
</td><td>Shadow color</td></tr>
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Draw a filled rectangle with a drop shadow <br>
|
|
|
537 |
<p>
|
|
|
538 |
<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">
|
|
|
539 |
|
|
|
540 |
</b></div></a></span>
|
|
|
541 |
|
|
|
542 |
<span style='font-family:arial;font-size:90%;'><i>Methods to draw shapes on canvas</i></span><p>
|
|
|
543 |
|
|
|
544 |
|
|
|
545 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
546 |
|
|
|
547 |
&$aGraph</font>
|
|
|
548 |
|
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
&$scale</font>
|
|
|
553 |
|
|
|
554 |
|
|
|
555 |
</table>
|
|
|
556 |
|
|
|
557 |
<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>
|
|
|
558 |
<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>
|
|
|
559 |
|
|
|
560 |
// 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>
|
|
|
561 |
</span><br>
|
|
|
562 |
<p> <hr> <p>
|