📄 manual.html
字号:
<head><!-- Generated by perlmod2www.pl --><title>Manual documentation.</title></head><body bgcolor="white"><HR><H4>SVG</H4><H3>Manual</H3><A NAME="TOP"></A><TABLE BORDER="1" WIDTH="100%"><TR><TD><A HREF="#SUMMARY">Summary</A></TD><TD><A HREF="#vardefs">Package variables</A></TD><TD><A HREF="#SYNOPSIS">Synopsis</A></TD><TD><A HREF="#DESCRIPTION">Description</A></TD><TD><A HREF="#General">General documentation</A></TD></TR></TABLE><HR><TABLE BORDER="0" WIDTH="100%" CELLSPACING="0"><TR><TD BGCOLOR="#ffae84"><B>Summary</B></TD></TR></TABLE><TABLE BORDER="0" WIDTH="100%"><TR><TD><pre>SVG - Perl extension for generating Scalable Vector Graphics (SVG) documents<BR></pre></TD></TR></TABLE><A NAME="vardefs"></A><TABLE BORDER="0" WIDTH="100%" CELLSPACING="0"><TR BGCOLOR="#ffae84"><TD><B>Package variables</B></TD><TD ALIGN="RIGHT"><A HREF="#TOP">top</A></TD></TR></TABLE><TABLE BORDER="0" WIDTH="100%"><TR><TD COLSPAN="2">No package variables defined.</TD></TR></TABLE><A NAME="SYNOPSIS"></A><TABLE BORDER="0" WIDTH="100%" CELLSPACING="0"><TR BGCOLOR="#ffae84"><TD><B>Synopsis</B></TD><TD ALIGN="RIGHT"><A HREF="#TOP">top</A></TD></TR></TABLE><TABLE BORDER="0"><TR><TD COLSPAN="2"><pre> #!/usr/bin/perl -w<BR> use strict;<BR> use SVG;<BR><BR> # create an SVG object<BR> my $svg= SVG->new(width=>200,height=>200);<BR><BR> # use explicit element constructor to generate a group element<BR> my $y=$svg->group(<BR> id => 'group_y',<BR> style => { stroke=>'red', fill=>'green' }<BR> );<BR><BR> # add a circle to the group<BR> $y->circle(cx=>100, cy=>100, r=>50, id=>'circle_in_group_y');<BR><BR> # or, use the generic 'tag' method to generate a group element by name<BR> my $z=$svg->tag('g',<BR> id => 'group_z',<BR> style => {<BR> stroke => 'rgb(100,200,50)',<BR> fill => 'rgb(10,100,150)'<BR> }<BR> );<BR><BR> # create and add a circle using the generic 'tag' method<BR> $z->tag('circle', cx=>50, cy=>50, r=>100, id=>'circle_in_group_z');<BR><BR> # create an anchor on a rectangle within a group within the group z<BR> my $k = $z->anchor(<BR> id => 'anchor_k',<BR> -href => '<a href="http://test.hackmare.com" target="urlWin">http://test.hackmare.com</a>/',<BR> -target => 'new_window_0'<BR> )->rectangle(<BR> x => 20, y => 50,<BR> width => 20, height => 30,<BR> rx => 10, ry => 5,<BR> id => 'rect_k_in_anchor_k_in_group_z'<BR> );<BR><BR> # now render the SVG object, implicitly use svg namespace<BR> print $svg->xmlify;<BR><BR> # or render a child node of the SVG object without rendering the entire object<BR> print $k->xmlify; #renders the anchor $k above containing a rectangle, but does not<BR> #render any of the ancestor nodes of $k<BR><BR> # or, explicitly use svg namespace and generate a document with its own DTD<BR> print $svg->xmlify(-namespace=>'svg');<BR><BR> # or, explicitly use svg namespace and generate an in-line docunent<BR> print $svg->xmlify(<BR> -namespace => "svg",<BR> -pubid => "-//W3C//DTD SVG 1.0//EN",<BR> -inline => 1<BR> );<BR></pre></TD></TR></TABLE><A NAME="DESCRIPTION"></A><TABLE BORDER="0" WIDTH="100%" CELLSPACING="0"><TR BGCOLOR="#ffae84"><TD><B>Description</B></TD><TD ALIGN="RIGHT"><A HREF="#TOP">top</A></TD></TR></TABLE><TABLE BORDER="0"><TR><TD COLSPAN="2"><pre>SVG is a 100% Perl module which generates a nested data structure containing the<BR>DOM representation of an SVG (Scalable Vector Graphics) image. Using SVG, you<BR>can generate SVG objects, embed other SVG instances into it, access the DOM<BR>object, create and access javascript, and generate SMIL animation content.<BR></pre><pre>Generating SVG is a simple three step process:<BR><BR><BR><A NAME="_pod_1 The first step is to construct a new SVG object with L<"new">."> 1 The first step is to construct a new SVG object with L<"new">.</A><BR><A NAME="_pod_"> </A><BR><A NAME="_pod_"> </A><BR><BR>The <a href="#_pod_"xmlify"">"xmlify"</a> method takes a number of optional arguments that control how SVG<BR>renders the object into XML, and in particular determine whether a stand-alone<BR>SVG document or an inline SVG document fragment is generated:<BR><BR><BR><A NAME="_pod_-stand-alone"> -stand-alone</A><BR> A complete SVG document with its own associated DTD. A namespace for the SVG<BR>elements may be optionally specified.<BR><BR><A NAME="_pod_-in-line"> -in-line</A><BR> An in-line SVG document fragment with no DTD that be embedded within other XML<BR>content. As with stand-alone documents, an alternate namespace may be specified.<BR><BR><BR>No XML content is generated until the third step is reached. Up until this<BR>point, all constructed element definitions reside in a DOM-like data structure<BR>from which they can be accessed and modified.<BR></pre><pre>None. However, SVG permits both options and additional element methods to be<BR>specified in the import list. These options and elements are then available<BR>for all SVG instances that are created with the <a href="#_pod_"new"">"new"</a> constructor. For example,<BR>to change the indent string to two spaces per level:<BR><BR> use SVG qw(-indent => " ");<BR><BR>With the exception of -auto, all options may also be specified to the <a href="#_pod_"new"">"new"</a><BR>constructor. The currently supported options are:<BR><BR> -auto enable autoloading of all unrecognised method calls (0)<BR> -indent the indent to use when rendering the SVG into XML ("\t")<BR> -inline whether the SVG is to be standalone or inlined (0)<BR> -printerror print SVG generation errors to standard error (1)<BR> -raiseerror die if a generation error is encountered (1)<BR> -nostub only return the handle to a blank SVG document without any elements<BR><BR>SVG also allows additional element generation methods to be specified in the<BR>import list. For example to generate 'star' and 'planet' element methods:<BR><BR> use SVG qw(star planet);<BR><BR>or:<BR><BR> use SVG ("star","planet");<BR><BR>This will add 'star' to the list of elements supported by SVG.pm (but not of<BR>course other SVG parsers...). Alternatively the '-auto' option will allow<BR>any unknown method call to generate an element of the same name:<BR><BR> use SVG (-auto => 1, "star", "planet");<BR><BR>Any elements specified explicitly (as 'star' and 'planet' are here) are<BR>predeclared; other elements are defined as and when they are seen by Perl. Note<BR>that enabling '-auto' effectively disables compile-time syntax checking for<BR>valid method names.<BR><BR><b>Example:</b><BR><BR> use SVG (<BR> -auto => 0,<BR> -indent => " ",<BR> -raiserror => 0,<BR> -printerror => 1,<BR> "star", "planet", "moon"<BR> );<BR></pre></TD></TR></TABLE><A NAME="MethDesc"></A><HR><H2>Methods description</H2><FONT COLOR="RED"><B>None available.</B></FONT><BR><A NAME="MethCode"></A><HR><H2>Methods code</H2><FONT COLOR="RED"><B>No methods available.</B></FONT><BR><A NAME="General"></A><HR><H2>General documentation</H2><TABLE BORDER="0" WIDTH="100%" CELLSPACING="0"><TR BGCOLOR="#4492df"><TD><A NAME="_pod_VERSION"><B>VERSION</A></B></TD><TD><A HREF="#TOP">top</A></TD></TR><TR><TD COLSPAN="2"><pre>Version 2.24 (29.01.03)<BR>Covers SVG-2.27 distribution<BR></pre></TD></TR><TR BGCOLOR="#4492df"><TD><A NAME="_pod_SEE ALSO(1)"><B>SEE ALSO(1)</A></B></TD><TD><A HREF="#TOP">top</A></TD></TR><TR><TD COLSPAN="2"><pre> perl(1), <a href="http://roasp.com" target="urlWin">http://roasp.com</a>VG::Element>, <a href="http://roasp.com" target="urlWin">http://roasp.com</a>VG::Parser><BR> <a href="http://roasp.com" target="urlWin">http://roasp.com</a>/<BR> <a href="http://www.w3c.org/Graphics/SVG" target="urlWin">http://www.w3c.org/Graphics/SVG</a>/<BR></pre></TD></TR><TR BGCOLOR="#4492df"><TD><A NAME="_pod_AUTHOR"><B>AUTHOR</A></B></TD><TD><A HREF="#TOP">top</A></TD></TR><TR><TD COLSPAN="2"><pre>Ronan Oger, RO IT Systemms GmbH, <a href="mailto:ronan@roasp.com">ronan@roasp.com</a><BR></pre></TD></TR><TR BGCOLOR="#4492df"><TD><A NAME="_pod_CREDITS"><B>CREDITS</A></B></TD><TD><A HREF="#TOP">top</A></TD></TR><TR><TD COLSPAN="2"><pre>Peter Wainwright, <a href="mailto:peter@roasp.com">peter@roasp.com</a> Excellent ideas, beta-testing, SVG::Parser<BR>Fredo, <a href="http://www.penguin.at0.net/~fredo" target="urlWin">http://www.penguin.at0.net/~fredo</a>/ - provided initial feedback<BR>for early SVG.pm versions<BR>Adam Schneider, improvements to xmlescp providing improved character support<BR>Brial Pilpr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -