API3/Compat/API2/Resource/ExtGState.pm

filter: Statementstmt 19.0% 24 / 126 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 20.5% 8 / 39 Podpod 100% 31 / 31 totaltotal 31.8% 63 / 198 CC 3 SCAR 7.9
CC
3
Cov
19%
blendmode
6.0
outobjdeep
6.0
new
2.0
CRAP 2.2
« API3/Compat/API2/Basic/PDF/Bool.pm ↑ Summary API3/Compat/API2/Resource/XObject/Form/BarCode/codabar.pm »
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 # Copyright 1999-2005 Alfred Reibenschuh <areibens@cpan.org>.
12 #
13 #=======================================================================
14 #
15 # This library is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU Lesser General Public
17 # License as published by the Free Software Foundation; either
18 # version 2 of the License, or (at your option) any later version.
19 #
20 # This library is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # Lesser General Public License for more details.
24 #
25 # You should have received a copy of the GNU Lesser General Public
26 # License along with this library; if not, write to the
27 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 # Boston, MA 02111-1307, USA.
29 #
30 # $Id: ExtGState.pm,v 2.0 2005/11/16 02:16:04 areibens Exp $
31 #
32 #=======================================================================
33
34 package PDF::API3::Compat::API2::Resource::ExtGState;
35
36 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
37
38 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶ use PDF::API3::Compat::API2::Resource;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶ use PDF::API3::Compat::API2::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶ use Math::Trig;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶ use PDF::API3::Compat::API2::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 1 ▶ use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
44
45 1 @ISA = qw(PDF::API3::Compat::API2::Resource);
46
47 1 ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:16:04 $
48
49 }
50 1 ▶no warnings qw[ deprecated recursion uninitialized ];
Subroutine BEGIN: called CC=1 SCAR=0.0
51
52 =item $egs = PDF::API3::Compat::API2::Resource::ExtGState->new @parameters
53
54 Returns a new extgstate object (called from $pdf->extgstate).
55
56 =cut
57
58 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
59 0 my ($class,$pdf,$key)=@_;
60 0 my $self = $class->SUPER::new($pdf,$key);
61 0 $self->{Type}=PDFName('ExtGState');
62 0 return($self);
63 }
64
65 =item $font = PDF::API3::Compat::API2::Resource::ExtGState->new_api $api, $name
66
67 Returns a egstate-font object. This method is different from 'new' that
68 it needs an PDF::API3::Compat::API2-object rather than a Text::PDF::File-object.
69
70 =cut
71
72 0 ▶sub new_api {
Subroutine new_api: not called CC=1 SCAR=6.9
Pod documented
73 0 my ($class,$api,@opts)=@_;
74
75 0 my $obj=$class->new($api->{pdf},@opts);
76 0 $self->{' api'}=$api;
77
78 0 return($obj);
79 }
80
81 =item $egs->strokeadjust $boolean
82
83 =cut
84
85 0 ▶sub strokeadjust {
Subroutine strokeadjust: not called CC=1 SCAR=6.9
Pod documented
86 0 my ($self,$var)=@_;
87 0 $self->{SA}=PDFBool($var);
88 0 return($self);
89 }
90
91 =item $egs->strokeoverprint $boolean
92
93 =cut
94
95 0 ▶sub strokeoverprint {
Subroutine strokeoverprint: not called CC=1 SCAR=6.9
Pod documented
96 0 my ($self,$var)=@_;
97 0 $self->{OP}=PDFBool($var);
98 0 return($self);
99 }
100
101 =item $egs->filloverprint $boolean
102
103 =cut
104
105 0 ▶sub filloverprint {
Subroutine filloverprint: not called CC=1 SCAR=6.9
Pod documented
106 0 my ($self,$var)=@_;
107 0 $self->{op}=PDFBool($var);
108 0 return($self);
109 }
110
111 =item $egs->overprintmode $num
112
113 =cut
114
115 0 ▶sub overprintmode {
Subroutine overprintmode: not called CC=1 SCAR=6.9
Pod documented
116 0 my ($self,$var)=@_;
117 0 $self->{OPM}=PDFNum($var);
118 0 return($self);
119 }
120
121 =item $egs->blackgeneration $obj
122
123 =cut
124
125 0 ▶sub blackgeneration {
Subroutine blackgeneration: not called CC=1 SCAR=6.9
Pod documented
126 0 my ($self,$obj)=@_;
127 0 $self->{BG}=$obj;
128 0 return($self);
129 }
130
131 =item $egs->blackgeneration2 $obj
132
133 =cut
134
135 0 ▶sub blackgeneration2 {
Subroutine blackgeneration2: not called CC=1 SCAR=6.9
Pod documented
136 0 my ($self,$obj)=@_;
137 0 $self->{BG2}=$obj;
138 0 return($self);
139 }
140
141 =item $egs->undercolorremoval $obj
142
143 =cut
144
145 0 ▶sub undercolorremoval {
Subroutine undercolorremoval: not called CC=1 SCAR=6.9
Pod documented
146 0 my ($self,$obj)=@_;
147 0 $self->{UCR}=$obj;
148 0 return($self);
149 }
150
151 =item $egs->undercolorremoval2 $obj
152
153 =cut
154
155 0 ▶sub undercolorremoval2 {
Subroutine undercolorremoval2: not called CC=1 SCAR=6.9
Pod documented
156 0 my ($self,$obj)=@_;
157 0 $self->{UCR2}=$obj;
158 0 return($self);
159 }
160
161 =item $egs->transfer $obj
162
163 =cut
164
165 0 ▶sub transfer {
Subroutine transfer: not called CC=1 SCAR=6.9
Pod documented
166 0 my ($self,$obj)=@_;
167 0 $self->{TR}=$obj;
168 0 return($self);
169 }
170
171 =item $egs->transfer2 $obj
172
173 =cut
174
175 0 ▶sub transfer2 {
Subroutine transfer2: not called CC=1 SCAR=6.9
Pod documented
176 0 my ($self,$obj)=@_;
177 0 $self->{TR2}=$obj;
178 0 return($self);
179 }
180
181 =item $egs->halftone $obj
182
183 =cut
184
185 0 ▶sub halftone {
Subroutine halftone: not called CC=1 SCAR=6.9
Pod documented
186 0 my ($self,$obj)=@_;
187 0 $self->{HT}=$obj;
188 0 return($self);
189 }
190
191 =item $egs->halftonephase $obj
192
193 =cut
194
195 0 ▶sub halftonephase {
Subroutine halftonephase: not called CC=1 SCAR=6.9
Pod documented
196 0 my ($self,$obj)=@_;
197 0 $self->{HTP}=$obj;
198 0 return($self);
199 }
200
201 =item $egs->smoothness $num
202
203 =cut
204
205 0 ▶sub smoothness {
Subroutine smoothness: not called CC=1 SCAR=6.9
Pod documented
206 0 my ($self,$var)=@_;
207 0 $self->{SM}=PDFNum($var);
208 0 return($self);
209 }
210
211 =item $egs->font $font, $size
212
213 =cut
214
215 0 ▶sub font {
Subroutine font: not called CC=1 SCAR=6.9
Pod documented
216 0 my ($self,$font,$size)=@_;
217 0 $self->{Font}=PDFArray(PDFName($font->{' apiname'}),PDFNum($size));
218 0 return($self);
219 }
220
221 =item $egs->linewidth $size
222
223 =cut
224
225 0 ▶sub linewidth {
Subroutine linewidth: not called CC=1 SCAR=6.9
Pod documented
226 0 my ($self,$var)=@_;
227 0 $self->{LW}=PDFNum($var);
228 0 return($self);
229 }
230
231 =item $egs->linecap $cap
232
233 =cut
234
235 0 ▶sub linecap {
Subroutine linecap: not called CC=1 SCAR=6.9
Pod documented
236 0 my ($self,$var)=@_;
237 0 $self->{LC}=PDFNum($var);
238 0 return($self);
239 }
240
241 =item $egs->linejoin $join
242
243 =cut
244
245 0 ▶sub linejoin {
Subroutine linejoin: not called CC=1 SCAR=6.9
Pod documented
246 0 my ($self,$var)=@_;
247 0 $self->{LJ}=PDFNum($var);
248 0 return($self);
249 }
250
251 =item $egs->meterlimit $limit
252
253 =cut
254
255 0 ▶sub meterlimit {
Subroutine meterlimit: not called CC=1 SCAR=6.9
Pod documented
256 0 my ($self,$var)=@_;
257 0 $self->{ML}=PDFNum($var);
258 0 return($self);
259 }
260
261 =item $egs->dash @dash
262
263 =cut
264
265 0 ▶sub dash {
Subroutine dash: not called CC=1 SCAR=6.9
Pod documented
266 0 my ($self,@dash)=@_;
267 0 $self->{ML}=PDFArray( map { PDFNum($_); } @dash );
268 0 return($self);
269 }
270
271 =item $egs->flatness $flat
272
273 =cut
274
275 0 ▶sub flatness {
Subroutine flatness: not called CC=1 SCAR=6.9
Pod documented
276 0 my ($self,$var)=@_;
277 0 $self->{FL}=PDFNum($var);
278 0 return($self);
279 }
280
281 =item $egs->renderingintent $intentName
282
283 =cut
284
285 0 ▶sub renderingintent {
Subroutine renderingintent: not called CC=1 SCAR=6.9
Pod documented
286 0 my ($self,$var)=@_;
287 0 $self->{FL}=PDFName($var);
288 0 return($self);
289 }
290
291 =item $egs->strokealpha $alpha
292
293 The current stroking alpha constant, specifying the
294 constant shape or constant opacity value to be used
295 for stroking operations in the transparent imaging model.
296
297 =cut
298
299 0 ▶sub strokealpha {
Subroutine strokealpha: not called CC=1 SCAR=6.9
Pod documented
300 0 my ($self,$var)=@_;
301 0 $self->{CA}=PDFNum($var);
302 0 return($self);
303 }
304
305 =item $egs->fillalpha $alpha
306
307 Same as strokealpha, but for nonstroking operations.
308
309 =cut
310
311 0 ▶sub fillalpha {
Subroutine fillalpha: not called CC=1 SCAR=6.9
Pod documented
312 0 my ($self,$var)=@_;
313 0 $self->{ca}=PDFNum($var);
314 0 return($self);
315 }
316
317 =item $egs->blendmode $blendname
318
319 =item $egs->blendmode $blendfunctionobj
320
321 The current blend mode to be used in the transparent
322 imaging model.
323
324 =cut
325
326 0 ▶sub blendmode {
Subroutine blendmode: not called CC=2 SCAR=17.9
Pod documented
327 0 my ($self,$var)=@_;
328 0 ▶ if(ref($var)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $var) { } 0 0 0
329 0 $self->{BM}=$var;
330 } else {
331 0 $self->{BM}=PDFName($var);
332 }
333 0 return($self);
334 }
335
336 =item $egs->alphaisshape $boolean
337
338 The alpha source flag (alpha is shape), specifying
339 whether the current soft mask and alpha constant
340 are to be interpreted as shape values (true) or
341 opacity values (false).
342
343 =cut
344
345 0 ▶sub alphaisshape {
Subroutine alphaisshape: not called CC=1 SCAR=6.9
Pod documented
346 0 my ($self,$var)=@_;
347 0 $self->{AIS}=PDFBool($var);
348 0 return($self);
349 }
350
351 =item $egs->textknockout $boolean
352
353 The text knockout flag, which determines the behavior
354 of overlapping glyphs within a text object in the
355 transparent imaging model.
356
357 =cut
358
359 0 ▶sub textknockout {
Subroutine textknockout: not called CC=1 SCAR=6.9
Pod documented
360 0 my ($self,$var)=@_;
361 0 $self->{TK}=PDFBool($var);
362 0 return($self);
363 }
364
365 =item $egs->transparency $t
366
367 The graphics tranparency , with 0 being fully opaque and 1 being fully transparent.
368 This is a convenience method setting proper values for strokeaplha and fillalpha.
369
370 =cut
371
372 0 ▶sub transparency {
Subroutine transparency: not called CC=1 SCAR=6.9
Pod documented
373 0 my ($self,$var)=@_;
374 0 $self->strokealpha(1-$var);
375 0 $self->fillalpha(1-$var);
376 0 return($self);
377 }
378
379 =item $egs->opacity $op
380
381 The graphics opacity , with 1 being fully opaque and 0 being fully transparent.
382 This is a convenience method setting proper values for strokeaplha and fillalpha.
383
384 =cut
385
386 0 ▶sub opacity {
Subroutine opacity: not called CC=1 SCAR=6.9
Pod documented
387 0 my ($self,$var)=@_;
388 0 $self->strokealpha($var);
389 0 $self->fillalpha($var);
390 0 return($self);
391 }
392
393 0 ▶sub outobjdeep {
Subroutine outobjdeep: not called CC=2 SCAR=17.9
Pod documented
394 0 my ($self, @opts) = @_;
395 0 foreach my $k (qw/ api apipdf /) {
396 0 $self->{" $k"}=undef;
397 0 delete($self->{" $k"});
398 }
399 0 $self->SUPER::outobjdeep(@opts);
400 }
401
402 1 1;
403
404 __END__
« API3/Compat/API2/Basic/PDF/Bool.pm ↑ Summary API3/Compat/API2/Resource/XObject/Form/BarCode/codabar.pm »