SVG::SVG2zinc - a module to display or convert svg files in perl modules or script, assuming you have Tk::Zinc.
use SVG::SVG2zinc; &SVG::SVG2zinc::parsefile('file.svg', 'Backend','file.svg', -out => 'outfile', -verbose => $verbose, -namespace => 0|1, ); # 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::parse('file.svg', 'Display'); #To convert a svgfile in png/jpeg file: &SVG::SVG2zinc::parse('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::parse either generates a perl class, perl script or bitmap images or displays SVG files inside a Tk::Zinc widget.
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 in Tk::Zinc where it is constant whatever the zoom factor is.
Gradient Transformation is not possible in Tk::Zinc. May be it could be implemented by the converter?
Rectangles cannot have rounded corners in Tk::Zinc. Could be implemented, by producing curve item rather than rectangles in Tk::zinc. Should be implemented in a future release of Tk::Zinc
Skew and Matrix transforms are not yet available in Tk::Zinc 3.295. Hopefully they should be available in a future 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 or Tcl are scripting languages,
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! Any (simple ?)
SVG file not correctly rendered by this module (except for limitations listed previously) could be send to the author with a little comment about the expected rendering.
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.