Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / SVG::Manual.3
.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SVG::Manual 3"
.TH SVG::Manual 3 "2003-11-02" "perl v5.8.0" "User Contributed Perl Documentation"
.SH "NAME"
SVG \- Perl extension for generating Scalable Vector Graphics (SVG) documents
.Sh "VERSION"
.IX Subsection "VERSION"
Version 2.24 (29.01.03)
Covers SVG\-2.27 distribution
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 3
\& #!/usr/bin/perl -w
\& use strict;
\& use SVG;
.Ve
.PP
.Vb 2
\& # create an SVG object
\& my $svg= SVG->new(width=>200,height=>200);
.Ve
.PP
.Vb 5
\& # use explicit element constructor to generate a group element
\& my $y=$svg->group(
\& id => 'group_y',
\& style => { stroke=>'red', fill=>'green' }
\& );
.Ve
.PP
.Vb 2
\& # add a circle to the group
\& $y->circle(cx=>100, cy=>100, r=>50, id=>'circle_in_group_y');
.Ve
.PP
.Vb 8
\& # or, use the generic 'tag' method to generate a group element by name
\& my $z=$svg->tag('g',
\& id => 'group_z',
\& style => {
\& stroke => 'rgb(100,200,50)',
\& fill => 'rgb(10,100,150)'
\& }
\& );
.Ve
.PP
.Vb 2
\& # create and add a circle using the generic 'tag' method
\& $z->tag('circle', cx=>50, cy=>50, r=>100, id=>'circle_in_group_z');
.Ve
.PP
.Vb 11
\& # create an anchor on a rectangle within a group within the group z
\& my $k = $z->anchor(
\& id => 'anchor_k',
\& -href => 'http://test.hackmare.com/',
\& -target => 'new_window_0'
\& )->rectangle(
\& x => 20, y => 50,
\& width => 20, height => 30,
\& rx => 10, ry => 5,
\& id => 'rect_k_in_anchor_k_in_group_z'
\& );
.Ve
.PP
.Vb 2
\& # now render the SVG object, implicitly use svg namespace
\& print $svg->xmlify;
.Ve
.PP
.Vb 3
\& # or render a child node of the SVG object without rendering the entire object
\& print $k->xmlify; #renders the anchor $k above containing a rectangle, but does not
\& #render any of the ancestor nodes of $k
.Ve
.PP
.Vb 2
\& # or, explicitly use svg namespace and generate a document with its own DTD
\& print $svg->xmlify(-namespace=>'svg');
.Ve
.PP
.Vb 6
\& # or, explicitly use svg namespace and generate an in-line docunent
\& print $svg->xmlify(
\& -namespace => "svg",
\& -pubid => "-//W3C//DTD SVG 1.0//EN",
\& -inline => 1
\& );
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\s-1SVG\s0 is a 100% Perl module which generates a nested data structure containing the
\&\s-1DOM\s0 representation of an \s-1SVG\s0 (Scalable Vector Graphics) image. Using \s-1SVG\s0, you
can generate \s-1SVG\s0 objects, embed other \s-1SVG\s0 instances into it, access the \s-1DOM\s0
object, create and access javascript, and generate \s-1SMIL\s0 animation content.
.Sh "General Steps to generating an \s-1SVG\s0 document"
.IX Subsection "General Steps to generating an SVG document"
Generating \s-1SVG\s0 is a simple three step process:
.ie n .IP "1 The first step is to construct a new \s-1SVG\s0 object with ""new""." 4
.el .IP "1 The first step is to construct a new \s-1SVG\s0 object with ``new''." 4
.IX Item "1 The first step is to construct a new SVG object with new."
.PD 0
.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
.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
.IX Item "2 The second step is to call element constructors to create SVG elements. Examples of element constructors are circle and path."
.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
.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
.IX Item "3 The third and last step is to render the SVG object into XML using the xmlify method."
.PD
.PP
The \*(L"xmlify\*(R" method takes a number of optional arguments that control how \s-1SVG\s0
renders the object into \s-1XML\s0, and in particular determine whether a stand-alone
\&\s-1SVG\s0 document or an inline \s-1SVG\s0 document fragment is generated:
.IP "\-stand\-alone" 4
.IX Item "-stand-alone"
A complete \s-1SVG\s0 document with its own associated \s-1DTD\s0. A namespace for the \s-1SVG\s0
elements may be optionally specified.
.IP "\-in\-line" 4
.IX Item "-in-line"
An in-line \s-1SVG\s0 document fragment with no \s-1DTD\s0 that be embedded within other \s-1XML\s0
content. As with stand-alone documents, an alternate namespace may be specified.
.PP
No \s-1XML\s0 content is generated until the third step is reached. Up until this
point, all constructed element definitions reside in a DOM-like data structure
from which they can be accessed and modified.
.Sh "\s-1EXPORTS\s0"
.IX Subsection "EXPORTS"
None. However, \s-1SVG\s0 permits both options and additional element methods to be
specified in the import list. These options and elements are then available
for all \s-1SVG\s0 instances that are created with the \*(L"new\*(R" constructor. For example,
to change the indent string to two spaces per level:
.PP
.Vb 1
\& use SVG qw(-indent => " ");
.Ve
.PP
With the exception of \-auto, all options may also be specified to the \*(L"new\*(R"
constructor. The currently supported options are:
.PP
.Vb 6
\& -auto enable autoloading of all unrecognised method calls (0)
\& -indent the indent to use when rendering the SVG into XML ("\et")
\& -inline whether the SVG is to be standalone or inlined (0)
\& -printerror print SVG generation errors to standard error (1)
\& -raiseerror die if a generation error is encountered (1)
\& -nostub only return the handle to a blank SVG document without any elements
.Ve
.PP
\&\s-1SVG\s0 also allows additional element generation methods to be specified in the
import list. For example to generate 'star' and 'planet' element methods:
.PP
.Vb 1
\& use SVG qw(star planet);
.Ve
.PP
or:
.PP
.Vb 1
\& use SVG ("star","planet");
.Ve
.PP
This will add 'star' to the list of elements supported by \s-1SVG\s0.pm (but not of
course other \s-1SVG\s0 parsers...). Alternatively the '\-auto' option will allow
any unknown method call to generate an element of the same name:
.PP
.Vb 1
\& use SVG (-auto => 1, "star", "planet");
.Ve
.PP
Any elements specified explicitly (as 'star' and 'planet' are here) are
predeclared; other elements are defined as and when they are seen by Perl. Note
that enabling '\-auto' effectively disables compile-time syntax checking for
valid method names.
.PP
\&\fBExample:\fR
.PP
.Vb 7
\& use SVG (
\& -auto => 0,
\& -indent => " ",
\& -raiserror => 0,
\& -printerror => 1,
\& "star", "planet", "moon"
\& );
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
.Vb 3
\& perl(1), L<SVG::XML>, L<SVG::Element>, L<SVG::DOM>, L<SVG::Parser>
\& http://roasp.com/
\& http://www.w3c.org/Graphics/SVG/
.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Ronan Oger, \s-1RO\s0 \s-1IT\s0 Systemms GmbH, ronan@roasp.com
.SH "CREDITS"
.IX Header "CREDITS"
Peter Wainwright, peter@roasp.com Excellent ideas, beta\-testing, SVG::Parser
Fredo, http://www.penguin.at0.net/~fredo/ \- provided initial feedback
for early \s-1SVG\s0.pm versions
Adam Schneider, improvements to xmlescp providing improved character support
Brial Pilpré, I do not remember.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
http://roasp.com/
.PP
See also the examples directory in this distribution which contain several fully documented examples.
.SH "WINDOWS DISTRIBUTION"
.IX Header "WINDOWS DISTRIBUTION"
http://roasp.com/ppm/
.SH "METHODS"
.IX Header "METHODS"
\&\s-1SVG\s0 provides both explicit and generic element constructor methods. Explicit
generators are generally (with a few exceptions) named for the element they
generate. If a tag method is required for a tag containing hyphens, the method
name replaces the hyphen with an underscore. ie: to generate tag <column\-heading id=\*(L"new\*(R">
you would use method \f(CW$svg\fR\->column_heading(id=>'new').
.PP
All element constructors take a hash of element attributes and options;
element attributes such as 'id' or 'border' are passed by name, while options for the
method (such as the type of an element that supports multiple alternate forms)
are passed preceded by a hyphen, e.g '\-type'. Both types may be freely
intermixed; see the \*(L"fe\*(R" method and code examples througout the documentation
for more examples.
.Sh "new (constructor)"
.IX Subsection "new (constructor)"
$svg = \s-1SVG\-\s0>new(%attributes)
.PP
Creates a new \s-1SVG\s0 object. Attributes of the document \s-1SVG\s0 element be passed as
an optional list of key value pairs. Additionally, \s-1SVG\s0 options (prefixed with
a hyphen) may be set on a per object basis:
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $svg1=new SVG;
.Ve
.PP
.Vb 1
\& my $svg2=new SVG(id => 'document_element');
.Ve
.PP
.Vb 13
\& my $svg3=new SVG(s
\& -printerror => 1,
\& -raiseerror => 0,
\& -indent => ' ',
\& -docroot => 'svg', #default document root element (SVG specification assumes svg). Defaults to 'svg' if undefined
\& -sysid => 'abc', #optional system identifyer
\& -pubid => "-//W3C//DTD SVG 1.0//EN", #public identifyer default value is "-//W3C//DTD SVG 1.0//EN" if undefined
\& -namespace => 'mysvg',
\& -inline => 1
\& id => 'document_element',
\& width => 300,
\& height => 200,
\& );
.Ve
.PP
Default \s-1SVG\s0 options may also be set in the import list. See \*(L"\s-1EXPORTS\s0\*(R" above
for more on the available options.
.PP
Furthermore, the following options:
.PP
.Vb 8
\& -version
\& -encoding
\& -standalone
\& -namespace Defines the document or element level namespace. The order of assignment priority is element,document .
\& -inline
\& -identifier
\& -nostub
\& -dtd (standalone)
.Ve
.PP
may also be set in xmlify, overriding any corresponding values set in the \s-1SVG\-\s0>new declaration
.Sh "xmlify (alias: to_xml render)"
.IX Subsection "xmlify (alias: to_xml render)"
$string = \f(CW$svg\fR\->xmlify(%attributes);
.PP
Returns xml representation of svg document.
.PP
\&\fB\s-1XML\s0 Declaration\fR
.PP
.Vb 8
\& Name Default Value
\& -version '1.0'
\& -encoding 'UTF-8'
\& -standalone 'yes'
\& -namespace 'svg' - namespace for elements
\& -inline '0' - If '1', then this is an inline document.
\& -pubid '-//W3C//DTD SVG 1.0//EN';
\& -dtd (standalone) 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'
.Ve
.Sh "tag (alias: element)"
.IX Subsection "tag (alias: element)"
$tag = \f(CW$svg\fR\->tag($name, \f(CW%attributes\fR)
.PP
Generic element generator. Creates the element named \f(CW$name\fR with the attributes
specified in \f(CW%attributes\fR. This method is the basis of most of the explicit
element generators.
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->tag('g', transform=>'rotate(-45)');
.Ve
.Sh "anchor"
.IX Subsection "anchor"
$tag = \f(CW$svg\fR\->anchor(%attributes)
.PP
Generate an anchor element. Anchors are put around objects to make them
\&'live' (i.e. clickable). It therefore requires a drawn object or group element
as a child.
.PP
\&\fBExample:\fR
.PP
.Vb 6
\& # generate an anchor
\& $tag = $svg->anchor(
\& -href=>'http://here.com/some/simpler/svg.svg'
\& );
\& # add a circle to the anchor. The circle can be clicked on.
\& $tag->circle(cx=>10,cy=>10,r=>1);
.Ve
.PP
.Vb 5
\& # more complex anchor with both URL and target
\& $tag = $svg->anchor(
\& -href => 'http://somewhere.org/some/other/page.html',
\& -target => 'new_window'
\& );
.Ve
.Sh "circle"
.IX Subsection "circle"
$tag = \f(CW$svg\fR\->circle(%attributes)
.PP
Draw a circle at (cx,cy) with radius r.
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->circle(cx=>4, cy=>2, r=>1);
.Ve
.Sh "ellipse"
.IX Subsection "ellipse"
$tag = \f(CW$svg\fR\->ellipse(%attributes)
.PP
Draw an ellipse at (cx,cy) with radii rx,ry.
.PP
\&\fBExample:\fR
.PP
.Vb 12
\& my $tag = $svg->ellipse(
\& cx=>10, cy=>10,
\& rx=>5, ry=>7,
\& id=>'ellipse',
\& style=>{
\& 'stroke'=>'red',
\& 'fill'=>'green',
\& 'stroke-width'=>'4',
\& 'stroke-opacity'=>'0.5',
\& 'fill-opacity'=>'0.2'
\& }
\& );
.Ve
.Sh "rectangle (alias: rect)"
.IX Subsection "rectangle (alias: rect)"
$tag = \f(CW$svg\fR\->rectangle(%attributes)
.PP
Draw a rectangle at (x,y) with width 'width' and height 'height' and side radii
\&'rx' and 'ry'.
.PP
\&\fBExample:\fR
.PP
.Vb 6
\& $tag = $svg->rectangle(
\& x=>10, y=>20,
\& width=>4, height=>5,
\& rx=>5.2, ry=>2.4,
\& id=>'rect_1'
\& );
.Ve
.Sh "image"
.IX Subsection "image"
.Vb 1
\& $tag = $svg->image(%attributes)
.Ve
.PP
Draw an image at (x,y) with width 'width' and height 'height' linked to image
resource '\-href'. See also \*(L"use\*(R".
.PP
\&\fBExample:\fR
.PP
.Vb 6
\& $tag = $svg->image(
\& x=>100, y=>100,
\& width=>300, height=>200,
\& '-href'=>"image.png", #may also embed SVG, e.g. "image.svg"
\& id=>'image_1'
\& );
.Ve
.PP
\&\fBOutput:\fR
.PP
.Vb 1
\& <image xlink:href="image.png" x="100" y="100" width="300" height="200"/>
.Ve
.Sh "use"
.IX Subsection "use"
$tag = \f(CW$svg\fR\->use(%attributes)
.PP
Retrieve the content from an entity within an \s-1SVG\s0 document and apply it at
(x,y) with width 'width' and height 'height' linked to image resource '\-href'.
.PP
\&\fBExample:\fR
.PP
.Vb 6
\& $tag = $svg->use(
\& x=>100, y=>100,
\& width=>300, height=>200,
\& '-href'=>"pic.svg#image_1",
\& id=>'image_1'
\& );
.Ve
.PP
\&\fBOutput:\fR
.PP
.Vb 1
\& <use xlink:href="pic.svg#image_1" x="100" y="100" width="300" height="200"/>
.Ve
.PP
According to the \s-1SVG\s0 specification, the 'use' element in \s-1SVG\s0 can point to a
single element within an external \s-1SVG\s0 file.
.Sh "polygon"
.IX Subsection "polygon"
$tag = \f(CW$svg\fR\->polygon(%attributes)
.PP
Draw an n\-sided polygon with vertices at points defined by a string of the form
\&'x1,y1,x2,y2,x3,y3,... xy,yn'. The \*(L"get_path\*(R" method is provided as a
convenience to generate a suitable string from coordinate data.
.PP
\&\fBExample:\fR
.PP
.Vb 3
\& # a five-sided polygon
\& my $xv = [0,2,4,5,1];
\& my $yv = [0,0,2,7,5];
.Ve
.PP
.Vb 4
\& $points = $a->get_path(
\& x=>$xv, y=>$yv,
\& -type=>'polygon'
\& );
.Ve
.PP
.Vb 5
\& $c = $a->polygon(
\& %$points,
\& id=>'pgon1',
\& style=>\e%polygon_style
\& );
.Ve
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
\&\*(L"polyline\*(R", \*(L"path\*(R", \*(L"get_path\*(R".
.Sh "polyline"
.IX Subsection "polyline"
$tag = \f(CW$svg\fR\->polyline(%attributes)
.PP
Draw an n\-point polyline with points defined by a string of the form
\&'x1,y1,x2,y2,x3,y3,... xy,yn'. The \*(L"get_path\*(R" method is provided as a
convenience to generate a suitable string from coordinate data.
.PP
\&\fBExample:\fR
.PP
.Vb 3
\& # a 10-pointsaw-tooth pattern
\& my $xv = [0,1,2,3,4,5,6,7,8,9];
\& my $yv = [0,1,0,1,0,1,0,1,0,1];
.Ve
.PP
.Vb 5
\& $points = $a->get_path(
\& x=>$xv, y=>$yv,
\& -type=>'polyline',
\& -closed=>'true' #specify that the polyline is closed.
\& );
.Ve
.PP
.Vb 8
\& my $tag = $a->polyline (
\& %$points,
\& id=>'pline_1',
\& style=>{
\& 'fill-opacity'=>0,
\& 'stroke-color'=>'rgb(250,123,23)'
\& }
\& );
.Ve
.Sh "line"
.IX Subsection "line"
$tag = \f(CW$svg\fR\->line(%attributes)
.PP
Draw a straight line between two points (x1,y1) and (x2,y2).
.PP
\&\fBExample:\fR
.PP
.Vb 5
\& my $tag = $svg->line(
\& id=>'l1',
\& x1=>0, y1=>10,
\& x2=>10, y2=>0
\& );
.Ve
.PP
To draw multiple connected lines, use \*(L"polyline\*(R".
.Sh "text"
.IX Subsection "text"
$text = \f(CW$svg\fR\->text(%attributes)\->\fIcdata()\fR;
.PP
$text_path = \f(CW$svg\fR\->text(\-type=>'path');
\&\f(CW$text_span\fR = \f(CW$text_path\fR\->text(\-type=>'span')\->cdata('A');
\&\f(CW$text_span\fR = \f(CW$text_path\fR\->text(\-type=>'span')\->cdata('B');
\&\f(CW$text_span\fR = \f(CW$text_path\fR\->text(\-type=>'span')\->cdata('C');
.PP
define the container for a text string to be drawn in the image.
.PP
\&\fBInput:\fR
\-type = path type (path | polyline | polygon)
\-type = text element type (path | span | normal [default])
.PP
\&\fBExample:\fR
.PP
.Vb 3
\& my $text1 = $svg->text(
\& id=>'l1', x=>10, y=>10
\& )->cdata('hello, world');
.Ve
.PP
.Vb 2
\& my $text2 = $svg->text(
\& id=>'l1', x=>10, y=>10, -cdata=>'hello, world');
.Ve
.PP
.Vb 4
\& my $text = $svg->text(
\& id=>'tp', x=>10, y=>10 -type=>path)
\& ->text(id=>'ts' -type=>'span')
\& ->cdata('hello, world');
.Ve
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
.Vb 1
\& L<"desc">, L<"cdata">.
.Ve
.Sh "title"
.IX Subsection "title"
$tag = \f(CW$svg\fR\->title(%attributes)
.PP
Generate the title of the image.
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->title(id=>'document-title')->cdata('This is the title');
.Ve
.Sh "desc"
.IX Subsection "desc"
$tag = \f(CW$svg\fR\->desc(%attributes)
.PP
Generate the description of the image.
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->desc(id=>'document-desc')->cdata('This is a description');
.Ve
.Sh "comment"
.IX Subsection "comment"
$tag = \f(CW$svg\fR\->comment(@comments)
.PP
Generate the description of the image.
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->comment('comment 1','comment 2','comment 3');
.Ve
.Sh "pi (Processing Instruction)"
.IX Subsection "pi (Processing Instruction)"
$tag = \f(CW$svg\fR\->pi(@pi)
.PP
Generate a set of processing instructions
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->pi('instruction one','instruction two','instruction three');
.Ve
.PP
.Vb 4
\& returns:
\& <lt>?instruction one?<gt>
\& <lt>?instruction two?<gt>
\& <lt>?instruction three?<gt>
.Ve
.Sh "script"
.IX Subsection "script"
$tag = \f(CW$svg\fR\->script(%attributes)
.PP
Generate a script container for dynamic (client\-side) scripting using
ECMAscript, Javascript or other compatible scripting language.
.PP
\&\fBExample:\fR
.PP
.Vb 1
\& my $tag = $svg->script(-type=>"text/ecmascript");
.Ve
.PP
.Vb 4
\& # populate the script tag with cdata
\& # be careful to manage the javascript line ends.
\& # qq|text| or qq§text§ where text is the script
\& # works well for this.
.Ve
.PP
.Vb 7
\& $tag->cdata(qq|function d(){
\& //simple display function
\& for(cnt = 0; cnt < d.length; cnt++)
\& document.write(d[cnt]);//end for loop
\& document.write("<BR>");//write a line break
\& }|
\& );
.Ve
.Sh "path"
.IX Subsection "path"
$tag = \f(CW$svg\fR\->path(%attributes)
.PP
Draw a path element. The path vertices may be imputed as a parameter or
calculated usingthe \*(L"get_path\*(R" method.
.PP
\&\fBExample:\fR
.PP
.Vb 3
\& # a 10-pointsaw-tooth pattern drawn with a path definition
\& my $xv = [0,1,2,3,4,5,6,7,8,9];
\& my $yv = [0,1,0,1,0,1,0,1,0,1];
.Ve
.PP
.Vb 6
\& $points = $a->get_path(
\& x => $xv,
\& y => $yv,
\& -type => 'path',
\& -closed => 'true' #specify that the polyline is closed
\& );
.Ve
.PP
.Vb 9
\& $tag = $svg->path(
\& %$points,
\& id => 'pline_1',
\& style => {
\& 'fill-opacity' => 0,
\& 'fill-color' => 'green',
\& 'stroke-color' => 'rgb(250,123,23)'
\& }
\& );
.Ve
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
\&\*(L"get_path\*(R".
.Sh "get_path"
.IX Subsection "get_path"
$path = \f(CW$svg\fR\->get_path(%attributes)
.PP
Returns the text string of points correctly formatted to be incorporated into
the multi-point \s-1SVG\s0 drawing object definitions (path, polyline, polygon)
.PP
\&\fBInput:\fR attributes including:
.PP
.Vb 3
\& -type = path type (path | polyline | polygon)
\& x = reference to array of x coordinates
\& y = reference to array of y coordinates
.Ve
.PP
\&\fBOutput:\fR a hash reference consisting of the following key-value pair:
.PP
.Vb 4
\& points = the appropriate points-definition string
\& -type = path|polygon|polyline
\& -relative = 1 (define relative position rather than absolute position)
\& -closed = 1 (close the curve - path and polygon only)
.Ve
.PP
\&\fBExample:\fR
.PP
.Vb 3
\& #generate an open path definition for a path.
\& my ($points,$p);
\& $points = $svg->get_path(x=&gt\e@x,y=&gt\e@y,-relative=&gt1,-type=&gt'path');
.Ve
.PP
.Vb 2
\& #add the path to the SVG document
\& my $p = $svg->path(%$path, style=>\e%style_definition);
.Ve
.PP
.Vb 8
\& #generate an closed path definition for a a polyline.
\& $points = $svg->get_path(
\& x=>\e@x,
\& y=>\e@y,
\& -relative=>1,
\& -type=>'polyline',
\& -closed=>1
\& ); # generate a closed path definition for a polyline
.Ve
.PP
.Vb 2
\& # add the polyline to the SVG document
\& $p = $svg->polyline(%$points, id=>'pline1');
.Ve
.PP
\&\fBAliases:\fR get_path set_path
.Sh "animate"
.IX Subsection "animate"
$tag = \f(CW$svg\fR\->animate(%attributes)
.PP
Generate an \s-1SMIL\s0 animation tag. This is allowed within any nonempty tag. Refer\e
to the W3C for detailed information on the subtleties of the animate \s-1SMIL\s0
commands.
.PP
\&\fBInputs:\fR \-method = Transform | Motion | Color
.PP
.Vb 3
\& my $an_ellipse = $svg->ellipse(
\& cx=>30,cy=>150,rx=>10,ry=>10,id=>'an_ellipse',
\& stroke=>'rgb(130,220,70)',fill=>'rgb(30,20,50)');
.Ve
.PP
.Vb 2
\& $an_ellipse-> animate(
\& attributeName=>"cx",values=>"20; 200; 20",dur=>"10s", repeatDur=>'indefinite');
.Ve
.PP
.Vb 3
\& $an_ellipse-> animate(
\& attributeName=>"rx",values=>"10;30;20;100;50",
\& dur=>"10s", repeatDur=>'indefinite');
.Ve
.PP
.Vb 3
\& $an_ellipse-> animate(
\& attributeName=>"ry",values=>"30;50;10;20;70;150",
\& dur=>"15s", repeatDur=>'indefinite');
.Ve
.PP
.Vb 3
\& $an_ellipse-> animate(
\& attributeName=>"rx",values=>"30;75;10;100;20;20;150",
\& dur=>"20s", repeatDur=>'indefinite');
.Ve
.PP
.Vb 3
\& $an_ellipse-> animate(
\& attributeName=>"fill",values=>"red;green;blue;cyan;yellow",
\& dur=>"5s", repeatDur=>'indefinite');
.Ve
.PP
.Vb 3
\& $an_ellipse-> animate(
\& attributeName=>"fill-opacity",values=>"0;1;0.5;0.75;1",
\& dur=>"20s",repeatDur=>'indefinite');
.Ve
.PP
.Vb 3
\& $an_ellipse-> animate(
\& attributeName=>"stroke-width",values=>"1;3;2;10;5",
\& dur=>"20s",repeatDur=>'indefinite');
.Ve
.Sh "group"
.IX Subsection "group"
$tag = \f(CW$svg\fR\->group(%attributes)
.PP
Define a group of objects with common properties. groups can have style,
animation, filters, transformations, and mouse actions assigned to them.
.PP
\&\fBExample:\fR
.PP
.Vb 9
\& $tag = $svg->group(
\& id => 'xvs000248',
\& style => {
\& 'font' => [ qw( Arial Helvetica sans ) ],
\& 'font-size' => 10,
\& 'fill' => 'red',
\& },
\& transform => 'rotate(-45)'
\& );
.Ve
.Sh "defs"
.IX Subsection "defs"
$tag = \f(CW$svg\fR\->defs(%attributes)
.PP
define a definition segment. A Defs requires children when defined using \s-1SVG\s0.pm
\&\fBExample:\fR
.PP
.Vb 1
\& $tag = $svg->defs(id => 'def_con_one',);
.Ve
.Sh "style"
.IX Subsection "style"
$svg\->tag('style', \f(CW%styledef\fR);
.PP
Sets/Adds style-definition for the following objects being created.
.PP
Style definitions apply to an object and all its children for all properties for
which the value of the property is not redefined by the child.
.Sh "mouseaction"
.IX Subsection "mouseaction"
$svg\->mouseaction(%attributes)
.PP
Sets/Adds mouse action definitions for tag
.PP
$svg\->attrib($name, \f(CW$value\fR)
.PP
Sets/Adds mouse action definitions.
.PP
$svg\->attrib \f(CW$name\fR, \f(CW$value\fR
.PP
$svg\->attrib \f(CW$name\fR, \e@value
.PP
$svg\->attrib \f(CW$name\fR, \e%value
.PP
Sets/Replaces attributes for a tag.
.Sh "cdata"
.IX Subsection "cdata"
$svg\->cdata($text)
.PP
Sets cdata to \f(CW$text\fR. \s-1SVG\s0.pm allows you to set cdata for any tag. If the tag is
meant to be an empty tag, \s-1SVG\s0.pm will not complain, but the rendering agent will
fail. In the \s-1SVG\s0 \s-1DTD\s0, cdata is generally only meant for adding text or script
content.
.PP
\&\fBExample:\fR
.PP
.Vb 5
\& $svg->text(
\& style => {
\& 'font' => 'Arial',
\& 'font-size' => 20
\& })->cdata('SVG.pm is a perl module on CPAN!');
.Ve
.PP
.Vb 2
\& my $text = $svg->text(style=>{'font'=>'Arial','font-size'=>20});
\& $text->cdata('SVG.pm is a perl module on CPAN!');
.Ve
.PP
\&\fBResult:\fR
.PP
.Vb 1
\& E<lt>text style="font: Arial; font-size: 20" E<gt>SVG.pm is a perl module on CPAN!E<lt>/text E<gt>
.Ve
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
.Vb 1
\& L<"CDATA"> L<"desc">, L<"title">, L<"text">, L<"script">.
.Ve
.Sh "cdata_noxmlesc"
.IX Subsection "cdata_noxmlesc"
.Vb 2
\& $script = $svg->script();
\& $script->cdata_noxmlesc($text);
.Ve
.PP
Generates cdata content for text and similar tags which do not get xml\-escaped.
In othe words, does not parse the content and inserts the exact string into the cdata location.
.Sh "\s-1CDATA\s0"
.IX Subsection "CDATA"
.Vb 2
\& $script = $svg->script();
\& $script->CDATA($text);
.Ve
.PP
Generates a <![CDATA[ ... ]]> tag with the contents of \f(CW$text\fR rendered exactly as supplied. \s-1SVG\s0.pm allows you to set cdata for any tag. If the tag is
meant to be an empty tag, \s-1SVG\s0.pm will not complain, but the rendering agent will
fail. In the \s-1SVG\s0 \s-1DTD\s0, cdata is generally only meant for adding text or script
content.
.PP
\&\fBExample:\fR
.PP
.Vb 4
\& my $text = qq§
\& var SVGDoc;
\& var groups = new Array();
\& var last_group;
.Ve
.PP
.Vb 15
\& /*****
\& *
\& * init
\& *
\& * Find this SVG's document element
\& * Define members of each group by id
\& *
\& *****/
\& function init(e) {
\& SVGDoc = e.getTarget().getOwnerDocument();
\& append_group(1, 4, 6); // group 0
\& append_group(5, 4, 3); // group 1
\& append_group(2, 3); // group 2
\& }§;
\& $svg->script()->CDATA($text);
.Ve
.PP
\&\fBResult:\fR
.PP
.Vb 5
\& E<lt>script E<gt>
\& <gt>![CDATA[
\& var SVGDoc;
\& var groups = new Array();
\& var last_group;
.Ve
.PP
.Vb 15
\& /*****
\& *
\& * init
\& *
\& * Find this SVG's document element
\& * Define members of each group by id
\& *
\& *****/
\& function init(e) {
\& SVGDoc = e.getTarget().getOwnerDocument();
\& append_group(1, 4, 6); // group 0
\& append_group(5, 4, 3); // group 1
\& append_group(2, 3); // group 2
\& }
\& ]]E<gt>
.Ve
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
.Vb 1
\& L<"cdata">, L<"script">.
.Ve
.Sh "filter"
.IX Subsection "filter"
$tag = \f(CW$svg\fR\->filter(%attributes)
.PP
Generate a filter. Filter elements contain \*(L"fe\*(R" filter sub\-elements.
.PP
\&\fBExample:\fR
.PP
.Vb 8
\& my $filter = $svg->filter(
\& filterUnits=>"objectBoundingBox",
\& x=>"-10%",
\& y=>"-10%",
\& width=>"150%",
\& height=>"150%",
\& filterUnits=>'objectBoundingBox'
\& );
.Ve
.PP
.Vb 1
\& $filter->fe();
.Ve
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
\&\*(L"fe\*(R".
.Sh "fe"
.IX Subsection "fe"
$tag = \f(CW$svg\fR\->fe(\-type=>'type', \f(CW%attributes\fR)
.PP
Generate a filter sub\-element. Must be a child of a \*(L"filter\*(R" element.
.PP
\&\fBExample:\fR
.PP
.Vb 10
\& my $fe = $svg->fe(
\& -type => 'DiffuseLighting' # required - element name omiting 'fe'
\& id => 'filter_1',
\& style => {
\& 'font' => [ qw(Arial Helvetica sans) ],
\& 'font-size' => 10,
\& 'fill' => 'red',
\& },
\& transform => 'rotate(-45)'
\& );
.Ve
.PP
Note that the following filter elements are currently supported:
.IP "\(bu feBlend" 4
.IX Item "feBlend"
.PD 0
.IP "\(bu feColorMatrix" 4
.IX Item "feColorMatrix"
.IP "\(bu feComponentTransfer" 4
.IX Item "feComponentTransfer"
.IP "\(bu feComposite" 4
.IX Item "feComposite"
.IP "\(bu feConvolveMatrix" 4
.IX Item "feConvolveMatrix"
.IP "\(bu feDiffuseLighting" 4
.IX Item "feDiffuseLighting"
.IP "\(bu feDisplacementMap" 4
.IX Item "feDisplacementMap"
.IP "\(bu feDistantLight" 4
.IX Item "feDistantLight"
.IP "\(bu feFlood" 4
.IX Item "feFlood"
.IP "\(bu feFuncA" 4
.IX Item "feFuncA"
.IP "\(bu feFuncB" 4
.IX Item "feFuncB"
.IP "\(bu feFuncG" 4
.IX Item "feFuncG"
.IP "\(bu feFuncR" 4
.IX Item "feFuncR"
.IP "\(bu feGaussianBlur" 4
.IX Item "feGaussianBlur"
.IP "\(bu feImage" 4
.IX Item "feImage"
.IP "\(bu feMerge" 4
.IX Item "feMerge"
.IP "\(bu feMergeNode" 4
.IX Item "feMergeNode"
.IP "\(bu feMorphology" 4
.IX Item "feMorphology"
.IP "\(bu feOffset" 4
.IX Item "feOffset"
.IP "\(bu fePointLight" 4
.IX Item "fePointLight"
.IP "\(bu feSpecularLighting" 4
.IX Item "feSpecularLighting"
.IP "\(bu feSpotLight" 4
.IX Item "feSpotLight"
.IP "\(bu feTile" 4
.IX Item "feTile"
.IP "\(bu feTurbulence" 4
.IX Item "feTurbulence"
.PD
.PP
\&\s-1SEE\s0 \s-1ALSO:\s0
.PP
\&\*(L"filter\*(R".
.Sh "pattern"
.IX Subsection "pattern"
$tag = \f(CW$svg\fR\->pattern(%attributes)
.PP
Define a pattern for later reference by url.
.PP
\&\fBExample:\fR
.PP
.Vb 7
\& my $pattern = $svg->pattern(
\& id => "Argyle_1",
\& width => "50",
\& height => "50",
\& patternUnits => "userSpaceOnUse",
\& patternContentUnits => "userSpaceOnUse"
\& );
.Ve
.Sh "set"
.IX Subsection "set"
$tag = \f(CW$svg\fR\->set(%attributes)
.PP
Set a definition for an \s-1SVG\s0 object in one section, to be referenced in other
sections as needed.
.PP
\&\fBExample:\fR
.PP
.Vb 7
\& my $set = $svg->set(
\& id => "Argyle_1",
\& width => "50",
\& height => "50",
\& patternUnits => "userSpaceOnUse",
\& patternContentUnits => "userSpaceOnUse"
\& );
.Ve
.Sh "stop"
.IX Subsection "stop"
$tag = \f(CW$svg\fR\->stop(%attributes)
.PP
Define a stop boundary for \*(L"gradient\*(R"
.PP
\&\fBExample:\fR
.PP
.Vb 7
\& my $pattern = $svg->stop(
\& id => "Argyle_1",
\& width => "50",
\& height => "50",
\& patternUnits => "userSpaceOnUse",
\& patternContentUnits => "userSpaceOnUse"
\& );
.Ve
.PP
$tag = \f(CW$svg\fR\->gradient(%attributes)
.PP
Define a color gradient. Can be of type \fBlinear\fR or \fBradial\fR
.PP
\&\fBExample:\fR
.PP
.Vb 4
\& my $gradient = $svg->gradient(
\& -type => "linear",
\& id => "gradient_1"
\& );
.Ve
.SH "GENERIC ELEMENT METHODS"
.IX Header "GENERIC ELEMENT METHODS"
The following elements are generically supported by \s-1SVG:\s0
.IP "\(bu altGlyph" 4
.IX Item "altGlyph"
.PD 0
.IP "\(bu altGlyphDef" 4
.IX Item "altGlyphDef"
.IP "\(bu altGlyphItem" 4
.IX Item "altGlyphItem"
.IP "\(bu clipPath" 4
.IX Item "clipPath"
.IP "\(bu color-profile" 4
.IX Item "color-profile"
.IP "\(bu cursor" 4
.IX Item "cursor"
.IP "\(bu definition-src" 4
.IX Item "definition-src"
.IP "\(bu font-face-format" 4
.IX Item "font-face-format"
.IP "\(bu font-face-name" 4
.IX Item "font-face-name"
.IP "\(bu font-face-src" 4
.IX Item "font-face-src"
.IP "\(bu font-face-url" 4
.IX Item "font-face-url"
.IP "\(bu foreignObject" 4
.IX Item "foreignObject"
.IP "\(bu glyph" 4
.IX Item "glyph"
.IP "\(bu glyphRef" 4
.IX Item "glyphRef"
.IP "\(bu hkern" 4
.IX Item "hkern"
.IP "\(bu marker" 4
.IX Item "marker"
.IP "\(bu mask" 4
.IX Item "mask"
.IP "\(bu metadata" 4
.IX Item "metadata"
.IP "\(bu missing-glyph" 4
.IX Item "missing-glyph"
.IP "\(bu mpath" 4
.IX Item "mpath"
.IP "\(bu switch" 4
.IX Item "switch"
.IP "\(bu symbol" 4
.IX Item "symbol"
.IP "\(bu tref" 4
.IX Item "tref"
.IP "\(bu view" 4
.IX Item "view"
.IP "\(bu vkern" 4
.IX Item "vkern"
.PD
.PP
See e.g. \*(L"pattern\*(R" for an example of the use of these methods.
.SH "METHODS IMPORTED BY SVG::DOM"
.IX Header "METHODS IMPORTED BY SVG::DOM"
The following \s-1SVG::DOM\s0 elements are accessible through \s-1SVG:\s0
.IP "\(bu getChildren" 4
.IX Item "getChildren"
.PD 0
.IP "\(bu getFirstChild" 4
.IX Item "getFirstChild"
.IP "\(bu getLastChild" 4
.IX Item "getLastChild"
.IP "\(bu getParent" 4
.IX Item "getParent"
.IP "\(bu getSiblings" 4
.IX Item "getSiblings"
.IP "\(bu getElementByID" 4
.IX Item "getElementByID"
.IP "\(bu getElementID" 4
.IX Item "getElementID"
.IP "\(bu getElements" 4
.IX Item "getElements"
.IP "\(bu getElementName" 4
.IX Item "getElementName"
.IP "\(bu getParentElement" 4
.IX Item "getParentElement"
.IP "\(bu getType" 4
.IX Item "getType"
.IP "\(bu getAttributes" 4
.IX Item "getAttributes"
.IP "\(bu getAttribute" 4
.IX Item "getAttribute"
.IP "\(bu setAttributes" 4
.IX Item "setAttributes"
.IP "\(bu setAttribute" 4
.IX Item "setAttribute"
.PD
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIperl\fR\|(1),\s-1SVG\s0,\s-1SVG::DOM\s0,\s-1SVG::XML\s0,SVG::Element,SVG::Parser, SVG::Manual
http://www.roasp.com/
http://www.perlsvg.com/
http://www.roitsystems.com/
http://www.w3c.org/Graphics/SVG/