| 1 | package PDF::API2::Resource::ColorSpace::Indexed::WebColor; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use base 'PDF::API2::Resource::ColorSpace::Indexed'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | our $VERSION = '2.044'; # VERSION | |||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use PDF::API2::Basic::PDF::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | ▶ | use PDF::API2::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use Scalar::Util qw(weaken); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | sub new { | ||||||||||
| 15 | 1 | ▶ | my ($class, $pdf) = @_; | ||||||||
|
Subroutine
new: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | $class = ref($class) if ref($class); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | my $self = $class->SUPER::new($pdf, pdfkey()); | |||||||||
| 19 | 1 | ▶ | $pdf->new_obj($self) unless $self->is_obj($pdf); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 1 | $self->{' apipdf'} = $pdf; | |||||||||
| 21 | 1 | weaken $self->{' apipdf'}; | |||||||||
| 22 | |||||||||||
| 23 | 1 | my $csd = PDFDict(); | |||||||||
| 24 | 1 | $pdf->new_obj($csd); | |||||||||
| 25 | |||||||||||
| 26 | 1 | $csd->{'Filter'} = PDFArray(PDFName('ASCIIHexDecode')); | |||||||||
| 27 | 1 | $csd->{' stream'} = ''; | |||||||||
| 28 | |||||||||||
| 29 | # 0-215 | ||||||||||
| 30 | 1 | foreach my $r (0, 0x33, 0x66, 0x99, 0xCC, 0xFF) { | |||||||||
| 31 | 6 | foreach my $g (0, 0x33, 0x66, 0x99, 0xCC, 0xFF) { | |||||||||
| 32 | 36 | foreach my $b (0, 0x33, 0x66, 0x99, 0xCC, 0xFF) { | |||||||||
| 33 | 216 | $csd->{' stream'} .= pack('CCC', $r, $g, $b); | |||||||||
| 34 | } | ||||||||||
| 35 | } | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | # 216-231 | ||||||||||
| 39 | 1 | foreach my $r ( 0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, | |||||||||
| 40 | 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF) | ||||||||||
| 41 | { | ||||||||||
| 42 | 16 | $csd->{' stream'} .= pack('CCC', $r, $r, $r); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | # 232-247 | ||||||||||
| 46 | 1 | foreach my $r ( 0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, | |||||||||
| 47 | 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF) | ||||||||||
| 48 | { | ||||||||||
| 49 | $csd->{' stream'} .= pack('CCC', | ||||||||||
| 50 | 16 | map { $_ * 255 } | |||||||||
| 51 | namecolor('!' . sprintf('%02X', $r) . 'FFFF')); | ||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | # 248-255 | ||||||||||
| 55 | 1 | foreach my $r (0, 0x22, 0x44, 0x66, 0x88, 0xAA, 0xCC, 0xEE) { | |||||||||
| 56 | $csd->{' stream'} .= pack('CCC', | ||||||||||
| 57 | 8 | map { $_ * 255 } | |||||||||
| 58 | namecolor('!' . sprintf('%02X', $r) . 'FF99')); | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 1 | $csd->{' stream'} .= "\x00" x 768; | |||||||||
| 62 | 1 | $csd->{' stream'} = substr($csd->{' stream'}, 0, 768); | |||||||||
| 63 | |||||||||||
| 64 | 1 | $self->add_elements(PDFName('DeviceRGB'), PDFNum(255), $csd); | |||||||||
| 65 | 1 | $self->{' csd'} = $csd; | |||||||||
| 66 | |||||||||||
| 67 | 1 | return $self; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 2 | 1; | |||||||||