Builder/Resource/ColorSpace/Indexed/ACTFile.pm

filter: Statementstmt 51.2% 21 / 41 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 49.1% 28 / 57 CC 5 SCAR 26.5
CC
5
Cov
43%
new
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 14.2
« Builder/Resource/XObject/Form/BarCode/code128.pm ↑ Summary Builder/Basic/PDF/Filter/ASCII85Decode.pm »
1 package PDF::Builder::Resource::ColorSpace::Indexed::ACTFile;
2  
3 1 ▶use base 'PDF::Builder::Resource::ColorSpace::Indexed';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '3.028'; # VERSION
9 1 our $LAST_UPDATE = '3.027'; # manually update whenever code is changed
10  
11 1 ▶use PDF::Builder::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use PDF::Builder::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =head1 NAME
16  
17 PDF::Builder::Resource::ColorSpace::Indexed::ACTFile - Adobe Color Table support
18  
19 Inherits from L<PDF::Builder::Resource::ColorSpace::Indexed>
20  
21 =head1 METHODS
22  
23 =head2 new
24  
25 $cs = PDF::Builder::Resource::ColorSpace::Indexed::ACTFile->new($pdf, $actfile)
26  
27 =over
28  
29 Returns a new colorspace object created from an Adobe color table file (ACT/8BCT).
30 See
31 Adobe Photoshop(R) 6.0 --
32 File Formats Specification Version 6.0 Release 2,
33 November 2000
34 for details.
35  
36 =back
37  
38 =cut
39  
40 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
41 0 my ($class, $pdf, $file) = @_;
42  
43 0 ▶ die "could not find act-file '$file'." unless -f $file;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $file 0 0 0
44 0 ▶ $class = ref($class) if ref($class);
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
45 0 my $self = $class->SUPER::new($pdf, pdfkey());
46 0 ▶ $pdf->new_obj($self) unless $self->is_obj($pdf);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_obj($pdf) 0 0 0
47 0 $self->{' apipdf'} = $pdf;
48 0 weaken $self->{' apipdf'};
49 0 my $csd = PDFDict();
50 0 $pdf->new_obj($csd);
51 0 $csd->{'Filter'} = PDFArray(PDFName('FlateDecode'));
52 # default values in case file is missing or bad??
53 #$csd->{'WhitePoint'} = PDFArray(map {PDFNum($_)} (0.95049, 1, 1.08897));
54 #$csd->{'BlackPoint'} = PDFArray(map {PDFNum($_)} (0, 0, 0));
55 #$csd->{'Gamma'} = PDFArray(map {PDFNum($_)} (2.22218, 2.22218, 2.22218));
56  
57 0 my $fh;
58 0 ▶ open($fh, "<", $file) or die "$!: $file";
Branch: 1 branch
BranchTrueFalseTotal
open $fh, "<", $file or die "$!: $file" 0 0 0
59 0 binmode($fh, ':raw');
60 0 read($fh, $csd->{' stream'}, 768);
61 0 close($fh);
62  
63 0 $csd->{' stream'} .= "\x00" x 768;
64 0 $csd->{' stream'} = substr($csd->{' stream'}, 0, 768);
65  
66 0 $self->add_elements(PDFName('DeviceRGB'), PDFNum(255), $csd);
67 0 $self->{' csd'} = $csd;
68  
69 0 return $self;
70 }
71  
72 1 1;
« Builder/Resource/XObject/Form/BarCode/code128.pm ↑ Summary Builder/Basic/PDF/Filter/ASCII85Decode.pm »