.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .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. \*(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- .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" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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::Element 3pm" .TH SVG::Element 3pm "2013-10-11" "perl v5.18.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SVG::Element \- Generate the element bits for SVG.pm .SH "AUTHOR" .IX Header "AUTHOR" Ronan Oger, cpan@roitsystems.com .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1SVG\s0,\s-1SVG::XML\s0,SVG::Element,SVG::Parser \s-1ROASP\s0.com: Serverside \s-1SVG\s0 server \s-1ROIT\s0 Systems: Commercial \s-1SVG\s0 perl solutions \s-1SVG\s0 at the W3C .SS "tag (alias: element)" .IX Subsection "tag (alias: element)" \&\f(CW$tag\fR = \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(\*(Aqg\*(Aq, transform=>\*(Aqrotate(\-45)\*(Aq); .Ve .SS "anchor" .IX Subsection "anchor" \&\f(CW$tag\fR = \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 \fIoptional anchor attributes\fR .IX Subsection "optional anchor attributes" .PP the following attributes are expected for anchor tags (any any tags which use \-href links): .SS "\-href required =head2 \-type optional =head2 \-role optional =head2 \-title optional =head2 \-show optional =head2 \-arcrole optional =head2 \-actuate optional =head2 target optional" .IX Subsection "-href required =head2 -type optional =head2 -role optional =head2 -title optional =head2 -show optional =head2 -arcrole optional =head2 -actuate optional =head2 target optional" For more information on the options, refer to the w3c XLink specification at .PP \&\fBExample:\fR .PP .Vb 6 \& # generate an anchor \& $tag = $SVG\->anchor( \& \-href=>\*(Aqhttp://here.com/some/simpler/SVG.SVG\*(Aq \& \-title => \*(Aqnew window 2 example title\*(Aq, \& \-actuate => \*(AqonLoad\*(Aq, \& \-show=> \*(Aqembed\*(Aq, \& \& ); .Ve .PP for more information about the options above, refer to Link section in the \s-1SVG\s0 recommendation: .PP .Vb 2 \& # add a circle to the anchor. The circle can be clicked on. \& $tag\->circle(cx=>10,cy=>10,r=>1); \& \& # more complex anchor with both URL and target \& $tag = $SVG\->anchor( \& \-href => \*(Aqhttp://somewhere.org/some/other/page.html\*(Aq, \& target => \*(Aqnew_window\*(Aq \& ); .Ve .SS "circle" .IX Subsection "circle" \&\f(CW$tag\fR = \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\->circlecx=>4, cy=>2, r=>1); .Ve .SS "ellipse" .IX Subsection "ellipse" \&\f(CW$tag\fR = \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=>\*(Aqellipse\*(Aq, \& style=>{ \& \*(Aqstroke\*(Aq=>\*(Aqred\*(Aq, \& \*(Aqfill\*(Aq=>\*(Aqgreen\*(Aq, \& \*(Aqstroke\-width\*(Aq=>\*(Aq4\*(Aq, \& \*(Aqstroke\-opacity\*(Aq=>\*(Aq0.5\*(Aq, \& \*(Aqfill\-opacity\*(Aq=>\*(Aq0.2\*(Aq \& } \& ); .Ve .SS "rectangle (alias: rect)" .IX Subsection "rectangle (alias: rect)" \&\f(CW$tag\fR = \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=>\*(Aqrect_1\*(Aq \& ); .Ve .SS "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, \& \*(Aq\-href\*(Aq=>"image.png", #may also embed SVG, e.g. "image.SVG" \& id=>\*(Aqimage_1\*(Aq \& ); .Ve .PP \&\fBOutput:\fR .PP .Vb 1 \& .Ve .SS "use" .IX Subsection "use" \&\f(CW$tag\fR = \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, \& \*(Aq\-href\*(Aq=>"pic.SVG#image_1", \& id=>\*(Aqimage_1\*(Aq \& ); .Ve .PP \&\fBOutput:\fR .PP .Vb 1 \& .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. .SS "polygon" .IX Subsection "polygon" \&\f(CW$tag\fR = \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]; \& \& $points = $a\->get_path( \& x=>$xv, y=>$yv, \& \-type=>\*(Aqpolygon\*(Aq \& ); \& \& $c = $a\->polygon( \& %$points, \& id=>\*(Aqpgon1\*(Aq, \& style=>\e%polygon_style \& ); .Ve .PP \&\s-1SEE ALSO:\s0 .PP \&\*(L"polyline\*(R", \*(L"path\*(R", \*(L"get_path\*(R". .SS "polyline" .IX Subsection "polyline" \&\f(CW$tag\fR = \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]; \& \& $points = $a\->get_path( \& x=>$xv, y=>$yv, \& \-type=>\*(Aqpolyline\*(Aq, \& \-closed=>\*(Aqtrue\*(Aq #specify that the polyline is closed. \& ); \& \& my $tag = $a\->polyline ( \& %$points, \& id=>\*(Aqpline_1\*(Aq, \& style=>{ \& \*(Aqfill\-opacity\*(Aq=>0, \& \*(Aqstroke\-color\*(Aq=>\*(Aqrgb(250,123,23)\*(Aq \& } \& ); .Ve .SS "line" .IX Subsection "line" \&\f(CW$tag\fR = \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=>\*(Aql1\*(Aq, \& x1=>0, y1=>10, \& x2=>10, y2=>0 \& ); .Ve .PP To draw multiple connected lines, use \*(L"polyline\*(R". .SS "text" .IX Subsection "text" \&\f(CW$text\fR = \f(CW$SVG\fR\->text(%attributes)\->\fIcdata()\fR; .PP \&\f(CW$text_path\fR = \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=>\*(Aql1\*(Aq, x=>10, y=>10 \& )\->cdata(\*(Aqhello, world\*(Aq); \& \& my $text2 = $SVG\->text( \& id=>\*(Aql1\*(Aq, x=>10, y=>10, \-cdata=>\*(Aqhello, world\*(Aq); \& \& my $text = $SVG\->text( \& id=>\*(Aqtp\*(Aq, x=>10, y=>10 \-type=>path) \& \->text(id=>\*(Aqts\*(Aq \-type=>\*(Aqspan\*(Aq) \& \->cdata(\*(Aqhello, world\*(Aq); .Ve .PP \&\s-1SEE ALSO:\s0 .PP .Vb 1 \& L<"desc">, L<"cdata">. .Ve .SS "title" .IX Subsection "title" \&\f(CW$tag\fR = \f(CW$SVG\fR\->title(%attributes) .PP Generate the title of the image. .PP \&\fBExample:\fR .PP .Vb 1 \& my $tag = $SVG\->title(id=>\*(Aqdocument\-title\*(Aq)\->cdata(\*(AqThis is the title\*(Aq); .Ve .SS "desc" .IX Subsection "desc" \&\f(CW$tag\fR = \f(CW$SVG\fR\->desc(%attributes) .PP Generate the description of the image. .PP \&\fBExample:\fR .PP .Vb 1 \& my $tag = $SVG\->desc(id=>\*(Aqdocument\-desc\*(Aq)\->cdata(\*(AqThis is a description\*(Aq); .Ve .SS "comment" .IX Subsection "comment" \&\f(CW$tag\fR = \f(CW$SVG\fR\->comment(@comments) .PP Generate the description of the image. .PP \&\fBExample:\fR .PP .Vb 1 \& my $tag = $SVG\->comment(\*(Aqcomment 1\*(Aq,\*(Aqcomment 2\*(Aq,\*(Aqcomment 3\*(Aq); .Ve .PP \&\f(CW$tag\fR = \f(CW$SVG\fR\->pi(@pi) .PP Generate (or adds) a set of processing instructions which go at the beginning of the document after the xml start tag .PP \&\fBExample:\fR .PP .Vb 1 \& my $tag = $SVG\->pi(\*(Aqinstruction one\*(Aq,\*(Aqinstruction two\*(Aq,\*(Aqinstruction three\*(Aq); \& \& returns: \& \& \& .Ve .SS "script" .IX Subsection "script" \&\f(CW$tag\fR = \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"); \& \& # populate the script tag with cdata \& # be careful to manage the javascript line ends. \& # qq|text| or qqXtextX where text is the script \& # works well for this. \& \& $tag\->CDATA(qq|function d(){ \& //simple display function \& for(cnt = 0; cnt < d.length; cnt++) \& document.write(d[cnt]);//end for loop \& document.write("
");//write a line break \& }| \& ); \& # create an svg external script reference to an outside file \& my $tag2 = SVG\->script(type=>"text/ecmascript", \-href="/scripts/example.es"); .Ve .SS "style" .IX Subsection "style" \&\f(CW$tag\fR = \f(CW$SVG\fR\->style(%attributes) .PP Generate a style container for inline or xlink:href based styling instructions .PP \&\fBExample:\fR .PP .Vb 1 \& my $tag = $SVG\->style(type=>"text/css"); \& \& # Populate the style tag with cdata. \& # Be careful to manage the line ends. \& # qq|text| or qqXtextX, where text is the script \& # work well for this. \& \& $tag1\->CDATA(qq| \& rect fill:red;stroke:green; \& circle fill:red;stroke:orange; \& ellipse fill:none;stroke:yellow; \& text fill:black;stroke:none; \& |); \& \& # Create a external CSS stylesheet reference \& my $tag2 = $SVG\->style(type=>"text/css", \-href="/resources/example.css"); .Ve .SS "path" .IX Subsection "path" \&\f(CW$tag\fR = \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]; \& \& $points = $a\->get_path( \& x => $xv, \& y => $yv, \& \-type => \*(Aqpath\*(Aq, \& \-closed => \*(Aqtrue\*(Aq #specify that the polyline is closed \& ); \& \& $tag = $SVG\->path( \& %$points, \& id => \*(Aqpline_1\*(Aq, \& style => { \& \*(Aqfill\-opacity\*(Aq => 0, \& \*(Aqfill\-color\*(Aq => \*(Aqgreen\*(Aq, \& \*(Aqstroke\-color\*(Aq => \*(Aqrgb(250,123,23)\*(Aq \& } \& ); .Ve .PP \&\s-1SEE ALSO:\s0 .PP \&\*(L"get_path\*(R". .SS "get_path" .IX Subsection "get_path" \&\f(CW$path\fR = \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=>\e@x,y=>\e@y,\-relative=>1,\-type=>\*(Aqpath\*(Aq); \& \& #add the path to the SVG document \& my $p = $SVG\->path(%$path, style=>\e%style_definition); \& \& #generate an closed path definition for a a polyline. \& $points = $SVG\->get_path( \& x=>\e@x, \& y=>\e@y, \& \-relative=>1, \& \-type=>\*(Aqpolyline\*(Aq, \& \-closed=>1 \& ); # generate a closed path definition for a polyline \& \& # add the polyline to the SVG document \& $p = $SVG\->polyline(%$points, id=>\*(Aqpline1\*(Aq); .Ve .PP \&\fBAliases:\fR get_path set_path .SS "animate" .IX Subsection "animate" \&\f(CW$tag\fR = \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=>\*(Aqan_ellipse\*(Aq, \& stroke=>\*(Aqrgb(130,220,70)\*(Aq,fill=>\*(Aqrgb(30,20,50)\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"cx",values=>"20; 200; 20",dur=>"10s", repeatDur=>\*(Aqindefinite\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"rx",values=>"10;30;20;100;50", \& dur=>"10s", repeatDur=>\*(Aqindefinite\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"ry",values=>"30;50;10;20;70;150", \& dur=>"15s", repeatDur=>\*(Aqindefinite\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"rx",values=>"30;75;10;100;20;20;150", \& dur=>"20s", repeatDur=>\*(Aqindefinite\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"fill",values=>"red;green;blue;cyan;yellow", \& dur=>"5s", repeatDur=>\*(Aqindefinite\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"fill\-opacity",values=>"0;1;0.5;0.75;1", \& dur=>"20s",repeatDur=>\*(Aqindefinite\*(Aq); \& \& $an_ellipse\-> animate( \& attributeName=>"stroke\-width",values=>"1;3;2;10;5", \& dur=>"20s",repeatDur=>\*(Aqindefinite\*(Aq); .Ve .SS "group" .IX Subsection "group" \&\f(CW$tag\fR = \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 => \*(Aqxvs000248\*(Aq, \& style => { \& \*(Aqfont\*(Aq => [ qw( Arial Helvetica sans ) ], \& \*(Aqfont\-size\*(Aq => 10, \& \*(Aqfill\*(Aq => \*(Aqred\*(Aq, \& }, \& transform => \*(Aqrotate(\-45)\*(Aq \& ); .Ve .SS "defs" .IX Subsection "defs" \&\f(CW$tag\fR = \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 => \*(Aqdef_con_one\*(Aq,); .Ve .SS "style" .IX Subsection "style" \&\f(CW$SVG\fR\->style(%styledef) .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. .SS "mouseaction" .IX Subsection "mouseaction" \&\f(CW$SVG\fR\->mouseaction(%attributes) .PP Sets/Adds mouse action definitions for tag .PP \&\f(CW$SVG\fR\->attrib($name, \f(CW$value\fR) .PP Sets/Adds attributes of an element. .PP Retrieve an attribute: .PP .Vb 1 \& $svg\->attrib($name); .Ve .PP Set a scalar attribute: .PP .Vb 1 \& $SVG\->attrib $name, $value .Ve .PP Set a list attribute: .PP .Vb 1 \& $SVG\->attrib $name, \e@value .Ve .PP Set a hash attribute (i.e. style definitions): .PP .Vb 1 \& $SVG\->attrib $name, \e%value .Ve .PP Remove an attribute: .PP .Vb 1 \& $svg\->attrib($name,undef); .Ve .PP \&\fBAliases:\fR attr attribute .SS "cdata" .IX Subsection "cdata" \&\f(CW$SVG\fR\->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 DTD,\s0 cdata is generally only meant for adding text or script content. .PP \&\fBExample:\fR .PP .Vb 5 \& $SVG\->text( \& style => { \& \*(Aqfont\*(Aq => \*(AqArial\*(Aq, \& \*(Aqfont\-size\*(Aq => 20 \& })\->cdata(\*(AqSVG.pm is a perl module on CPAN!\*(Aq); \& \& my $text = $SVG\->text(style=>{\*(Aqfont\*(Aq=>\*(AqArial\*(Aq,\*(Aqfont\-size\*(Aq=>20}); \& $text\->cdata(\*(AqSVG.pm is a perl module on CPAN!\*(Aq); .Ve .PP \&\fBResult:\fR .PP .Vb 1 \& Etext style="font: Arial; font\-size: 20" ESVG.pm is a perl module on CPAN!E/text E .Ve .PP \&\s-1SEE ALSO:\s0 .PP .Vb 1 \& L<"CDATA"> L<"desc">, L<"title">, L<"text">, L<"script">. .Ve .SS "\s-1CDATA\s0" .IX Subsection "CDATA" .Vb 2 \& $script = $SVG\->script(); \& $script\->CDATA($text); .Ve .PP Generates a 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 DTD,\s0 cdata is generally only meant for adding text or script content. .PP \&\fBExample:\fR .PP .Vb 4 \& my $text = qqX \& var SVGDoc; \& var groups = new Array(); \& var last_group; \& \& /***** \& * \& * init \& * \& * Find this SVG\*(Aqs 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 \& }X; \& $SVG\->script()\->CDATA($text); .Ve .PP \&\fBResult:\fR .PP .Vb 5 \& Escript E \& ![CDATA[ \& var SVGDoc; \& var groups = new Array(); \& var last_group; \& \& /***** \& * \& * init \& * \& * Find this SVG\*(Aqs 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 .Ve .PP \&\s-1SEE ALSO:\s0 .PP .Vb 1 \& L<"cdata">, L<"script">. .Ve .SS "filter" .IX Subsection "filter" \&\f(CW$tag\fR = \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=>\*(AqobjectBoundingBox\*(Aq \& ); \& \& $filter\->fe(); .Ve .PP \&\s-1SEE ALSO:\s0 .PP \&\*(L"fe\*(R". .SS "fe" .IX Subsection "fe" \&\f(CW$tag\fR = \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 => \*(Aqdiffuselighting\*(Aq # required \- element name in lower case omiting \*(Aqfe\*(Aq \& id => \*(Aqfilter_1\*(Aq, \& style => { \& \*(Aqfont\*(Aq => [ qw(Arial Helvetica sans) ], \& \*(Aqfont\-size\*(Aq => 10, \& \*(Aqfill\*(Aq => \*(Aqred\*(Aq, \& }, \& transform => \*(Aqrotate(\-45)\*(Aq \& ); .Ve .PP Note that the following filter elements are currently supported: Also note that the elelemts are defined in lower case in the module, but as of version 2.441, any case combination is allowed. .SS "* feBlend" .IX Subsection "* feBlend" .SS "* feColorMatrix" .IX Subsection "* feColorMatrix" .SS "* feComponentTransfer" .IX Subsection "* feComponentTransfer" .SS "* feComposite" .IX Subsection "* feComposite" .SS "* feConvolveMatrix" .IX Subsection "* feConvolveMatrix" .SS "* feDiffuseLighting" .IX Subsection "* feDiffuseLighting" .SS "* feDisplacementMap" .IX Subsection "* feDisplacementMap" .SS "* feDistantLight" .IX Subsection "* feDistantLight" .SS "* feFlood" .IX Subsection "* feFlood" .SS "* feFuncA" .IX Subsection "* feFuncA" .SS "* feFuncB" .IX Subsection "* feFuncB" .SS "* feFuncG" .IX Subsection "* feFuncG" .SS "* feFuncR" .IX Subsection "* feFuncR" .SS "* feGaussianBlur" .IX Subsection "* feGaussianBlur" .SS "* feImage" .IX Subsection "* feImage" .SS "* feMerge" .IX Subsection "* feMerge" .SS "* feMergeNode" .IX Subsection "* feMergeNode" .SS "* feMorphology" .IX Subsection "* feMorphology" .SS "* feOffset" .IX Subsection "* feOffset" .SS "* fePointLight" .IX Subsection "* fePointLight" .SS "* feSpecularLighting" .IX Subsection "* feSpecularLighting" .SS "* feSpotLight" .IX Subsection "* feSpotLight" .SS "* feTile" .IX Subsection "* feTile" .SS "* feTurbulence" .IX Subsection "* feTurbulence" \&\s-1SEE ALSO:\s0 .PP \&\*(L"filter\*(R". .SS "pattern" .IX Subsection "pattern" \&\f(CW$tag\fR = \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 .SS "set" .IX Subsection "set" \&\f(CW$tag\fR = \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 .SS "stop" .IX Subsection "stop" \&\f(CW$tag\fR = \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 \&\f(CW$tag\fR = \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 .SS "* altGlyph" .IX Subsection "* altGlyph" .SS "* altGlyphDef" .IX Subsection "* altGlyphDef" .SS "* altGlyphItem" .IX Subsection "* altGlyphItem" .SS "* clipPath" .IX Subsection "* clipPath" .SS "* color-profile" .IX Subsection "* color-profile" .SS "* cursor" .IX Subsection "* cursor" .SS "* definition-src" .IX Subsection "* definition-src" .SS "* font-face-format" .IX Subsection "* font-face-format" .SS "* font-face-name" .IX Subsection "* font-face-name" .SS "* font-face-src" .IX Subsection "* font-face-src" .SS "* font-face-url" .IX Subsection "* font-face-url" .SS "* foreignObject" .IX Subsection "* foreignObject" .SS "* glyph" .IX Subsection "* glyph" .SS "* glyphRef" .IX Subsection "* glyphRef" .SS "* hkern" .IX Subsection "* hkern" .SS "* marker" .IX Subsection "* marker" .SS "* mask" .IX Subsection "* mask" .SS "* metadata" .IX Subsection "* metadata" .SS "* missing-glyph" .IX Subsection "* missing-glyph" .SS "* mpath" .IX Subsection "* mpath" .SS "* switch" .IX Subsection "* switch" .SS "* symbol" .IX Subsection "* symbol" .SS "* tref" .IX Subsection "* tref" .SS "* view" .IX Subsection "* view" .SS "* vkern" .IX Subsection "* vkern" See e.g. \*(L"pattern\*(R" for an example of the use of these methods.