1 |
jonen |
1.1 |
<?php |
2 |
|
|
/** |
3 |
|
|
* This file holds helper functions |
4 |
|
|
* for things related to SVG Tags |
5 |
|
|
* (Scalable Vector Graphics) |
6 |
|
|
* |
7 |
jonen |
1.3 |
* $Id: svg_utils.inc,v 1.8 2003/02/27 02:10:29 hemna Exp $ |
8 |
jonen |
1.1 |
* |
9 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
10 |
|
|
* @package phpHtmlLib |
11 |
|
|
* @link http://phphtmllib.newsblob.com |
12 |
|
|
*/ |
13 |
|
|
|
14 |
|
|
|
15 |
|
|
/** |
16 |
|
|
* This function is used to build an |
17 |
|
|
* SVG <a> tag |
18 |
|
|
* |
19 |
|
|
* @param string - the 'xlink:href' attribute |
20 |
|
|
* @param mixed - any N number of params for |
21 |
|
|
* content for the tag |
22 |
|
|
* @return Asvgtag object |
23 |
|
|
* @link http://www.w3.org/TR/SVG/linking.html#AElement |
24 |
|
|
*/ |
25 |
|
|
function svg_a($xlinkhref) { |
26 |
|
|
$tag = new Asvgtag( array("xlink:href" => $xlinkhref)); |
27 |
|
|
$num_args = func_num_args(); |
28 |
|
|
for ($i=1;$i<$num_args;$i++) { |
29 |
|
|
$tag->add(func_get_arg($i)); |
30 |
|
|
} |
31 |
|
|
return $tag; |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* This function is used to build an |
36 |
|
|
* SVG <animate> tag |
37 |
|
|
* |
38 |
|
|
* @param string - the 'from' attribute |
39 |
|
|
* @param string - the 'to' attribute |
40 |
|
|
* @param string - the 'duration' attribute |
41 |
|
|
* @param string - the 'attributeName' attribute |
42 |
|
|
* @param string - the 'attributeType' attribute |
43 |
|
|
* @param string - the 'repeatCount' attribute |
44 |
|
|
* @param string - the 'fill' attribute |
45 |
|
|
* @return ANIMATEsvgtag object |
46 |
|
|
* @link http://www.w3.org/TR/SVG/animate.html#AnimateElement |
47 |
|
|
*/ |
48 |
|
|
function svg_animate($from, $to, $duration, $attributename, |
49 |
|
|
$attributetype, $repeatcount=NULL, $fill=NULL) { |
50 |
|
|
$tag = new ANIMATEsvgtag( array("from" => $from, "to" => $to, |
51 |
|
|
"duration" => $duration, |
52 |
|
|
"attributeName" => $attributename, |
53 |
|
|
"attributeType" => $attributetype)); |
54 |
|
|
if ($repeatcount) { |
55 |
|
|
$tag->set_tag_attribute("repeatCount", $repeatcount); |
56 |
|
|
} |
57 |
|
|
if ($fill) { |
58 |
|
|
$tag->set_tag_attribute("fill", $fill); |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
return $tag; |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
/** |
65 |
|
|
* This function is used to build an |
66 |
|
|
* SVG <circle> tag and its common |
67 |
|
|
* attributes |
68 |
|
|
* |
69 |
|
|
* @param int - the 'cx' attribute. The x-axis |
70 |
|
|
* coordinate of the center of the circle |
71 |
|
|
* @param int - the 'cy' attribute. The y-axis |
72 |
|
|
* coordinate of the center of the circle |
73 |
|
|
* @param string - the 'r' (radius) attribute |
74 |
|
|
* @param string - the 'fill' attribute |
75 |
|
|
* @param string - the 'stroke' attribute |
76 |
|
|
* @param string - the 'stroke-width' attribute |
77 |
|
|
* @param string - the 'style' attribyte |
78 |
|
|
* @return CIRCLEsvgtag object |
79 |
|
|
* @link http://www.w3.org/TR/SVG/shapes.html |
80 |
|
|
*/ |
81 |
|
|
function svg_circle($cx, $cy, $radius, $fill="none", |
82 |
|
|
$stroke=NULL, $strokewidth=NULL, $style=NULL) { |
83 |
|
|
$tag = new CIRCLEsvgtag( array("cx" => $cx, "cy" => $cy, |
84 |
|
|
"r" => $radius)); |
85 |
|
|
if ($fill) { |
86 |
|
|
$tag->set_tag_attribute("fill", $fill); |
87 |
|
|
} |
88 |
|
|
if ($stroke) { |
89 |
|
|
$tag->set_tag_attribute("stroke", $stroke); |
90 |
|
|
} |
91 |
|
|
if ($strokewidth) { |
92 |
|
|
$tag->set_tag_attribute("stroke-width", $strokewidth); |
93 |
|
|
} |
94 |
|
|
if ($style) { |
95 |
|
|
$tag->set_style($style); |
96 |
|
|
} |
97 |
|
|
return $tag; |
98 |
|
|
} |
99 |
|
|
|
100 |
jonen |
1.3 |
/** |
101 |
|
|
* This function is used for building an |
102 |
|
|
* SVG <defs> tag |
103 |
|
|
* |
104 |
|
|
* @param mixed - any N number of params for |
105 |
|
|
* content for the tag |
106 |
|
|
* @return DESCsvgtag object |
107 |
|
|
*/ |
108 |
|
|
function svg_defs() { |
109 |
|
|
$tag = new DEFSsvgtag; |
110 |
|
|
$args = func_get_args(); |
111 |
|
|
call_user_func_array( array(&$tag, "add"), $args); |
112 |
|
|
return $tag; |
113 |
|
|
} |
114 |
jonen |
1.1 |
|
115 |
|
|
/** |
116 |
|
|
* This function is used for building an |
117 |
|
|
* SVG <desc> tag |
118 |
|
|
* |
119 |
|
|
* @param mixed - any N number of params for |
120 |
|
|
* content for the tag |
121 |
|
|
* @return DESCsvgtag object |
122 |
|
|
*/ |
123 |
|
|
function svg_desc() { |
124 |
|
|
$tag = new DESCsvgtag; |
125 |
|
|
$args = func_get_args(); |
126 |
|
|
call_user_func_array( array(&$tag, "add"), $args); |
127 |
|
|
return $tag; |
128 |
|
|
} |
129 |
|
|
|
130 |
|
|
/** |
131 |
|
|
* This function is used to build an |
132 |
|
|
* SVG <ellipse> tag and its common |
133 |
|
|
* attributes |
134 |
|
|
* |
135 |
|
|
* @param int - the 'cx' attribute. The x-axis |
136 |
|
|
* coordinate of the center of the circle |
137 |
|
|
* @param int - the 'cy' attribute. The y-axis |
138 |
|
|
* coordinate of the center of the circle |
139 |
|
|
* @param int - the 'rx' attribute. The x-axis radius of |
140 |
|
|
* the ellipse. |
141 |
|
|
* @param int - the 'ry' attribute. The y-axis radius of |
142 |
|
|
* the ellipse. |
143 |
|
|
* @param string - the 'fill' attribute |
144 |
|
|
* @param string - the 'stroke' attribute |
145 |
|
|
* @param string - the 'stroke-width' attribute |
146 |
|
|
* @param string - the 'style' attribyte |
147 |
|
|
* @return ELLIPSEsvgtag object |
148 |
|
|
* @link http://www.w3.org/TR/SVG/shapes.html |
149 |
|
|
*/ |
150 |
|
|
function svg_ellipse($cx, $cy, $rx, $ry, $fill="none", |
151 |
|
|
$stroke=NULL, $strokewidth, $style=NULL) { |
152 |
|
|
$tag = new ELLIPSEsvgtag( array("cx" => $cx, "cy" => $cy, |
153 |
|
|
"rx" => $rx, "ry" => $ry)); |
154 |
|
|
if ($fill) { |
155 |
|
|
$tag->set_tag_attribute("fill", $fill); |
156 |
|
|
} |
157 |
|
|
if ($stroke) { |
158 |
|
|
$tag->set_tag_attribute("stroke", $stroke); |
159 |
|
|
} |
160 |
|
|
if ($strokewidth) { |
161 |
|
|
$tag->set_tag_attribute("stroke-width", $strokewidth); |
162 |
|
|
} |
163 |
|
|
if ($style) { |
164 |
|
|
$tag->set_style($style); |
165 |
|
|
} |
166 |
|
|
return $tag; |
167 |
|
|
} |
168 |
|
|
|
169 |
|
|
/** |
170 |
|
|
* this function builds an SVG |
171 |
|
|
* <font> tag |
172 |
|
|
* |
173 |
|
|
* @param string - the required 'horiz-adv-x' attribute |
174 |
|
|
* @return FONTsvgtag object |
175 |
|
|
*/ |
176 |
|
|
function svg_font( $horizadvx ) { |
177 |
|
|
$tag = new FONTsvgtag( array("horiz-adv-x" => |
178 |
|
|
$horizadvx)); |
179 |
|
|
$num_args = func_num_args(); |
180 |
|
|
for ($i=1;$i<$num_args;$i++) { |
181 |
|
|
$tag->add(func_get_arg($i)); |
182 |
|
|
} |
183 |
|
|
return $tag; |
184 |
|
|
} |
185 |
|
|
|
186 |
|
|
/** |
187 |
|
|
* This function builds an SVG |
188 |
|
|
* <g> tag |
189 |
|
|
* |
190 |
|
|
* @param string - the 'style' attribute |
191 |
|
|
* @param string - the 'transform' attribute |
192 |
|
|
* @return Gsvgtag object |
193 |
|
|
*/ |
194 |
|
|
function svg_g($style=NULL, $transform=NULL) { |
195 |
|
|
$tag = new Gsvgtag; |
196 |
|
|
if ($style) { |
197 |
|
|
$tag->set_style($style); |
198 |
|
|
} |
199 |
|
|
|
200 |
|
|
if ($transform) { |
201 |
|
|
$tag->set_transform( $transform ); |
202 |
|
|
} |
203 |
|
|
|
204 |
|
|
return $tag; |
205 |
|
|
} |
206 |
|
|
|
207 |
|
|
|
208 |
|
|
/** |
209 |
|
|
* This function is used for building an |
210 |
|
|
* SVG <line> tag |
211 |
|
|
* |
212 |
|
|
* @param int - the 'x1' attribute |
213 |
|
|
* @param int - the 'y1' attribute |
214 |
|
|
* @param int - the 'x2' attribute |
215 |
|
|
* @param int - the 'y2' attribute |
216 |
|
|
* @param string - the 'stroke' attribute |
217 |
|
|
* @param string - the 'stroke-width' attribute |
218 |
|
|
* @param string - the 'style' attribute |
219 |
|
|
* @return LINEsvgtag object |
220 |
|
|
* @link http://www.w3.org/TR/SVG/shapes.html |
221 |
|
|
*/ |
222 |
|
|
function svg_line($x1, $y1, $x2, $y2, $stroke=NULL, |
223 |
|
|
$strokewidth, $style=NULL) { |
224 |
|
|
$tag = new LINEsvgtag(array("x1" => $x1, "y1" => $y1, |
225 |
|
|
"x2" => $x2, "y2" => $y2)); |
226 |
|
|
if ($stroke) { |
227 |
|
|
$tag->set_tag_attribute("stroke", $stroke); |
228 |
|
|
} |
229 |
|
|
if ($strokewidth) { |
230 |
|
|
$tag->set_tag_attribute("stroke-width", $strokewidth); |
231 |
|
|
} |
232 |
|
|
if ($style) { |
233 |
|
|
$tag->set_style( $style ); |
234 |
|
|
} |
235 |
|
|
|
236 |
|
|
return $tag; |
237 |
|
|
} |
238 |
|
|
|
239 |
|
|
/** |
240 |
|
|
* This function is used for building an |
241 |
|
|
* SVG <marker> tag |
242 |
|
|
* |
243 |
|
|
* @param string - the 'refX' attribute |
244 |
|
|
* @param string - the 'refY' attribute |
245 |
|
|
* @param string - the 'markerUnits' attribute |
246 |
|
|
* @param string - the 'markerWidth' attribute |
247 |
|
|
* @param string - the 'markerHeight' attribute |
248 |
|
|
* @param string - the 'orient' attribute |
249 |
|
|
* @return MARKERsvgtag object |
250 |
|
|
* @link http://www.w3.org/TR/SVG/painting.html#MarkerElement |
251 |
|
|
*/ |
252 |
|
|
function svg_marker($refx, $refY, $markerunits=NULL, |
253 |
|
|
$markerwidth=NULL, $markerheight=NULL, |
254 |
|
|
$orient=NULL) { |
255 |
|
|
$tag = new MARKERsvgtag( array("refx" => $refx, |
256 |
|
|
"refy" => $refy)); |
257 |
|
|
|
258 |
|
|
if ($markerunits) { |
259 |
|
|
$this->set_tag_attribute("markerUnits", $markerunits ); |
260 |
|
|
} |
261 |
|
|
if ($markerwidth) { |
262 |
|
|
$this->set_tag_attribute("markerWidth", $markerwidth ); |
263 |
|
|
} |
264 |
|
|
if ($markerheight) { |
265 |
|
|
$this->set_tag_attribute("markerHeight", $markerheight ); |
266 |
|
|
} |
267 |
|
|
if ($orient) { |
268 |
|
|
$this->set_tag_attribute("orient", $orient ); |
269 |
|
|
} |
270 |
|
|
|
271 |
|
|
return $tag; |
272 |
|
|
} |
273 |
|
|
|
274 |
|
|
/** |
275 |
|
|
* This function is used for building an |
276 |
|
|
* SVG <polygon> tag |
277 |
|
|
* |
278 |
|
|
* @param int - the 'points' attribute |
279 |
|
|
* @param string - the 'fill' attribute |
280 |
|
|
* @param string - the 'stroke' attribute |
281 |
|
|
* @param string - the 'stroke-width' attribute |
282 |
|
|
* @param string - the 'style' attribute |
283 |
|
|
* @return POLYGONsvgtag object |
284 |
|
|
* @link http://www.w3.org/TR/SVG/shapes.html |
285 |
|
|
*/ |
286 |
|
|
function svg_polygon($points, $fill="none", $stroke=NULL, |
287 |
|
|
$strokewidth, $style=NULL) { |
288 |
|
|
$tag = new POLYGONsvgtag; |
289 |
|
|
|
290 |
|
|
if ($fill) { |
291 |
|
|
$tag->set_tag_attribute("fill", $fill); |
292 |
|
|
} |
293 |
|
|
if ($stroke) { |
294 |
|
|
$tag->set_tag_attribute("stroke", $stroke); |
295 |
|
|
} |
296 |
|
|
if ($strokewidth) { |
297 |
|
|
$tag->set_tag_attribute("stroke-width", $strokewidth); |
298 |
|
|
} |
299 |
|
|
if ($style) { |
300 |
|
|
$tag->set_style( $style ); |
301 |
|
|
} |
302 |
|
|
|
303 |
|
|
//do this instead of the constructor |
304 |
|
|
//because the output is easier to read. |
305 |
|
|
$tag->set_tag_attribute("points", $points); |
306 |
|
|
|
307 |
|
|
return $tag; |
308 |
|
|
} |
309 |
|
|
|
310 |
|
|
/** |
311 |
|
|
* This function is used for building an |
312 |
|
|
* SVG <polyline> tag |
313 |
|
|
* |
314 |
|
|
* @param int - the 'points' attribute |
315 |
|
|
* @param string - the 'fill' attribute |
316 |
|
|
* @param string - the 'stroke' attribute |
317 |
|
|
* @param string - the 'stroke-width' attribute |
318 |
|
|
* @param string - the 'style' attribute |
319 |
|
|
* @return POLYLINEsvgtag object |
320 |
|
|
* @link http://www.w3.org/TR/SVG/shapes.html |
321 |
|
|
*/ |
322 |
|
|
function svg_polyline($points, $fill="none", $stroke=NULL, |
323 |
|
|
$strokewidth, $style=NULL) { |
324 |
|
|
$tag = new POLYLINEsvgtag; |
325 |
|
|
|
326 |
|
|
if ($fill) { |
327 |
|
|
$tag->set_tag_attribute("fill", $fill); |
328 |
|
|
} |
329 |
|
|
if ($stroke) { |
330 |
|
|
$tag->set_tag_attribute("stroke", $stroke); |
331 |
|
|
} |
332 |
|
|
if ($strokewidth) { |
333 |
|
|
$tag->set_tag_attribute("stroke-width", $strokewidth); |
334 |
|
|
} |
335 |
|
|
if ($style) { |
336 |
|
|
$tag->set_style( $style ); |
337 |
|
|
} |
338 |
|
|
|
339 |
|
|
//do this instead of the constructor |
340 |
|
|
//because the output is easier to read. |
341 |
|
|
$tag->set_tag_attribute("points", $points); |
342 |
|
|
|
343 |
|
|
return $tag; |
344 |
|
|
} |
345 |
|
|
|
346 |
|
|
|
347 |
|
|
/** |
348 |
|
|
* This function creates a <script> |
349 |
|
|
* tag and wraps the javascript in the |
350 |
|
|
* appropriate <![CDATA[ JAVASCRIPT ]]> |
351 |
|
|
* that is required for svg. |
352 |
|
|
* |
353 |
|
|
* @param string the 'type' attribute |
354 |
|
|
* @param mixed - any N number of params for |
355 |
|
|
* content for the tag |
356 |
|
|
* @return SCRIPTsvgtag object |
357 |
|
|
*/ |
358 |
|
|
function svg_script( $type="text/javascript" ) { |
359 |
|
|
$tag = new SCRIPTsvgtag(array("type" => $type)); |
360 |
|
|
$num_args = func_num_args(); |
361 |
|
|
for ($i=1;$i<$num_args;$i++) { |
362 |
|
|
$tag->add(func_get_arg($i)); |
363 |
|
|
} |
364 |
|
|
return $tag; |
365 |
|
|
} |
366 |
|
|
|
367 |
|
|
/** |
368 |
|
|
* This function creates a <script> |
369 |
|
|
* tag and wraps the javascript in the |
370 |
|
|
* appropriate <![CDATA[ JAVASCRIPT ]]> |
371 |
|
|
* that is required for svg. |
372 |
|
|
* |
373 |
|
|
* @param string the 'type' attribute |
374 |
|
|
* @param mixed - any N number of params for |
375 |
|
|
* content for the tag |
376 |
|
|
* @return SCRIPTsvgtag object |
377 |
|
|
*/ |
378 |
|
|
function svg_style( $type="text/css" ) { |
379 |
|
|
$tag = new STYLEsvgtag(array("type" => $type)); |
380 |
|
|
$num_args = func_num_args(); |
381 |
|
|
for ($i=1;$i<$num_args;$i++) { |
382 |
|
|
$tag->add(func_get_arg($i)); |
383 |
|
|
} |
384 |
|
|
return $tag; |
385 |
|
|
} |
386 |
|
|
|
387 |
|
|
|
388 |
|
|
/** |
389 |
|
|
* This function is used to build an |
390 |
|
|
* SVG <rect> tag and its common |
391 |
|
|
* attributes |
392 |
|
|
* |
393 |
|
|
* @param int - the 'x' attribute |
394 |
|
|
* @param int - the 'y' attribute |
395 |
|
|
* @param string - the 'width' attribute |
396 |
|
|
* @param string - the 'height' attribute |
397 |
|
|
* @param string - the 'fill' attribute |
398 |
|
|
* @param string - the 'stroke' attribute |
399 |
|
|
* @param string - the 'stroke-width' attribyte |
400 |
|
|
* @param string - the 'style' attribyte |
401 |
|
|
* @return RECTsvgtag object |
402 |
|
|
* @link http://www.w3.org/TR/SVG/shapes.html |
403 |
|
|
*/ |
404 |
|
|
function svg_rect($x, $y, $width, $height, $fill=NULL, |
405 |
|
|
$stroke=NULL, $strokewidth=NULL, $style=NULL) { |
406 |
|
|
$tag = new RECTsvgtag( array("x" => $x, "y" => $y, |
407 |
|
|
"width" => $width, |
408 |
|
|
"height" => $height)); |
409 |
|
|
if ($fill) { |
410 |
|
|
$tag->set_tag_attribute("fill", $fill); |
411 |
|
|
} |
412 |
|
|
if ($stroke) { |
413 |
|
|
$tag->set_tag_attribute("stroke", $stroke); |
414 |
|
|
} |
415 |
|
|
if ($strokewidth) { |
416 |
|
|
$tag->set_tag_attribute("stroke-width", $strokewidth); |
417 |
|
|
} |
418 |
|
|
|
419 |
|
|
if ($style) { |
420 |
|
|
$tag->set_style($style); |
421 |
|
|
} |
422 |
|
|
return $tag; |
423 |
|
|
} |
424 |
|
|
|
425 |
|
|
/** |
426 |
|
|
* This function is used to build an |
427 |
|
|
* SVG <text> tag |
428 |
|
|
* |
429 |
|
|
* @param int - the 'x' attribute |
430 |
|
|
* @param int - the 'y' attribute |
431 |
|
|
* @param string - the 'rotate' attribute |
432 |
|
|
* @param style - the 'class' attribute |
433 |
|
|
* @param mixed - any N number of params for |
434 |
|
|
* content for the tag |
435 |
|
|
* @return TEXTsvgtag object. |
436 |
|
|
* @link http://www.w3.org/TR/SVG/text.html |
437 |
|
|
*/ |
438 |
|
|
function svg_text($x, $y, $rotate=NULL, $class=NULL) { |
439 |
|
|
$tag = new TEXTsvgtag( array("x" => $x, "y" => $y)); |
440 |
|
|
if ($rotate) { |
441 |
|
|
$tag->set_tag_attribute( "rotate", $rotate ); |
442 |
|
|
} |
443 |
|
|
if ($class) { |
444 |
|
|
$tag->set_class( $class ); |
445 |
|
|
} |
446 |
|
|
$num_args = func_num_args(); |
447 |
|
|
for ($i=4;$i<$num_args;$i++) { |
448 |
|
|
$tag->add(func_get_arg($i)); |
449 |
|
|
} |
450 |
|
|
return $tag; |
451 |
|
|
} |
452 |
|
|
|
453 |
|
|
/** |
454 |
|
|
* This function is used to build an |
455 |
|
|
* SVG <textpath> tag. |
456 |
|
|
* |
457 |
|
|
* @param string - the 'xlink:href' attribute |
458 |
|
|
* @param string - the 'class' attribute |
459 |
|
|
* @param mixed - any N number of params for |
460 |
|
|
* content for the tag |
461 |
|
|
* @return TEXTPATHsvgtag object. |
462 |
|
|
* @link http://www.w3.org/TR/SVG/text.html#TextPathElement |
463 |
|
|
*/ |
464 |
|
|
function svg_textpath($xlinkhref, $class=NULL) { |
465 |
|
|
$tag = new TEXTPATHsvgtag( array("xlink:href" => $xlinkhref)); |
466 |
|
|
if ($class) { |
467 |
|
|
$tag->set_class( $class ); |
468 |
|
|
} |
469 |
|
|
$num_args = func_num_args(); |
470 |
|
|
for ($i=2;$i<$num_args;$i++) { |
471 |
|
|
$tag->add(func_get_arg($i)); |
472 |
|
|
} |
473 |
|
|
return $tag; |
474 |
|
|
} |
475 |
|
|
|
476 |
|
|
/** |
477 |
|
|
* This function is used to build an |
478 |
|
|
* SVG <tref> tag |
479 |
|
|
* |
480 |
|
|
* @param string - the 'xlink:href' required attribute |
481 |
|
|
* @param string - the 'class' attribute |
482 |
|
|
* @param mixed - any N number of params for |
483 |
|
|
* content for the tag |
484 |
|
|
* @return TREFsvgtag object. |
485 |
|
|
* @link http://www.w3.org/TR/SVG/text.html |
486 |
|
|
*/ |
487 |
|
|
function svg_tref($xlinkhref, $class=NULL) { |
488 |
|
|
$tag = new TREFsvgtag( array("xlink:href" => $xlinkhref)); |
489 |
|
|
if ($class) { |
490 |
|
|
$tag->set_class( $class ); |
491 |
|
|
} |
492 |
|
|
$num_args = func_num_args(); |
493 |
|
|
for ($i=2;$i<$num_args;$i++) { |
494 |
|
|
$tag->add(func_get_arg($i)); |
495 |
|
|
} |
496 |
|
|
return $tag; |
497 |
|
|
} |
498 |
|
|
|
499 |
|
|
/** |
500 |
|
|
* This function is used to build an |
501 |
|
|
* SVG <tref> tag. |
502 |
|
|
* |
503 |
|
|
* @param string - the 'x' attribute |
504 |
|
|
* @param string - the 'y' attribute |
505 |
|
|
* @param string - the 'class' attribute |
506 |
|
|
* @return TSPANsvgtag object. |
507 |
|
|
* @link http://www.w3.org/TR/SVG/text.html |
508 |
|
|
*/ |
509 |
|
|
function svg_tspan($x, $y, $class=NULL) { |
510 |
|
|
$tag = new TSPANsvgtag( array("x" => $x, |
511 |
|
|
"y" => $y)); |
512 |
|
|
if ($class) { |
513 |
|
|
$tag->set_class( $class ); |
514 |
|
|
} |
515 |
|
|
return $tag; |
516 |
|
|
} |
517 |
|
|
|
518 |
|
|
|
519 |
|
|
?> |