The second one: load the .svg, add the text, save and display the modified image.
I think I am supposed to do something like this:
#!/usr/bin/perl
use warnings;
use strict;
use SVG;
# Open the file whicw will contain the modified image.
open(MAP_OUT, ">output.svg") || die "Error: unable to open output.svg:
+ $!\n";
# Create the SVG object.
my $svg = SVG->new(
width => 1500,
height => 1500
);
# Load the image.
my $map = $svg->image(
x => 0,
y => 0,
width => 1500,
height => 1500,
'-href' => "map.svg",
id => "image_1"
);
# Add the text.
my $text = $svg->text(
id => "text_1",
x => 40,
y => 80,
-cdata => "something"
);
# Add some more text...
# Print the xml text on the output file.
print MAP_OUT $svg->xmlify;
# Open the .svg image with firefox.
system(firefox, output.svg);
Is it OK?
|