| 1 | package PDF::API2::Resource::ColorSpace::Indexed::ACTFile; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use base 'PDF::API2::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 = '2.044'; # VERSION | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use PDF::API2::Basic::PDF::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use PDF::API2::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use Scalar::Util qw(weaken); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | =head1 NAME | ||||||||||
| 15 | |||||||||||
| 16 | PDF::API2::Resource::ColorSpace::Indexed::ACTFile - Adobe Color Table support | ||||||||||
| 17 | |||||||||||
| 18 | =head1 METHODS | ||||||||||
| 19 | |||||||||||
| 20 | =over | ||||||||||
| 21 | |||||||||||
| 22 | =item $cs = PDF::API2::Resource::ColorSpace::Indexed::ACTFile->new $pdf, $actfile | ||||||||||
| 23 | |||||||||||
| 24 | Returns a new colorspace object created from an adobe color table file (ACT/8BCT). | ||||||||||
| 25 | See | ||||||||||
| 26 | Adobe Photoshop(R) 6.0 -- | ||||||||||
| 27 | File Formats Specification Version 6.0 Release 2, | ||||||||||
| 28 | November 2000 | ||||||||||
| 29 | for details. | ||||||||||
| 30 | |||||||||||
| 31 | =cut | ||||||||||
| 32 | |||||||||||
| 33 | sub new { | ||||||||||
| 34 | 0 | ▶ | my ($class, $pdf, $file) = @_; | ||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 35 | 0 | ▶ | die "could not find act-file '$file'." unless -f $file; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | ▶ | $class = ref($class) if ref($class); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | my $self = $class->SUPER::new($pdf, pdfkey()); | |||||||||
| 38 | 0 | ▶ | $pdf->new_obj($self) unless $self->is_obj($pdf); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | $self->{' apipdf'} = $pdf; | |||||||||
| 40 | 0 | weaken $self->{' apipdf'}; | |||||||||
| 41 | 0 | my $csd = PDFDict(); | |||||||||
| 42 | 0 | $pdf->new_obj($csd); | |||||||||
| 43 | 0 | $csd->{'Filter'} = PDFArray(PDFName('FlateDecode')); | |||||||||
| 44 | |||||||||||
| 45 | 0 | my $fh; | |||||||||
| 46 | 0 | ▶ | open($fh, "<", $file) or die "$!: $file"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | binmode($fh, ':raw'); | |||||||||
| 48 | 0 | read($fh, $csd->{' stream'}, 768); | |||||||||
| 49 | 0 | close($fh); | |||||||||
| 50 | |||||||||||
| 51 | 0 | $csd->{' stream'} .= "\x00" x 768; | |||||||||
| 52 | 0 | $csd->{' stream'} = substr($csd->{' stream'}, 0, 768); | |||||||||
| 53 | |||||||||||
| 54 | 0 | $self->add_elements(PDFName('DeviceRGB'), PDFNum(255), $csd); | |||||||||
| 55 | 0 | $self->{' csd'} = $csd; | |||||||||
| 56 | |||||||||||
| 57 | 0 | return $self; | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | =back | ||||||||||
| 61 | |||||||||||
| 62 | =cut | ||||||||||
| 63 | |||||||||||
| 64 | 1 | 1; | |||||||||