SVG::SVG2zinc 0.10 review
DownloadSVG::SVG2zinc is a Perl module to display or convert svg files in scripts, classes, images... SYNOPSIS use SVG::SVG2zinc;
|
|
SVG::SVG2zinc is a Perl module to display or convert svg files in scripts, classes, images...
SYNOPSIS
use SVG::SVG2zinc;
&SVG::SVG2zinc::parsefile('file.svg', 'Backend','file.svg',
-out => 'outfile',
-verbose => $verbose,
-namespace => 0|1,
-prefix => 'string',
);
# to generate a Perl script:
&SVG::SVG2zinc::parsefile('file.svg','PerlScript',
-out => 'file.pl');
# to generate a Perl Class:
&SVG::SVG2zinc::parsefile('file.svg','PerlClass',
-out => 'Class.pm');
# to display a svgfile:
&SVG::SVG2zinc::parsefile('file.svg', 'Display');
#To convert a svgfile in png/jpeg file:
&SVG::SVG2zinc::parsefile('file.svg', 'Image',
-out => 'file.jpg');
# to generate a Tcl script:
&SVG::SVG2zinc::parsefile('file.svg','TclScript',
-out => 'file.tcl');
Depending on the used Backend, &SVG::SVG2zinc::parsefile either generates a Perl Class, Perl script, Tcl Script, bitmap images or displays SVG files inside a Tk::Zinc widget.
SVG::SVG2zinc could be extended to generate Python scripts and/or classes, or other files, just by sub-classing SVG::SVG2zinc::Backend(3pm)
==head1 HOW IT WORKS
This converter creates some TkZinc items associated to most SVG tags. For example, < SVG > or < G > tags are transformed in TkZinc groups. are converted in TkZinc curves.... many more to come...
==head2 TkZinc items tags
Every TkZinc item created by the parser get one or more tags. If the corresponding svg tag has an Id, this Id will be used as a tag, after some cleaning due to TkZinc limitation on tag values (no dot, star, etc...). If the corresponding svg tag has no Id, the parser add a tag of the following form : __< itemtype >__< integer >. If the parser is provided a -prefix option, the prefix is prepended to the tag: __< itemtype >__< integer >
The TkZinc group associated to the top tag has the following tag 'svg_top', as well as 'width=integer' 'heigth=integer' tags if width and height are defined in the top < SVG > tag. These tags can be used to find the group and to get its desired width and height.
==head2 RunTime code
There is currently on new Tk::Zinc method needed when executing perl code generated. This perl Tk::Zinc::adaptViewport function should be translated and included or imported in any script generated in an other scripting language (eg. Tcl or Python).
Requirements:
Perl
SVG::SVG2zinc 0.10 keywords