SVG::SVG2zinc - a module to display or convert svg files in perl modules or script, assuming you have Tk::Zinc.
use SVG::SVG2zinc;
#To generate a script.pl file: &SVG::SVG2zinc::parse('file.svg', -result_type => 'script.pl', -verbose => $verbose, -zinc_version => $zinc_version);
#To generate a script.pm file: &SVG::SVG2zinc::parse('file.svg', -result_type => 'script.pm', -verbose => $verbose, -zinc_version => $zinc_version, -group => "\$top_group");
#To display a svgfile: $zinc = $mw->Zinc(); $top_group = $zinc->add('group', 1); &SVG::SVG2zinc::parse('file.svg', -result_type => "\$SVG2zinc::zinc", -group => $top_group, -verbose => $verbose, -namespace => $namespace, );
Depending on the -result_type argument, &SVG::SVG2zinc::parse either displays SVG files inside a Tk::Zinc widget, or generates a perl module which could be used by a script or generates a perl script which displays the SVG file.
SVG::SVG2zinc should be extended to generate tcl or python scripts and/or modules.
Some limitations are due to differences between Tk::Zinc and SVG graphic models :
Drawing width are zoomed in SVG but are not with Tk::Zinc. Their width is defined whatever the zoom factor is.
Gradient Transformation is not possible in Tk::Zinc. May be it could be implemented by the converted?
Rectangles cannot have rounded corners in Tk::Zinc. Could be implemented, by producing curve item rather than rectabgles in Tk::zinc. Sould be implemented in a future release of Tk::Zinc
Skew and Matrix transforms are not yet available in Tk::Zinc 3.2.94 or 3.294. Hopefully they should be available in the next release.
Text and tspan tags are very complex items in SVG, for example placement can be very precise and complex. Many such features are difficult to implement in Tk::Zinc and are not currently implemented
Font management is still limited. It will be rotatable and zoomable in future release of Tk::Zinc. SVG fonts included in a document are not readed, currently.
No image filtering functions are (and will be) available with Tk::Zinc, except if YOU want to contribute?
The SVG ClipPath tag is a bit more powerfull than Tk::Zinc clipping (clipper is limited to one item). So currently this is not implemented at all in SVG::SVG2zinc
There are also some limitations due to the early stage of the converter:
CSS in external url is not yet implemented
No animation is currently available, neither scripting in the SVG file. But Perl is a scripting language, isn'it?
The SVG switch tag is only partly implemented, but should work in most situations
href for images can only reference a file in the same directory than the SVG source file
It was said there is still one hidden bug... but please patch and/or report it to the author!
svg2zinc.pl(1) a sample script using and demonstrating SVG::SVG2zinc
Tk::Zinc(3) TkZinc is available at www.openatc.org/zinc/
Christophe Mertz <mertz@cena.fr>
many patches and extensions from Alexandre Lemort <lemort@intuilab.com>
helps from Celine Schlienger <celine@intuilab.com> and Stéphane Chatty <chatty@intuilab.com>
CENA (C) 2002-2003
This program is free software; you can redistribute it and/or modify it under the term of the LGPL licence.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Stéphane'. Assuming CP1252
To install SVG::SVG2zinc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SVG::SVG2zinc
CPAN shell
perl -MCPAN -e shell install SVG::SVG2zinc
For more information on module installation, please visit the detailed CPAN module installation guide.