SVGPDF/PAST.pm

filter: Statementstmt 18.6% 56 / 301 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 11.9% 5 / 42 Podpod 0.0% 0 / 37 totaltotal 14.7% 61 / 415 CC 18 SCAR 15.2
CC
18
Cov
17%
transform
12.0
text
12.0
xdbg
6.0
CRAP 4.6
« SVGPDF/Defs.pm ↑ Summary SVGPDF/Use.pm »
1 #! perl
2  
3 3 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Object::Pad;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # Use this package as an intermediate to trace the actual operations.
9  
10 class SVGPDF::PAST;
11  
12 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 field $pdf :param;
15 0 ▶field $xo :accessor;
Subroutine xo: not called CC=2 SCAR=14.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@_ and $xo = shift() 0 0 0
16  
17 3 field $indent;
18 0 ▶field $prog :accessor;
Subroutine prog: not called CC=2 SCAR=14.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@_ and $prog = shift() 0 0 0
19  
20 0 ▶method xdbg ( $fmt, @args ) {
Subroutine xdbg: not called CC=2 SCAR=17.9
Pod undocumented
21 0 ▶ if ( $fmt =~ /\%/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fmt =~ /\%/u) { } 0 0 0
22 0 $prog .= $indent . sprintf( $fmt, @args) . "\n";
23 }
24 else {
25 0 $prog .= $indent . join( "", $fmt, @args ) . "\n";
26 }
27 3 }
28  
29 BUILD {
30 $indent = $prog = "";
31 $xo = $pdf->xo_form;
32 }
33  
34 #### Coordinates
35  
36 0 ▶method bbox ( @args ) {
Subroutine bbox: not called CC=1 SCAR=4.9
Pod undocumented
37 0 $self->xdbg( "\$page->bbox( ", join(", ", @args ), " );" );
38 0 $xo->bbox( @args );
39 3 }
40  
41 0 ▶method transform ( %args ) {
Subroutine transform: not called CC=3 SCAR=24.8
Pod undocumented
42 0 my $tag = "\$xo->transform(";
43 0 ▶ while ( my ($k,$v) = each %args ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %args) 0 0 0
44 0 $tag .= " $k => ";
45 0 ▶ if ( ref($v) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $v eq 'ARRAY') { } 0 0 0
46 0 $tag .= "[ " . join(", ", @$v) . " ]";
47 }
48 else {
49 0 $tag .= "\"$v\"";
50 }
51 0 $tag .= ", ";
52 }
53 0 substr( $tag, -2, 2, " );" );
54 0 $self->xdbg($tag);
55 0 $xo->transform( %args );
56 3 }
57  
58 0 ▶method matrix ( @args ) {
Subroutine matrix: not called CC=1 SCAR=6.9
Pod undocumented
59 0 $self->xdbg( "\$xo->matrix( ", join(", ", @args ), " );" );
60 0 $xo->matrix(@args);
61 3 }
62  
63 #### Graphics.
64  
65 0 ▶method fill ( @args ) {
Subroutine fill: not called CC=2 SCAR=17.9
Pod undocumented
66 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
67 0 $self->xdbg( "\$xo->fill();" );
68 0 $xo->fill( @args );
69 3 }
70  
71 0 ▶method fill_color ( @args ) {
Subroutine fill_color: not called CC=2 SCAR=17.9
Pod undocumented
72 0 ▶ Carp::confess("currentColor") if $args[0] eq 'currentColor';
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] eq "currentColor" 0 0 0
73 0 $self->xdbg( "\$xo->fill_color( \"@args\" );" );
74 0 $xo->fill_color( @args );
75 3 }
76  
77 0 ▶method line_cap ( @args ) {
Subroutine line_cap: not called CC=1 SCAR=6.9
Pod undocumented
78 0 $self->xdbg( "\$xo->line_cap( ", join(", ", @args ), " );" );
79 0 $xo->line_cap( @args );
80 3 }
81  
82 0 ▶method line_dash_pattern ( @args ) {
Subroutine line_dash_pattern: not called CC=1 SCAR=6.9
Pod undocumented
83 0 $self->xdbg( "\$xo->line_dash_pattern( ", join(", ", @args ), " );" );
84 0 $xo->line_dash_pattern( @args );
85 3 }
86  
87 0 ▶method line_join ( @args ) {
Subroutine line_join: not called CC=1 SCAR=6.9
Pod undocumented
88 0 $self->xdbg( "\$xo->line_join( ", join(", ", @args ), " );" );
89 0 $xo->line_join( @args );
90 3 }
91  
92 0 ▶method line_width ( @args ) {
Subroutine line_width: not called CC=1 SCAR=6.9
Pod undocumented
93 0 $self->xdbg( "\$xo->line_width( ", join(", ", @args ), " );" );
94 0 $xo->line_width( @args );
95 3 }
96  
97 0 ▶method paint ( @args ) {
Subroutine paint: not called CC=2 SCAR=17.9
Pod undocumented
98 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
99 0 $self->xdbg( "\$xo->paint();" );
100 0 $xo->paint( @args );
101 3 }
102  
103 0 ▶method restore ( @args ) {
Subroutine restore: not called CC=2 SCAR=17.9
Pod undocumented
104 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
105 0 $indent = substr( $indent, 2 );
106 0 $self->xdbg( "\$xo->restore();" );
107 0 $xo->restore;
108 3 }
109  
110 0 ▶method save ( @args ) {
Subroutine save: not called CC=2 SCAR=17.9
Pod undocumented
111 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
112 0 $self->xdbg( "\$xo->save();" );
113 0 $indent = "$indent ";
114 0 $xo->save;
115 3 }
116  
117 0 ▶method stroke ( @args ) {
Subroutine stroke: not called CC=2 SCAR=17.9
Pod undocumented
118 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
119 0 $self->xdbg( "\$xo->stroke();" );
120 0 $xo->stroke( @args );
121 3 }
122  
123 0 ▶method stroke_color ( @args ) {
Subroutine stroke_color: not called CC=1 SCAR=6.9
Pod undocumented
124 0 $self->xdbg( "\$xo->stroke_color( \"@args\" );" );
125 0 $xo->stroke_color( @args );
126 3 }
127  
128 #### Texts,
129  
130 0 ▶method font ( $font, $size, $name = "default" ) {
Subroutine font: not called CC=2 SCAR=17.9
Pod undocumented
131 0 $self->xdbg( "\$xo->font( \$font, $size );\t# $name" );
132 0 $xo->font( $font, $size );
133 3 }
134  
135 0 ▶method text ( $text, %opts ) {
Subroutine text: not called CC=3 SCAR=24.8
Pod undocumented
136 0 my $t = $text;
137 0 ▶ if ( length($t) == 1 && ord($t) > 255 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $t == 1 and ord $t > 255) { } 0 0 0
Condition0%0/3
length $t == 1 and ord $t > 255
!ll&&!rl&&r
000
MC/DC0%0/2
length $t == 1 and ord $t > 255
length $t == 1 ord $t > 255
Truth table0%0/3
A and B
A= length $t == 1B= ord $t > 255
ABresult
0X0
100
111
138 0 $t = sprintf("\\x{%04x}", ord($t));
139 }
140 else {
141 0 $t =~ s/(["\\\x{0}-\x{1f}\x{ff}-\x{ffff}])/sprintf("\\x{%x}", ord($1))/ge;
142 }
143 $self->xdbg( "\$xo->text( \"$t\", ",
144 0 join( ", ", map { "$_ => \"$opts{$_}\"" } keys %opts ),
145 " );" );
146 0 $xo->text( $text, %opts );
147 3 }
148  
149 0 ▶method textstart ( @args ) {
Subroutine textstart: not called CC=2 SCAR=17.9
Pod undocumented
150 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
151 0 $self->xdbg( "\$xo->textstart();" );
152 0 $xo->textstart( @args );
153 3 }
154  
155 0 ▶method textend ( @args ) {
Subroutine textend: not called CC=2 SCAR=17.9
Pod undocumented
156 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
157 0 $self->xdbg( "\$xo->textend();" );
158 0 $xo->textend( @args );
159 3 }
160  
161 #### Basic shapes.
162  
163 0 ▶method circle ( @args ) {
Subroutine circle: not called CC=1 SCAR=6.9
Pod undocumented
164 0 $self->xdbg( "\$xo->circle( ", join(", ",@args), " );" );
165 0 $xo->circle( @args );
166 3 }
167  
168 0 ▶method ellipse ( @args ) {
Subroutine ellipse: not called CC=1 SCAR=6.9
Pod undocumented
169 0 $self->xdbg( "\$xo->ellipse( ", join(", ",@args), " );" );
170 0 $xo->ellipse( @args );
171 3 }
172  
173 0 ▶method image( @args ) {
Subroutine image: not called CC=1 SCAR=6.9
Pod undocumented
174 0 my $image = shift(@args);
175 0 $self->xdbg( "\$xo->image(<img>, ", join(", ",@args), " );" );
176 0 $xo->image( $image, @args );
177 3 }
178  
179 0 ▶method line ( @args ) {
Subroutine line: not called CC=1 SCAR=6.9
Pod undocumented
180 0 $self->xdbg( "\$xo->line( ", join(", ",@args), " );" );
181 0 $xo->line( @args );
182 3 }
183  
184 # Note: polygon is a closed polyline.
185 0 ▶method polyline ( @args ) {
Subroutine polyline: not called CC=1 SCAR=6.9
Pod undocumented
186 0 $self->xdbg( "\$xo->polyline( ", join(", ",@args), " );" );
187 0 $xo->polyline( @args );
188 3 }
189  
190 0 ▶method rect ( @args ) {
Subroutine rect: not called CC=1 SCAR=6.9
Pod undocumented
191 0 $self->xdbg( "\$xo->rect( ", join(", ",@args), " );" );
192 0 $xo->rect( @args );
193 3 }
194  
195 0 ▶method rectangle ( @args ) {
Subroutine rectangle: not called CC=1 SCAR=6.9
Pod undocumented
196 0 $self->xdbg( "\$xo->rectangle( ", join(", ",@args), " );" );
197 0 $xo->rectangle( @args );
198 3 }
199  
200 #### Paths.
201  
202 #### NOT USED.
203 0 ▶method bogen ( @args ) {
Subroutine bogen: not called CC=1 SCAR=6.9
Pod undocumented
204 0 $self->xdbg( "\$xo->bogen( ", join(", ",@args), " );" );
205 0 $xo->bogen( @args );
206 3 }
207  
208 #### NOT USED.
209 0 ▶method bogen_ellip ( @args ) {
Subroutine bogen_ellip: not called CC=1 SCAR=6.9
Pod undocumented
210 0 $self->xdbg( "\$xo->bogen_ellip( ", join(", ",@args), " );" );
211 0 $xo->bogen_ellip( @args );
212 3 }
213  
214 0 ▶method close ( @args ) {
Subroutine close: not called CC=2 SCAR=17.9
Pod undocumented
215 0 ▶ die if @args;
Branch: 1 branch
BranchTrueFalseTotal
if @args 0 0 0
216 0 $self->xdbg( "\$xo->close();" );
217 0 $xo->close( @args );
218 3 }
219  
220 0 ▶method curve ( @args ) {
Subroutine curve: not called CC=1 SCAR=6.9
Pod undocumented
221 0 $self->xdbg( "\$xo->curve( ", join(", ",@args), " );" );
222 0 $xo->curve( @args );
223 3 }
224  
225 0 ▶method hline ( @args ) {
Subroutine hline: not called CC=1 SCAR=6.9
Pod undocumented
226 0 $self->xdbg( "\$xo->hline( @args );" );
227 0 $xo->hline( @args );
228 3 }
229  
230 0 ▶method move ( @args ) {
Subroutine move: not called CC=1 SCAR=6.9
Pod undocumented
231 0 $self->xdbg( "\$xo->move( ", join(", ",@args), " );" );
232 0 $xo->move( @args );
233 3 }
234  
235 0 ▶method pie ( @args ) {
Subroutine pie: not called CC=1 SCAR=6.9
Pod undocumented
236 0 $self->xdbg( "\$xo->pie( ", join(", ",@args), " );" );
237 0 $xo->pie( @args );
238 3 }
239  
240 0 ▶method spline ( @args ) {
Subroutine spline: not called CC=1 SCAR=6.9
Pod undocumented
241 0 $self->xdbg( "\$xo->spline( ", join(", ",@args), " );" );
242 0 $xo->spline( @args );
243 3 }
244  
245 0 ▶method vline ( @args ) {
Subroutine vline: not called CC=1 SCAR=6.9
Pod undocumented
246 0 $self->xdbg( "\$xo->vline( @args );" );
247 0 $xo->vline( @args );
248 3 }
249  
250 3 1;
« SVGPDF/Defs.pm ↑ Summary SVGPDF/Use.pm »