| 1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
| 2 | .\" |
| 3 | .\" Standard preamble: |
| 4 | .\" ======================================================================== |
| 5 | .de Sh \" Subsection heading |
| 6 | .br |
| 7 | .if t .Sp |
| 8 | .ne 5 |
| 9 | .PP |
| 10 | \fB\\$1\fR |
| 11 | .PP |
| 12 | .. |
| 13 | .de Sp \" Vertical space (when we can't use .PP) |
| 14 | .if t .sp .5v |
| 15 | .if n .sp |
| 16 | .. |
| 17 | .de Vb \" Begin verbatim text |
| 18 | .ft CW |
| 19 | .nf |
| 20 | .ne \\$1 |
| 21 | .. |
| 22 | .de Ve \" End verbatim text |
| 23 | .ft R |
| 24 | .fi |
| 25 | .. |
| 26 | .\" Set up some character translations and predefined strings. \*(-- will |
| 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 28 | .\" double quote, and \*(R" will give a right double quote. | will give a |
| 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
| 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
| 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. |
| 32 | .tr \(*W-|\(bv\*(Tr |
| 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 34 | .ie n \{\ |
| 35 | . ds -- \(*W- |
| 36 | . ds PI pi |
| 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 39 | . ds L" "" |
| 40 | . ds R" "" |
| 41 | . ds C` "" |
| 42 | . ds C' "" |
| 43 | 'br\} |
| 44 | .el\{\ |
| 45 | . ds -- \|\(em\| |
| 46 | . ds PI \(*p |
| 47 | . ds L" `` |
| 48 | . ds R" '' |
| 49 | 'br\} |
| 50 | .\" |
| 51 | .\" If the F register is turned on, we'll generate index entries on stderr for |
| 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
| 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
| 54 | .\" output yourself in some meaningful fashion. |
| 55 | .if \nF \{\ |
| 56 | . de IX |
| 57 | . tm Index:\\$1\t\\n%\t"\\$2" |
| 58 | .. |
| 59 | . nr % 0 |
| 60 | . rr F |
| 61 | .\} |
| 62 | .\" |
| 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 64 | .\" way too many mistakes in technical documents. |
| 65 | .hy 0 |
| 66 | .if n .na |
| 67 | .\" |
| 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
| 70 | . \" fudge factors for nroff and troff |
| 71 | .if n \{\ |
| 72 | . ds #H 0 |
| 73 | . ds #V .8m |
| 74 | . ds #F .3m |
| 75 | . ds #[ \f1 |
| 76 | . ds #] \fP |
| 77 | .\} |
| 78 | .if t \{\ |
| 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 80 | . ds #V .6m |
| 81 | . ds #F 0 |
| 82 | . ds #[ \& |
| 83 | . ds #] \& |
| 84 | .\} |
| 85 | . \" simple accents for nroff and troff |
| 86 | .if n \{\ |
| 87 | . ds ' \& |
| 88 | . ds ` \& |
| 89 | . ds ^ \& |
| 90 | . ds , \& |
| 91 | . ds ~ ~ |
| 92 | . ds / |
| 93 | .\} |
| 94 | .if t \{\ |
| 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 101 | .\} |
| 102 | . \" troff and (daisy-wheel) nroff accents |
| 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 110 | .ds ae a\h'-(\w'a'u*4/10)'e |
| 111 | .ds Ae A\h'-(\w'A'u*4/10)'E |
| 112 | . \" corrections for vroff |
| 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 115 | . \" for low resolution devices (crt and lpr) |
| 116 | .if \n(.H>23 .if \n(.V>19 \ |
| 117 | \{\ |
| 118 | . ds : e |
| 119 | . ds 8 ss |
| 120 | . ds o a |
| 121 | . ds d- d\h'-1'\(ga |
| 122 | . ds D- D\h'-1'\(hy |
| 123 | . ds th \o'bp' |
| 124 | . ds Th \o'LP' |
| 125 | . ds ae ae |
| 126 | . ds Ae AE |
| 127 | .\} |
| 128 | .rm #[ #] #H #V #F C |
| 129 | .\" ======================================================================== |
| 130 | .\" |
| 131 | .IX Title "SVG::Element 3" |
| 132 | .TH SVG::Element 3 "2003-11-02" "perl v5.8.0" "User Contributed Perl Documentation" |
| 133 | .SH "NAME" |
| 134 | SVG::Element \- Generate the element bits for SVG.pm |
| 135 | .SH "AUTHOR" |
| 136 | .IX Header "AUTHOR" |
| 137 | Ronan Oger, ronan@roasp.com |
| 138 | .SH "SEE ALSO" |
| 139 | .IX Header "SEE ALSO" |
| 140 | \&\fIperl\fR\|(1),\s-1SVG\s0,\s-1SVG::XML\s0,SVG::Element,SVG::Parser, SVG::Manual |
| 141 | http://www.roasp.com/ |
| 142 | http://www.perlsvg.com/ |
| 143 | http://www.roitsystems.com/ |
| 144 | http://www.w3c.org/Graphics/SVG/ |
| 145 | .Sh "tag (alias: element)" |
| 146 | .IX Subsection "tag (alias: element)" |
| 147 | $tag = \f(CW$SVG\fR\->tag($name, \f(CW%attributes\fR) |
| 148 | .PP |
| 149 | Generic element generator. Creates the element named \f(CW$name\fR with the attributes |
| 150 | specified in \f(CW%attributes\fR. This method is the basis of most of the explicit |
| 151 | element generators. |
| 152 | .PP |
| 153 | \&\fBExample:\fR |
| 154 | .PP |
| 155 | .Vb 1 |
| 156 | \& my $tag = $SVG->tag('g', transform=>'rotate(-45)'); |
| 157 | .Ve |
| 158 | .Sh "anchor" |
| 159 | .IX Subsection "anchor" |
| 160 | $tag = \f(CW$SVG\fR\->anchor(%attributes) |
| 161 | .PP |
| 162 | Generate an anchor element. Anchors are put around objects to make them |
| 163 | \&'live' (i.e. clickable). It therefore requires a drawn object or group element |
| 164 | as a child. |
| 165 | .PP |
| 166 | \&\fBExample:\fR |
| 167 | .PP |
| 168 | .Vb 6 |
| 169 | \& # generate an anchor |
| 170 | \& $tag = $SVG->anchor( |
| 171 | \& -href=>'http://here.com/some/simpler/SVG.SVG' |
| 172 | \& ); |
| 173 | \& # add a circle to the anchor. The circle can be clicked on. |
| 174 | \& $tag->circle(cx=>10,cy=>10,r=>1); |
| 175 | .Ve |
| 176 | .PP |
| 177 | .Vb 5 |
| 178 | \& # more complex anchor with both URL and target |
| 179 | \& $tag = $SVG->anchor( |
| 180 | \& -href => 'http://somewhere.org/some/other/page.html', |
| 181 | \& -target => 'new_window' |
| 182 | \& ); |
| 183 | .Ve |
| 184 | .Sh "circle" |
| 185 | .IX Subsection "circle" |
| 186 | $tag = \f(CW$SVG\fR\->circle(%attributes) |
| 187 | .PP |
| 188 | Draw a circle at (cx,cy) with radius r. |
| 189 | .PP |
| 190 | \&\fBExample:\fR |
| 191 | .PP |
| 192 | .Vb 1 |
| 193 | \& my $tag = $SVG->circlecx=>4, cy=>2, r=>1); |
| 194 | .Ve |
| 195 | .Sh "ellipse" |
| 196 | .IX Subsection "ellipse" |
| 197 | $tag = \f(CW$SVG\fR\->ellipse(%attributes) |
| 198 | .PP |
| 199 | Draw an ellipse at (cx,cy) with radii rx,ry. |
| 200 | .PP |
| 201 | \&\fBExample:\fR |
| 202 | .PP |
| 203 | .Vb 12 |
| 204 | \& my $tag = $SVG->ellipse( |
| 205 | \& cx=>10, cy=>10, |
| 206 | \& rx=>5, ry=>7, |
| 207 | \& id=>'ellipse', |
| 208 | \& style=>{ |
| 209 | \& 'stroke'=>'red', |
| 210 | \& 'fill'=>'green', |
| 211 | \& 'stroke-width'=>'4', |
| 212 | \& 'stroke-opacity'=>'0.5', |
| 213 | \& 'fill-opacity'=>'0.2' |
| 214 | \& } |
| 215 | \& ); |
| 216 | .Ve |
| 217 | .Sh "rectangle (alias: rect)" |
| 218 | .IX Subsection "rectangle (alias: rect)" |
| 219 | $tag = \f(CW$SVG\fR\->rectangle(%attributes) |
| 220 | .PP |
| 221 | Draw a rectangle at (x,y) with width 'width' and height 'height' and side radii |
| 222 | \&'rx' and 'ry'. |
| 223 | .PP |
| 224 | \&\fBExample:\fR |
| 225 | .PP |
| 226 | .Vb 6 |
| 227 | \& $tag = $SVG->rectangle( |
| 228 | \& x=>10, y=>20, |
| 229 | \& width=>4, height=>5, |
| 230 | \& rx=>5.2, ry=>2.4, |
| 231 | \& id=>'rect_1' |
| 232 | \& ); |
| 233 | .Ve |
| 234 | .Sh "image" |
| 235 | .IX Subsection "image" |
| 236 | .Vb 1 |
| 237 | \& $tag = $SVG->image(%attributes) |
| 238 | .Ve |
| 239 | .PP |
| 240 | Draw an image at (x,y) with width 'width' and height 'height' linked to image |
| 241 | resource '\-href'. See also \*(L"use\*(R". |
| 242 | .PP |
| 243 | \&\fBExample:\fR |
| 244 | .PP |
| 245 | .Vb 6 |
| 246 | \& $tag = $SVG->image( |
| 247 | \& x=>100, y=>100, |
| 248 | \& width=>300, height=>200, |
| 249 | \& '-href'=>"image.png", #may also embed SVG, e.g. "image.SVG" |
| 250 | \& id=>'image_1' |
| 251 | \& ); |
| 252 | .Ve |
| 253 | .PP |
| 254 | \&\fBOutput:\fR |
| 255 | .PP |
| 256 | .Vb 1 |
| 257 | \& <image xlink:href="image.png" x="100" y="100" width="300" height="200"/> |
| 258 | .Ve |
| 259 | .Sh "use" |
| 260 | .IX Subsection "use" |
| 261 | $tag = \f(CW$SVG\fR\->use(%attributes) |
| 262 | .PP |
| 263 | Retrieve the content from an entity within an \s-1SVG\s0 document and apply it at |
| 264 | (x,y) with width 'width' and height 'height' linked to image resource '\-href'. |
| 265 | .PP |
| 266 | \&\fBExample:\fR |
| 267 | .PP |
| 268 | .Vb 6 |
| 269 | \& $tag = $SVG->use( |
| 270 | \& x=>100, y=>100, |
| 271 | \& width=>300, height=>200, |
| 272 | \& '-href'=>"pic.SVG#image_1", |
| 273 | \& id=>'image_1' |
| 274 | \& ); |
| 275 | .Ve |
| 276 | .PP |
| 277 | \&\fBOutput:\fR |
| 278 | .PP |
| 279 | .Vb 1 |
| 280 | \& <use xlink:href="pic.SVG#image_1" x="100" y="100" width="300" height="200"/> |
| 281 | .Ve |
| 282 | .PP |
| 283 | According to the \s-1SVG\s0 specification, the 'use' element in \s-1SVG\s0 can point to a |
| 284 | single element within an external \s-1SVG\s0 file. |
| 285 | .Sh "polygon" |
| 286 | .IX Subsection "polygon" |
| 287 | $tag = \f(CW$SVG\fR\->polygon(%attributes) |
| 288 | .PP |
| 289 | Draw an n\-sided polygon with vertices at points defined by a string of the form |
| 290 | \&'x1,y1,x2,y2,x3,y3,... xy,yn'. The \*(L"get_path\*(R" method is provided as a |
| 291 | convenience to generate a suitable string from coordinate data. |
| 292 | .PP |
| 293 | \&\fBExample:\fR |
| 294 | .PP |
| 295 | .Vb 3 |
| 296 | \& # a five-sided polygon |
| 297 | \& my $xv = [0,2,4,5,1]; |
| 298 | \& my $yv = [0,0,2,7,5]; |
| 299 | .Ve |
| 300 | .PP |
| 301 | .Vb 4 |
| 302 | \& $points = $a->get_path( |
| 303 | \& x=>$xv, y=>$yv, |
| 304 | \& -type=>'polygon' |
| 305 | \& ); |
| 306 | .Ve |
| 307 | .PP |
| 308 | .Vb 5 |
| 309 | \& $c = $a->polygon( |
| 310 | \& %$points, |
| 311 | \& id=>'pgon1', |
| 312 | \& style=>\e%polygon_style |
| 313 | \& ); |
| 314 | .Ve |
| 315 | .PP |
| 316 | \&\s-1SEE\s0 \s-1ALSO:\s0 |
| 317 | .PP |
| 318 | \&\*(L"polyline\*(R", \*(L"path\*(R", \*(L"get_path\*(R". |
| 319 | .Sh "polyline" |
| 320 | .IX Subsection "polyline" |
| 321 | $tag = \f(CW$SVG\fR\->polyline(%attributes) |
| 322 | .PP |
| 323 | Draw an n\-point polyline with points defined by a string of the form |
| 324 | \&'x1,y1,x2,y2,x3,y3,... xy,yn'. The \*(L"get_path\*(R" method is provided as a |
| 325 | convenience to generate a suitable string from coordinate data. |
| 326 | .PP |
| 327 | \&\fBExample:\fR |
| 328 | .PP |
| 329 | .Vb 3 |
| 330 | \& # a 10-pointsaw-tooth pattern |
| 331 | \& my $xv = [0,1,2,3,4,5,6,7,8,9]; |
| 332 | \& my $yv = [0,1,0,1,0,1,0,1,0,1]; |
| 333 | .Ve |
| 334 | .PP |
| 335 | .Vb 5 |
| 336 | \& $points = $a->get_path( |
| 337 | \& x=>$xv, y=>$yv, |
| 338 | \& -type=>'polyline', |
| 339 | \& -closed=>'true' #specify that the polyline is closed. |
| 340 | \& ); |
| 341 | .Ve |
| 342 | .PP |
| 343 | .Vb 8 |
| 344 | \& my $tag = $a->polyline ( |
| 345 | \& %$points, |
| 346 | \& id=>'pline_1', |
| 347 | \& style=>{ |
| 348 | \& 'fill-opacity'=>0, |
| 349 | \& 'stroke-color'=>'rgb(250,123,23)' |
| 350 | \& } |
| 351 | \& ); |
| 352 | .Ve |
| 353 | .Sh "line" |
| 354 | .IX Subsection "line" |
| 355 | $tag = \f(CW$SVG\fR\->line(%attributes) |
| 356 | .PP |
| 357 | Draw a straight line between two points (x1,y1) and (x2,y2). |
| 358 | .PP |
| 359 | \&\fBExample:\fR |
| 360 | .PP |
| 361 | .Vb 5 |
| 362 | \& my $tag = $SVG->line( |
| 363 | \& id=>'l1', |
| 364 | \& x1=>0, y1=>10, |
| 365 | \& x2=>10, y2=>0 |
| 366 | \& ); |
| 367 | .Ve |
| 368 | .PP |
| 369 | To draw multiple connected lines, use \*(L"polyline\*(R". |
| 370 | .Sh "text" |
| 371 | .IX Subsection "text" |
| 372 | $text = \f(CW$SVG\fR\->text(%attributes)\->\fIcdata()\fR; |
| 373 | .PP |
| 374 | $text_path = \f(CW$SVG\fR\->text(\-type=>'path'); |
| 375 | \&\f(CW$text_span\fR = \f(CW$text_path\fR\->text(\-type=>'span')\->cdata('A'); |
| 376 | \&\f(CW$text_span\fR = \f(CW$text_path\fR\->text(\-type=>'span')\->cdata('B'); |
| 377 | \&\f(CW$text_span\fR = \f(CW$text_path\fR\->text(\-type=>'span')\->cdata('C'); |
| 378 | .PP |
| 379 | define the container for a text string to be drawn in the image. |
| 380 | .PP |
| 381 | \&\fBInput:\fR |
| 382 | \-type = path type (path | polyline | polygon) |
| 383 | \-type = text element type (path | span | normal [default]) |
| 384 | .PP |
| 385 | \&\fBExample:\fR |
| 386 | .PP |
| 387 | .Vb 3 |
| 388 | \& my $text1 = $SVG->text( |
| 389 | \& id=>'l1', x=>10, y=>10 |
| 390 | \& )->cdata('hello, world'); |
| 391 | .Ve |
| 392 | .PP |
| 393 | .Vb 2 |
| 394 | \& my $text2 = $SVG->text( |
| 395 | \& id=>'l1', x=>10, y=>10, -cdata=>'hello, world'); |
| 396 | .Ve |
| 397 | .PP |
| 398 | .Vb 4 |
| 399 | \& my $text = $SVG->text( |
| 400 | \& id=>'tp', x=>10, y=>10 -type=>path) |
| 401 | \& ->text(id=>'ts' -type=>'span') |
| 402 | \& ->cdata('hello, world'); |
| 403 | .Ve |
| 404 | .PP |
| 405 | \&\s-1SEE\s0 \s-1ALSO:\s0 |
| 406 | .PP |
| 407 | .Vb 1 |
| 408 | \& L<"desc">, L<"cdata">. |
| 409 | .Ve |
| 410 | .Sh "title" |
| 411 | .IX Subsection "title" |
| 412 | $tag = \f(CW$SVG\fR\->title(%attributes) |
| 413 | .PP |
| 414 | Generate the title of the image. |
| 415 | .PP |
| 416 | \&\fBExample:\fR |
| 417 | .PP |
| 418 | .Vb 1 |
| 419 | \& my $tag = $SVG->title(id=>'document-title')->cdata('This is the title'); |
| 420 | .Ve |
| 421 | .Sh "desc" |
| 422 | .IX Subsection "desc" |
| 423 | $tag = \f(CW$SVG\fR\->desc(%attributes) |
| 424 | .PP |
| 425 | Generate the description of the image. |
| 426 | .PP |
| 427 | \&\fBExample:\fR |
| 428 | .PP |
| 429 | .Vb 1 |
| 430 | \& my $tag = $SVG->desc(id=>'document-desc')->cdata('This is a description'); |
| 431 | .Ve |
| 432 | .Sh "comment" |
| 433 | .IX Subsection "comment" |
| 434 | $tag = \f(CW$SVG\fR\->comment(@comments) |
| 435 | .PP |
| 436 | Generate the description of the image. |
| 437 | .PP |
| 438 | \&\fBExample:\fR |
| 439 | .PP |
| 440 | .Vb 1 |
| 441 | \& my $tag = $SVG->comment('comment 1','comment 2','comment 3'); |
| 442 | .Ve |
| 443 | .PP |
| 444 | $tag = \f(CW$SVG\fR\->pi(@pi) |
| 445 | .PP |
| 446 | Generate a set of processing instructions |
| 447 | .PP |
| 448 | \&\fBExample:\fR |
| 449 | .PP |
| 450 | .Vb 1 |
| 451 | \& my $tag = $SVG->pi('instruction one','instruction two','instruction three'); |
| 452 | .Ve |
| 453 | .PP |
| 454 | .Vb 4 |
| 455 | \& returns: |
| 456 | \& <lt>?instruction one?<gt> |
| 457 | \& <lt>?instruction two?<gt> |
| 458 | \& <lt>?instruction three?<gt> |
| 459 | .Ve |
| 460 | .Sh "script" |
| 461 | .IX Subsection "script" |
| 462 | $tag = \f(CW$SVG\fR\->script(%attributes) |
| 463 | .PP |
| 464 | Generate a script container for dynamic (client\-side) scripting using |
| 465 | ECMAscript, Javascript or other compatible scripting language. |
| 466 | .PP |
| 467 | \&\fBExample:\fR |
| 468 | .PP |
| 469 | .Vb 1 |
| 470 | \& my $tag = $SVG->script(-type=>"text/ecmascript"); |
| 471 | .Ve |
| 472 | .PP |
| 473 | .Vb 4 |
| 474 | \& # populate the script tag with cdata |
| 475 | \& # be careful to manage the javascript line ends. |
| 476 |