Commit | Line | Data |
---|---|---|
86530b38 AT |
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::Manual 3" | |
132 | .TH SVG::Manual 3 "2003-11-02" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | SVG \- Perl extension for generating Scalable Vector Graphics (SVG) documents | |
135 | .Sh "VERSION" | |
136 | .IX Subsection "VERSION" | |
137 | Version 2.24 (29.01.03) | |
138 | Covers SVG\-2.27 distribution | |
139 | .SH "SYNOPSIS" | |
140 | .IX Header "SYNOPSIS" | |
141 | .Vb 3 | |
142 | \& #!/usr/bin/perl -w | |
143 | \& use strict; | |
144 | \& use SVG; | |
145 | .Ve | |
146 | .PP | |
147 | .Vb 2 | |
148 | \& # create an SVG object | |
149 | \& my $svg= SVG->new(width=>200,height=>200); | |
150 | .Ve | |
151 | .PP | |
152 | .Vb 5 | |
153 | \& # use explicit element constructor to generate a group element | |
154 | \& my $y=$svg->group( | |
155 | \& id => 'group_y', | |
156 | \& style => { stroke=>'red', fill=>'green' } | |
157 | \& ); | |
158 | .Ve | |
159 | .PP | |
160 | .Vb 2 | |
161 | \& # add a circle to the group | |
162 | \& $y->circle(cx=>100, cy=>100, r=>50, id=>'circle_in_group_y'); | |
163 | .Ve | |
164 | .PP | |
165 | .Vb 8 | |
166 | \& # or, use the generic 'tag' method to generate a group element by name | |
167 | \& my $z=$svg->tag('g', | |
168 | \& id => 'group_z', | |
169 | \& style => { | |
170 | \& stroke => 'rgb(100,200,50)', | |
171 | \& fill => 'rgb(10,100,150)' | |
172 | \& } | |
173 | \& ); | |
174 | .Ve | |
175 | .PP | |
176 | .Vb 2 | |
177 | \& # create and add a circle using the generic 'tag' method | |
178 | \& $z->tag('circle', cx=>50, cy=>50, r=>100, id=>'circle_in_group_z'); | |
179 | .Ve | |
180 | .PP | |
181 | .Vb 11 | |
182 | \& # create an anchor on a rectangle within a group within the group z | |
183 | \& my $k = $z->anchor( | |
184 | \& id => 'anchor_k', | |
185 | \& -href => 'http://test.hackmare.com/', | |
186 | \& -target => 'new_window_0' | |
187 | \& )->rectangle( | |
188 | \& x => 20, y => 50, | |
189 | \& width => 20, height => 30, | |
190 | \& rx => 10, ry => 5, | |
191 | \& id => 'rect_k_in_anchor_k_in_group_z' | |
192 | \& ); | |
193 | .Ve | |
194 | .PP | |
195 | .Vb 2 | |
196 | \& # now render the SVG object, implicitly use svg namespace | |
197 | \& print $svg->xmlify; | |
198 | .Ve | |
199 | .PP | |
200 | .Vb 3 | |
201 | \& # or render a child node of the SVG object without rendering the entire object | |
202 | \& print $k->xmlify; #renders the anchor $k above containing a rectangle, but does not | |
203 | \& #render any of the ancestor nodes of $k | |
204 | .Ve | |
205 | .PP | |
206 | .Vb 2 | |
207 | \& # or, explicitly use svg namespace and generate a document with its own DTD | |
208 | \& print $svg->xmlify(-namespace=>'svg'); | |
209 | .Ve | |
210 | .PP | |
211 | .Vb 6 | |
212 | \& # or, explicitly use svg namespace and generate an in-line docunent | |
213 | \& print $svg->xmlify( | |
214 | \& -namespace => "svg", | |
215 | \& -pubid => "-//W3C//DTD SVG 1.0//EN", | |
216 | \& -inline => 1 | |
217 | \& ); | |
218 | .Ve | |
219 | .SH "DESCRIPTION" | |
220 | .IX Header "DESCRIPTION" | |
221 | \&\s-1SVG\s0 is a 100% Perl module which generates a nested data structure containing the | |
222 | \&\s-1DOM\s0 representation of an \s-1SVG\s0 (Scalable Vector Graphics) image. Using \s-1SVG\s0, you | |
223 | can generate \s-1SVG\s0 objects, embed other \s-1SVG\s0 instances into it, access the \s-1DOM\s0 | |
224 | object, create and access javascript, and generate \s-1SMIL\s0 animation content. | |
225 | .Sh "General Steps to generating an \s-1SVG\s0 document" | |
226 | .IX Subsection "General Steps to generating an SVG document" | |
227 | Generating \s-1SVG\s0 is a simple three step process: | |
228 | .ie n .IP "1 The first step is to construct a new \s-1SVG\s0 object with ""new""." 4 | |
229 | .el .IP "1 The first step is to construct a new \s-1SVG\s0 object with ``new''." 4 | |
230 | .IX Item "1 The first step is to construct a new SVG object with new." | |
231 | .PD 0 | |
232 | .ie n .IP "2 The second step is to call element constructors to create \s-1SVG\s0 elements. Examples of element constructors are ""circle"" and ""path""." 4 | |
233 | .el .IP "2 The second step is to call element constructors to create \s-1SVG\s0 elements. Examples of element constructors are ``circle'' and ``path''." 4 | |
234 | .IX Item "2 The second step is to call element constructors to create SVG elements. Examples of element constructors are circle and path." | |
235 | .ie n .IP "3 The third and last step is to render the \s-1SVG\s0 object into \s-1XML\s0 using the ""xmlify"" method." 4 | |
236 | .el .IP "3 The third and last step is to render the \s-1SVG\s0 object into \s-1XML\s0 using the ``xmlify'' method." 4 | |
237 | .IX Item "3 The third and last step is to render the SVG object into XML using the xmlify method." | |
238 | .PD | |
239 | .PP | |
240 | The \*(L"xmlify\*(R" method takes a number of optional arguments that control how \s-1SVG\s0 | |
241 | renders the object into \s-1XML\s0, and in particular determine whether a stand-alone | |
242 | \&\s-1SVG\s0 document or an inline \s-1SVG\s0 document fragment is generated: | |
243 | .IP "\-stand\-alone" 4 | |
244 | .IX Item "-stand-alone" | |
245 | A complete \s-1SVG\s0 document with its own associated \s-1DTD\s0. A namespace for the \s-1SVG\s0 | |
246 | elements may be optionally specified. | |
247 | .IP "\-in\-line" 4 | |
248 | .IX Item "-in-line" | |
249 | An in-line \s-1SVG\s0 document fragment with no \s-1DTD\s0 that be embedded within other \s-1XML\s0 | |
250 | content. As with stand-alone documents, an alternate namespace may be specified. | |
251 | .PP | |
252 | No \s-1XML\s0 content is generated until the third step is reached. Up until this | |
253 | point, all constructed element definitions reside in a DOM-like data structure | |
254 | from which they can be accessed and modified. | |
255 | .Sh "\s-1EXPORTS\s0" | |
256 | .IX Subsection "EXPORTS" | |
257 | None. However, \s-1SVG\s0 permits both options and additional element methods to be | |
258 | specified in the import list. These options and elements are then available | |
259 | for all \s-1SVG\s0 instances that are created with the \*(L"new\*(R" constructor. For example, | |
260 | to change the indent string to two spaces per level: | |
261 | .PP | |
262 | .Vb 1 | |
263 | \& use SVG qw(-indent => " "); | |
264 | .Ve | |
265 | .PP | |
266 | With the exception of \-auto, all options may also be specified to the \*(L"new\*(R" | |
267 | constructor. The currently supported options are: | |
268 | .PP | |
269 | .Vb 6 | |
270 | \& -auto enable autoloading of all unrecognised method calls (0) | |
271 | \& -indent the indent to use when rendering the SVG into XML ("\et") | |
272 | \& -inline whether the SVG is to be standalone or inlined (0) | |
273 | \& -printerror print SVG generation errors to standard error (1) | |
274 | \& -raiseerror die if a generation error is encountered (1) | |
275 | \& -nostub only return the handle to a blank SVG document without any elements | |
276 | .Ve | |
277 | .PP | |
278 | \&\s-1SVG\s0 also allows additional element generation methods to be specified in the | |
279 | import list. For example to generate 'star' and 'planet' element methods: | |
280 | .PP | |
281 | .Vb 1 | |
282 | \& use SVG qw(star planet); | |
283 | .Ve | |
284 | .PP | |
285 | or: | |
286 | .PP | |
287 | .Vb 1 | |
288 | \& use SVG ("star","planet"); | |
289 | .Ve | |
290 | .PP | |
291 | This will add 'star' to the list of elements supported by \s-1SVG\s0.pm (but not of | |
292 | course other \s-1SVG\s0 parsers...). Alternatively the '\-auto' option will allow | |
293 | any unknown method call to generate an element of the same name: | |
294 | .PP | |
295 | .Vb 1 | |
296 | \& use SVG (-auto => 1, "star", "planet"); | |
297 | .Ve | |
298 | .PP | |
299 | Any elements specified explicitly (as 'star' and 'planet' are here) are | |
300 | predeclared; other elements are defined as and when they are seen by Perl. Note | |
301 | that enabling '\-auto' effectively disables compile-time syntax checking for | |
302 | valid method names. | |
303 | .PP | |
304 | \&\fBExample:\fR | |
305 | .PP | |
306 | .Vb 7 | |
307 | \& use SVG ( | |
308 | \& -auto => 0, | |
309 | \& -indent => " ", | |
310 | \& -raiserror => 0, | |
311 | \& -printerror => 1, | |
312 | \& "star", "planet", "moon" | |
313 | \& ); | |
314 | .Ve | |
315 | .SH "SEE ALSO" | |
316 | .IX Header "SEE ALSO" | |
317 | .Vb 3 | |
318 | \& perl(1), L<SVG::XML>, L<SVG::Element>, L<SVG::DOM>, L<SVG::Parser> | |
319 | \& http://roasp.com/ | |
320 | \& http://www.w3c.org/Graphics/SVG/ | |
321 | .Ve | |
322 | .SH "AUTHOR" | |
323 | .IX Header "AUTHOR" | |
324 | Ronan Oger, \s-1RO\s0 \s-1IT\s0 Systemms GmbH, ronan@roasp.com | |
325 | .SH "CREDITS" | |
326 | .IX Header "CREDITS" | |
327 | Peter Wainwright, peter@roasp.com Excellent ideas, beta\-testing, SVG::Parser | |
328 | Fredo, http://www.penguin.at0.net/~fredo/ \- provided initial feedback | |
329 | for early \s-1SVG\s0.pm versions | |
330 | Adam Schneider, improvements to xmlescp providing improved character support | |
331 |