File Coverage

blib/lib/PDF/Builder/Resource/ExtGState.pm
Criterion Covered Total %
statement 26 108 24.0
branch 0 2 0.0
condition n/a
subroutine 8 34 23.5
pod 29 29 100.0
total 63 173 36.4


line stmt bran cond sub pod time code
1             package PDF::Builder::Resource::ExtGState;
2              
3 39     39   268 use base 'PDF::Builder::Resource';
  39         102  
  39         5018  
4              
5 39     39   262 use strict;
  39         82  
  39         1159  
6 39     39   190 use warnings;
  39         75  
  39         3271  
7              
8             our $VERSION = '3.028'; # VERSION
9             our $LAST_UPDATE = '3.027'; # manually update whenever code is changed
10              
11 39     39   252 use PDF::Builder::Basic::PDF::Utils;
  39         101  
  39         4073  
12 39     39   241 use PDF::Builder::Util;
  39         98  
  39         65290  
13              
14             =head1 NAME
15              
16             PDF::Builder::Resource::ExtGState - Graphics state dictionary support
17              
18             Inherits from L<PDF::Builder::Resource>
19              
20             =head1 METHODS
21              
22             =head2 new
23              
24             $egs = PDF::Builder::Resource::ExtGState->new(@parameters)
25              
26             =over
27              
28             Returns a new extgstate object (called from $pdf->egstate()).
29              
30             =back
31              
32             =cut
33              
34             sub new {
35 3     3 1 10 my ($class, $pdf, $key) = @_;
36              
37 3         48 my $self = $class->SUPER::new($pdf,$key);
38              
39 3         15 $self->{'Type'} = PDFName('ExtGState');
40 3         9 return $self;
41             }
42              
43             =head2 strokeadjust
44              
45             $egs->strokeadjust($boolean)
46              
47             =over
48              
49             (No information)
50              
51             =back
52              
53             =cut
54              
55             sub strokeadjust {
56 0     0 1 0 my ($self, $var) = @_;
57              
58 0         0 $self->{'SA'} = PDFBool($var);
59 0         0 return $self;
60             }
61              
62             =head2 strokeoverprint
63              
64             $egs->strokeoverprint($boolean)
65              
66             =over
67              
68             (No information)
69              
70             =back
71              
72             =cut
73              
74             sub strokeoverprint {
75 0     0 1 0 my ($self, $var) = @_;
76              
77 0         0 $self->{'OP'} = PDFBool($var);
78 0         0 return $self;
79             }
80              
81             =head2 filloverprint
82              
83             $egs->filloverprint($boolean)
84              
85             =over
86              
87             (No information)
88              
89             =back
90              
91             =cut
92              
93             sub filloverprint {
94 0     0 1 0 my ($self, $var) = @_;
95              
96 0         0 $self->{'op'} = PDFBool($var);
97 0         0 return $self;
98             }
99              
100             =head2 overprintmode
101              
102             $egs->overprintmode($num)
103              
104             =over
105              
106             (No information)
107              
108             =back
109              
110             =cut
111              
112             sub overprintmode {
113 0     0 1 0 my ($self, $var) = @_;
114              
115 0         0 $self->{'OPM'} = PDFNum($var);
116 0         0 return $self;
117             }
118              
119             =head2 blackgeneration
120              
121             $egs->blackgeneration($obj)
122              
123             =over
124              
125             (No information)
126              
127             =back
128              
129             =cut
130              
131             sub blackgeneration {
132 0     0 1 0 my ($self, $obj) = @_;
133              
134 0         0 $self->{'BG'} = $obj;
135 0         0 return $self;
136             }
137              
138             =head2 blackgeneration2
139              
140             $egs->blackgeneration2($obj)
141              
142             =over
143              
144             (No information)
145              
146             =back
147              
148             =cut
149              
150             sub blackgeneration2 {
151 0     0 1 0 my ($self, $obj) = @_;
152              
153 0         0 $self->{'BG2'} = $obj;
154 0         0 return $self;
155             }
156              
157             =head2 undercolorremoval
158              
159             $egs->undercolorremoval($obj)
160              
161             =over
162              
163             (No information)
164              
165             =back
166              
167             =cut
168              
169             sub undercolorremoval {
170 0     0 1 0 my ($self, $obj) = @_;
171              
172 0         0 $self->{'UCR'} = $obj;
173 0         0 return $self;
174             }
175              
176             =head2 undercolorremoval2
177              
178             $egs->undercolorremoval2($obj)
179              
180             =over
181              
182             (No information)
183              
184             =back
185              
186             =cut
187              
188             sub undercolorremoval2 {
189 0     0 1 0 my ($self, $obj) = @_;
190              
191 0         0 $self->{'UCR2'} = $obj;
192 0         0 return $self;
193             }
194              
195             =head2 transfer
196              
197             $egs->transfer($obj)
198              
199             =over
200              
201             (No information)
202              
203             =back
204              
205             =cut
206              
207             sub transfer {
208 0     0 1 0 my ($self, $obj) = @_;
209              
210 0         0 $self->{'TR'} = $obj;
211 0         0 return $self;
212             }
213              
214             =head2 transfer2
215              
216             $egs->transfer2($obj)
217              
218             =over
219              
220             (No information)
221              
222             =back
223              
224             =cut
225              
226             sub transfer2 {
227 0     0 1 0 my ($self, $obj) = @_;
228              
229 0         0 $self->{'TR2'} = $obj;
230 0         0 return $self;
231             }
232              
233             =head2 halftone
234              
235             $egs->halftone($obj)
236              
237             =over
238              
239             (No information)
240              
241             =back
242              
243             =cut
244              
245             sub halftone {
246 0     0 1 0 my ($self, $obj) = @_;
247              
248 0         0 $self->{'HT'} = $obj;
249 0         0 return $self;
250             }
251              
252             =head2 halftonephase
253              
254             $egs->halftonephase($obj)
255              
256             =over
257              
258             (No information)
259              
260             =back
261              
262             =cut
263              
264             # Per RT #113514, this was last present in version 1.2 of the PDF
265             # spec, so it can probably be removed.
266             sub halftonephase {
267 0     0 1 0 my ($self, $obj) = @_;
268              
269 0         0 $self->{'HTP'} = $obj;
270 0         0 return $self;
271             }
272              
273             =head2 smoothness
274              
275             $egs->smoothness($num)
276              
277             =over
278              
279             (No information)
280              
281             =back
282              
283             =cut
284              
285             sub smoothness {
286 0     0 1 0 my ($self, $var) = @_;
287              
288 0         0 $self->{'SM'} = PDFNum($var);
289 0         0 return $self;
290             }
291              
292             =head2 font
293              
294             $egs->font($font, $size)
295              
296             =over
297              
298             (No information)
299              
300             =back
301              
302             =cut
303              
304             sub font {
305 0     0 1 0 my ($self, $font, $size) = @_;
306              
307 0         0 $self->{'Font'} = PDFArray(PDFName($font->{' apiname'}), PDFNum($size));
308 0         0 return $self;
309             }
310              
311             =head2 linewidth
312              
313             $egs->linewidth($size)
314              
315             =over
316              
317             (No information)
318              
319             =back
320              
321             =cut
322              
323             sub linewidth {
324 0     0 1 0 my ($self, $var) = @_;
325              
326 0         0 $self->{'LW'} = PDFNum($var);
327 0         0 return $self;
328             }
329              
330             =head2 linecap
331              
332             $egs->linecap($cap)
333              
334             =over
335              
336             (No information)
337              
338             =back
339              
340             =cut
341              
342             sub linecap {
343 0     0 1 0 my ($self, $var) = @_;
344              
345 0         0 $self->{'LC'} = PDFNum($var);
346 0         0 return $self;
347             }
348              
349             =head2 linejoin
350              
351             $egs->linejoin($join)
352              
353             =over
354              
355             (No information)
356              
357             =back
358              
359             =cut
360              
361             sub linejoin {
362 0     0 1 0 my ($self, $var) = @_;
363              
364 0         0 $self->{'LJ'} = PDFNum($var);
365 0         0 return $self;
366             }
367              
368             =head2 miterlimit
369              
370             $egs->miterlimit($limit)
371              
372             =over
373              
374             (No information)
375              
376             =back
377              
378             =cut
379              
380             sub miterlimit {
381 0     0 1 0 my ($self, $var) = @_;
382              
383 0         0 $self->{'ML'} = PDFNum($var);
384 0         0 return $self;
385             }
386              
387             # Note: miterlimit was originally named incorrectly as meterlimit, renamed
388              
389             =head2 dash
390              
391             $egs->dash(@dash)
392              
393             =over
394              
395             (No information)
396              
397             =back
398              
399             =cut
400              
401             sub dash {
402 1     1 1 10 my ($self, @dash) = @_;
403              
404 1         3 $self->{'D'} = PDFArray(PDFArray( map { PDFNum($_); } @dash), PDFNum(0));
  2         5  
405 1         2 return $self;
406             }
407              
408             =head2 flatness
409              
410             $egs->flatness($flat)
411              
412             =over
413              
414             (No information)
415              
416             =back
417              
418             =cut
419              
420             sub flatness {
421 0     0 1 0 my ($self, $var) = @_;
422              
423 0         0 $self->{'FL'} = PDFNum($var);
424 0         0 return $self;
425             }
426              
427             =head2 renderingintent
428              
429             $egs->renderingintent($intentName)
430              
431             =over
432              
433             (No information)
434              
435             =back
436              
437             =cut
438              
439             sub renderingintent {
440 1     1 1 7 my ($self, $var) = @_;
441              
442 1         4 $self->{'RI'} = PDFName($var);
443 1         3 return $self;
444             }
445              
446             =head2 strokealpha
447              
448             $egs->strokealpha($alpha)
449              
450             =over
451              
452             The current stroking alpha constant, specifying the
453             constant shape or constant opacity value to be used
454             for stroking operations in the transparent imaging model.
455              
456             =back
457              
458             =cut
459              
460             sub strokealpha {
461 0     0 1   my ($self, $var) = @_;
462              
463 0           $self->{'CA'} = PDFNum($var);
464 0           return $self;
465             }
466              
467             =head2 fillalpha
468              
469             $egs->fillalpha($alpha)
470              
471             =over
472              
473             Same as strokealpha, but for nonstroking (fill) operations.
474              
475             =back
476              
477             =cut
478              
479             sub fillalpha {
480 0     0 1   my ($self, $var) = @_;
481              
482 0           $self->{'ca'} = PDFNum($var);
483 0           return $self;
484             }
485              
486             =head2 blendmode
487              
488             $egs->blendmode($blendname)
489              
490             $egs->blendmode($blendfunctionobj)
491              
492             =over
493              
494             The current blend mode to be used in the transparent imaging model.
495              
496             =back
497              
498             =cut
499              
500             sub blendmode {
501 0     0 1   my ($self, $var) = @_;
502              
503 0 0         if (ref($var)) {
504 0           $self->{'BM'} = $var;
505             } else {
506 0           $self->{'BM'} = PDFName($var);
507             }
508 0           return $self;
509             }
510              
511             =head2 alphaisshape
512              
513             $egs->alphaisshape($boolean)
514              
515             =over
516              
517             The alpha source flag (alpha is shape), specifying
518             whether the current soft mask and alpha constant
519             are to be interpreted as shape values (I<true>) or
520             opacity values (I<false>).
521              
522             =back
523              
524             =cut
525              
526             sub alphaisshape {
527 0     0 1   my ($self, $var) = @_;
528              
529 0           $self->{'AIS'} = PDFBool($var);
530 0           return $self;
531             }
532              
533             =head2 textknockout
534              
535             $egs->textknockout($boolean)
536              
537             =over
538              
539             The text knockout flag, which determines the behavior
540             of overlapping glyphs within a text object in the
541             transparent imaging model.
542              
543             =back
544              
545             =cut
546              
547             sub textknockout {
548 0     0 1   my ($self, $var) = @_;
549              
550 0           $self->{'TK'} = PDFBool($var);
551 0           return $self;
552             }
553              
554             =head2 transparency
555              
556             $egs->transparency($t)
557              
558             =over
559              
560             The graphics transparency, with 0 being fully opaque and 1 being fully
561             transparent. This is a convenience method, setting proper values for
562             C<strokealpha> and C<fillalpha>.
563              
564             =back
565              
566             =cut
567              
568             sub transparency {
569 0     0 1   my ($self, $t) = @_;
570              
571 0           $self->strokealpha(1-$t);
572 0           $self->fillalpha(1-$t);
573 0           return $self;
574             }
575              
576             =head2 opacity
577              
578             $egs->opacity($op)
579              
580             =over
581              
582             The graphics opacity, with 1 being fully opaque and 0 being fully transparent.
583             This is a convenience method, setting proper values for C<strokealpha> and
584             C<fillalpha>.
585              
586             =back
587              
588             =cut
589              
590             sub opacity {
591 0     0 1   my ($self, $var) = @_;
592              
593 0           $self->strokealpha($var);
594 0           $self->fillalpha($var);
595 0           return $self;
596             }
597              
598             #sub outobjdeep {
599             # my ($self, @opts) = @_;
600             #
601             # foreach my $k (qw/ api apipdf /) {
602             # $self->{" $k"} = undef;
603             # delete($self->{" $k"});
604             # }
605             # return $self->SUPER::outobjdeep(@opts);
606             #}
607              
608             1;