Image::SVG::Path is Perl module that extracts information contained in the "d" attribute of an SVG < path > element and turns it into a simpler series of steps.
For example, an SVG < path > element might take the form
< path d="M9.6,20.25c0.61,0.37,3.91,0.45,4.52,0.34c2.86-0.5,14.5-2.09,21.37-2.64c0.94-0.07,2.67-0.26,3.45,0.04"/ >
Using an XML parser, such as XML::Parser,
use XML::Parser;
use Image::SVG::Path 'extract_path_info';
my $p = XML::Parser->new (Handlers => {Start => \& start});
$p->parsefile ($file)
or die "Error $file: ";
sub start
{
my ($expat, $element, %attr) = @_;
if ($element eq 'path') {
my $d = $attr{d};
my @r = extract_path_info ($d);
# Do something with path info in @r
}
}
SVG means "scalable vector graphics" and it is a standard of the W3 consortium. See http://www.w3.org/TR/SVG/ for the full specification. See http://www.w3.org/TR/SVG/paths.html for the specification for paths. Although SVG is a type of XML, the text in the d attribute of SVG paths is not in the XML format but in a more condensed form using single letters and numbers. This module is a parser for that condensed format.
SYNOPSIS
use Image::SVG::Path 'extract_path_info';
my @path_info = extract_path_info ($path_d_attribute);
Product's homepage
Requirements:
· Perl