Leser: 21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/perl use strict; use SVG; my $svg = SVG->new(width => 600, height => 600); my $viereck=$svg->group(id => 'gr_viereck') -> rectangle(id=>'viereck1', 'stroke' => 'red', 'fill'=>'yellow', x=>0, y=>0, width=>50, height=>50) -> rectangle(id=>'viereck2', 'stroke' => 'blue', 'fill'=>'white', x=>100, y=>100, width=>150, height=>150) ; # das hier soll das eigentliche Ziel sein: my $v -> use(-href=>'#gr_viereck', transform=>'translate(250, 250) scale(0.9)'); print $svg->xmlify;
1 2 3
my $viereck=$svg->group(id => 'gr_viereck'); $viereck->rectangle(id=>'viereck1', 'stroke' => 'red', 'fill'=>'yellow', x=>0, y=>0, width=>50, height=>50); $viereck->rectangle(id=>'viereck2', 'stroke' => 'blue', 'fill'=>'white', x=>100, y=>100, width=>150, height=>150);
1
2
3
4
5
6
7
8
9
10
11
12
13
my $y=$svg->group(
id => 'group_y',
style => { stroke=>'red', fill=>'green' }
);
$y->circle(cx=>100, cy=>100, r=>50, id=>'circle_in_group_y_1');
# add a circle to the group
$y->circle(cx=>100, cy=>100, r=>50, id=>'circle_in_group_y_2');
$y->comment('This is a comment');
$y->circle(cx=>100, cy=>100, r=>50, id=>'circle_in_group_y_3');
# now render the SVG object, implicitly use svg namespace
print "\nfirst drawing\n";
print $svg->xmlify;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl use strict; use warnings; use SVG; my $svg = SVG->new(width => 600, height => 600); my $viereck=$svg->group(id => 'gr_viereck'); $viereck-> rectangle(id=>'viereck1', 'stroke' => 'red', 'fill'=>'yellow', x=>0, y=>0, width=>50, height=>50); $viereck-> rectangle(id=>'viereck2', 'stroke' => 'blue', 'fill'=>'white', x=>100, y=>100, width=>150, height=>150); # das hier soll das eigentliche Ziel sein: my $v = $svg->use(-href=>'#gr_viereck', transform=>'translate(250, 250) scale(0.9)'); print $svg->xmlify;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg height="600" width="600" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="gr_viereck">
<rect fill="yellow" height="50" id="viereck1" stroke="red" width="50" x="0" y="0" />
<rect fill="white" height="150" id="viereck2" stroke="blue" width="150" x="100" y="100" />
</g>
<use transform="translate(250, 250) scale(0.9)" xlink:href="#gr_viereck" />
<!--
Generated using the Perl SVG Module V2.50
by Ronan Oger
Info: http://www.roitsystems.com/
-->
</svg>
my $v = $svg->use(-href=>'#gr_viereck'...
1 2 3 4 5 6 7 8 9 10
my $k = $z->anchor( id => 'anchor_k', -href => 'http://test.hackmare.com/', target => 'new_window_0' )->rectangle( x => 20, y => 50, width => 20, height => 30, rx => 10, ry => 5, id => 'rect_k_in_anchor_k_in_group_z' );