| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ConvertSMIL; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# SMIL tags generator |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
1052
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub smil { |
|
10
|
0
|
0
|
0
|
0
|
|
|
if ($_[0][0] == 1) { |
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
return changeThickness($_[0][1], # from |
|
12
|
|
|
|
|
|
|
$_[0][2], # to |
|
13
|
|
|
|
|
|
|
$_[0][3], # begin |
|
14
|
|
|
|
|
|
|
$_[0][4]); # dur |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
} elsif (($_[0][0] >= 11) && ($_[0][0] <= 16)) { |
|
17
|
0
|
|
|
|
|
|
return translate($_[0][1], $_[0][2], # begin, dur |
|
18
|
|
|
|
|
|
|
$_[0][3], $_[0][4], # x, y |
|
19
|
|
|
|
|
|
|
$_[0][5]); # unit |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} elsif (($_[0][0] >= 21) && ($_[0][0] <= 26)) { |
|
22
|
0
|
|
|
|
|
|
return rotate($_[0][1], $_[0][2], # begin, dur |
|
23
|
|
|
|
|
|
|
$_[0][3], # angle |
|
24
|
|
|
|
|
|
|
$_[0][4], $_[0][5], # x, y |
|
25
|
|
|
|
|
|
|
$_[0][6]); # unit |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} elsif (($_[0][0] >= 31) && ($_[0][0] <= 36)) { |
|
28
|
0
|
|
|
|
|
|
return scale($_[0][1], $_[0][2], # begin, dur |
|
29
|
|
|
|
|
|
|
$_[0][3], # factor |
|
30
|
|
|
|
|
|
|
$_[0][4], $_[0][5]); # x, y |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} elsif ($_[0][0] == 2) { |
|
33
|
0
|
|
|
|
|
|
return changeFillIntensity($_[0][1], $_[0][2], # begin, dur |
|
34
|
|
|
|
|
|
|
$_[0][3], $_[0][4], # from, to |
|
35
|
|
|
|
|
|
|
$_[0][5], $_[0][6]); # color, colors |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} elsif ($_[0][0] == 0) { |
|
38
|
0
|
|
|
|
|
|
return setAttributeValue($_[0][1], $_[0][2], # begin, dur |
|
39
|
|
|
|
|
|
|
$_[0][3], $_[0][4]); # attribute, value |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} else { |
|
42
|
0
|
|
|
|
|
|
return ""; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub setAttributeValue { |
|
48
|
0
|
|
|
0
|
|
|
my ($begin, $dur, $attribute, $value, $colors) = @_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $attributeType; |
|
51
|
|
|
|
|
|
|
my $attributeName; |
|
52
|
0
|
|
|
|
|
|
my $to; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if ($attribute eq "visibility") { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$attributeType = "CSS"; |
|
56
|
0
|
|
|
|
|
|
$attributeName = "visibility"; |
|
57
|
0
|
0
|
|
|
|
|
if ($value == 0) { $to = "hidden"; } |
|
|
0
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
else { $to = "visible"; } |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} elsif ($attribute eq "pen_color") { |
|
61
|
0
|
|
|
|
|
|
$attributeType = "CSS"; |
|
62
|
0
|
|
|
|
|
|
$attributeName = "stroke"; |
|
63
|
0
|
|
|
|
|
|
$to = ConvertSVG::pen_fill_colors_to_rgb($value, $colors); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} elsif ($attribute eq "fill_color") { |
|
66
|
0
|
|
|
|
|
|
$attributeType = "CSS"; |
|
67
|
0
|
|
|
|
|
|
$attributeName = "fill"; |
|
68
|
0
|
|
|
|
|
|
$to = ConvertSVG::pen_fill_colors_to_rgb($value, $colors); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} else { |
|
71
|
|
|
|
|
|
|
# error |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
if ($attributeName) { |
|
75
|
|
|
|
|
|
|
return |
|
76
|
0
|
|
|
|
|
|
"
|
|
77
|
|
|
|
|
|
|
"attributeType=\"" . $attributeType . "\" " . |
|
78
|
|
|
|
|
|
|
"to=\"" . $to . "\" " . |
|
79
|
|
|
|
|
|
|
"begin=\"" . $begin . "s\" " . |
|
80
|
|
|
|
|
|
|
"dur=\"0s\" " . |
|
81
|
|
|
|
|
|
|
"fill=\"freeze\" " . |
|
82
|
|
|
|
|
|
|
"/>"; |
|
83
|
|
|
|
|
|
|
} else { |
|
84
|
|
|
|
|
|
|
# error |
|
85
|
0
|
|
|
|
|
|
return ""; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub changeThickness { |
|
90
|
0
|
|
|
0
|
|
|
my ($from, $to, $begin, $dur) = @_; |
|
91
|
|
|
|
|
|
|
return |
|
92
|
0
|
|
|
|
|
|
"
|
|
93
|
|
|
|
|
|
|
"from=\"" . ConvertSVG::thickness_to_value($from) . "\" " . |
|
94
|
|
|
|
|
|
|
"to=\"" . ConvertSVG::thickness_to_value($to) . "\" " . |
|
95
|
|
|
|
|
|
|
"begin=\"" . $begin . "s\" " . |
|
96
|
|
|
|
|
|
|
"dur=\"" . $dur . "s\" " . |
|
97
|
|
|
|
|
|
|
"fill=\"freeze\" " . |
|
98
|
|
|
|
|
|
|
"/>"; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub changeFillIntensity { |
|
102
|
0
|
|
|
0
|
|
|
my ($begin, $dur, $from, $to, $color, $colors) = @_; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$from = ConvertSVG::area_fill_to_fill($from, $color, $colors); |
|
105
|
0
|
|
|
|
|
|
$to = ConvertSVG::area_fill_to_fill($to, $color, $colors); |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$from =~ s/fill: //; |
|
108
|
0
|
|
|
|
|
|
$to =~ s/fill: //; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
return |
|
111
|
0
|
|
|
|
|
|
"
|
|
112
|
|
|
|
|
|
|
"begin=\"" . $begin . "s\" " . |
|
113
|
|
|
|
|
|
|
"dur=\"" . $dur . "s\" " . |
|
114
|
|
|
|
|
|
|
"from=\"" . $from . "\" " . |
|
115
|
|
|
|
|
|
|
"to=\"" . $to . "\" " . |
|
116
|
|
|
|
|
|
|
"fill=\"freeze\" " . |
|
117
|
|
|
|
|
|
|
"/>"; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub translate { |
|
121
|
0
|
|
|
0
|
|
|
my ($begin, $dur, $x, $y, $unit) = @_; |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
0
|
|
|
|
|
if ($unit eq 'in') { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$x = 1200 * $x; |
|
125
|
0
|
|
|
|
|
|
$y = 1200 * $y; |
|
126
|
|
|
|
|
|
|
} elsif ($unit eq 'cm') { |
|
127
|
0
|
|
|
|
|
|
$x = 450 * $x; |
|
128
|
0
|
|
|
|
|
|
$y = 450 * $y; |
|
129
|
|
|
|
|
|
|
} elsif ($unit eq 'px') { |
|
130
|
0
|
|
|
|
|
|
$x = 15 * $x; |
|
131
|
0
|
|
|
|
|
|
$y = 15 * $y; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
return |
|
135
|
0
|
|
|
|
|
|
"
|
|
136
|
|
|
|
|
|
|
"attributeName=\"transform\" type=\"translate\" " . |
|
137
|
|
|
|
|
|
|
"from=\"0 0\" " . |
|
138
|
|
|
|
|
|
|
"to=\"" . $x . " " . $y . "\" " . |
|
139
|
|
|
|
|
|
|
"begin=\"" . $begin . "s\" " . |
|
140
|
|
|
|
|
|
|
"dur=\"" . $dur . "s\" " . |
|
141
|
|
|
|
|
|
|
"fill=\"freeze\" " . |
|
142
|
|
|
|
|
|
|
"additive=\"sum\" " . |
|
143
|
|
|
|
|
|
|
"/>"; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub rotate { |
|
147
|
0
|
|
|
0
|
|
|
my ($begin, $dur, $angle, $x, $y, $unit) = @_; |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
0
|
|
|
|
|
if ($unit eq 'in') { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
$x = 1200 * $x; |
|
151
|
0
|
|
|
|
|
|
$y = 1200 * $y; |
|
152
|
|
|
|
|
|
|
} elsif ($unit eq 'cm') { |
|
153
|
0
|
|
|
|
|
|
$x = 450 * $x; |
|
154
|
0
|
|
|
|
|
|
$y = 450 * $y; |
|
155
|
|
|
|
|
|
|
} elsif ($unit eq 'px') { |
|
156
|
0
|
|
|
|
|
|
$x = 15 * $x; |
|
157
|
0
|
|
|
|
|
|
$y = 15 * $y; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
return |
|
161
|
0
|
|
|
|
|
|
"
|
|
162
|
|
|
|
|
|
|
"attributeName=\"transform\" type=\"rotate\" " . |
|
163
|
|
|
|
|
|
|
"from=\"0 " . $x . " " . $y . "\" " . |
|
164
|
|
|
|
|
|
|
"to=\"" . $angle . " " .$x . " " . $y . "\" " . |
|
165
|
|
|
|
|
|
|
"begin=\"" . $begin . "s\" " . |
|
166
|
|
|
|
|
|
|
"dur=\"" . $dur . "s\" " . |
|
167
|
|
|
|
|
|
|
"fill=\"freeze\" " . |
|
168
|
|
|
|
|
|
|
"additive=\"sum\" " . |
|
169
|
|
|
|
|
|
|
"/>"; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub scale { |
|
173
|
0
|
|
|
0
|
|
|
my ($begin, $dur, $factor, $x, $y) = @_; |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
return |
|
176
|
0
|
|
|
|
|
|
translate($begin, $dur, -$x*($factor-1), -$y*($factor-1), '') . |
|
177
|
|
|
|
|
|
|
"
|
|
178
|
|
|
|
|
|
|
"attributeName=\"transform\" type=\"scale\" " . |
|
179
|
|
|
|
|
|
|
"from=\"1 1\" " . |
|
180
|
|
|
|
|
|
|
"to=\"" . $factor . " " . $factor . "\" " . |
|
181
|
|
|
|
|
|
|
"begin=\"" . $begin . "s\" " . |
|
182
|
|
|
|
|
|
|
"dur=\"" . $dur . "s\" " . |
|
183
|
|
|
|
|
|
|
"fill=\"freeze\" " . |
|
184
|
|
|
|
|
|
|
"additive=\"sum\" " . |
|
185
|
|
|
|
|
|
|
"/>"; |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
1; |