| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PDF::Builder::Resource::ColorSpace::Indexed::WebColor; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1010
|
use base 'PDF::Builder::Resource::ColorSpace::Indexed'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
520
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
14
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
54
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
178
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '3.028'; # VERSION |
|
9
|
|
|
|
|
|
|
our $LAST_UPDATE = '3.027'; # manually update whenever code is changed |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
PDF::Builder::Resource::ColorSpace::Indexed::WebColor - Colorspace support for "Web Safe" Device RGB colors |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Inherits from L<PDF::Builder::Resource::ColorSpace::Indexed> |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
13
|
use PDF::Builder::Basic::PDF::Utils; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
235
|
|
|
20
|
2
|
|
|
2
|
|
13
|
use PDF::Builder::Util; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
311
|
|
|
21
|
2
|
|
|
2
|
|
15
|
use Scalar::Util qw(weaken); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1113
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
PDF::Builder::Resource::ColorSpace::Indexed::WebColor->new() |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Create a new "web-safe" indexed colorspace object. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=back |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
|
38
|
1
|
|
|
1
|
1
|
4
|
my ($class, $pdf) = @_; |
|
39
|
|
|
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
7
|
$class = ref($class) if ref($class); |
|
41
|
1
|
|
|
|
|
7
|
my $self = $class->SUPER::new($pdf, pdfkey()); |
|
42
|
1
|
50
|
|
|
|
5
|
$pdf->new_obj($self) unless $self->is_obj($pdf); |
|
43
|
1
|
|
|
|
|
5
|
$self->{' apipdf'} = $pdf; |
|
44
|
1
|
|
|
|
|
2
|
weaken $self->{' apipdf'}; |
|
45
|
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
5
|
my $csd = PDFDict(); |
|
47
|
1
|
|
|
|
|
7
|
$pdf->new_obj($csd); |
|
48
|
1
|
|
|
|
|
4
|
$csd->{'Filter'} = PDFArray(PDFName('ASCIIHexDecode')); |
|
49
|
|
|
|
|
|
|
#$csd->{'WhitePoint'} = PDFArray(map {PDFNum($_)} (0.95049, 1, 1.08897)); |
|
50
|
|
|
|
|
|
|
#$csd->{'BlackPoint'} = PDFArray(map {PDFNum($_)} (0, 0, 0)); |
|
51
|
|
|
|
|
|
|
#$csd->{'Gamma'} = PDFArray(map {PDFNum($_)} (2.22218, 2.22218, 2.22218)); |
|
52
|
1
|
|
|
|
|
3
|
$csd->{' stream'} = ''; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# 0-215 |
|
55
|
1
|
|
|
|
|
3
|
foreach my $r (0,0x33,0x66,0x99,0xCC,0xFF) { |
|
56
|
6
|
|
|
|
|
12
|
foreach my $g (0,0x33,0x66,0x99,0xCC,0xFF) { |
|
57
|
36
|
|
|
|
|
59
|
foreach my $b (0,0x33,0x66,0x99,0xCC,0xFF) { |
|
58
|
216
|
|
|
|
|
516
|
$csd->{' stream'} .= pack('CCC', $r,$g,$b); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# 216-231 |
|
64
|
1
|
|
|
|
|
4
|
foreach my $r (0,0x11,0x22,0x33,0x44,0x55,0x66,0x77, |
|
65
|
|
|
|
|
|
|
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF) { |
|
66
|
16
|
|
|
|
|
38
|
$csd->{' stream'} .= pack('CCC', $r,$r,$r); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# 232-247 |
|
70
|
1
|
|
|
|
|
3
|
foreach my $r (0,0x11,0x22,0x33,0x44,0x55,0x66,0x77, |
|
71
|
|
|
|
|
|
|
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF) { |
|
72
|
|
|
|
|
|
|
$csd->{' stream'} .= pack('CCC', |
|
73
|
16
|
|
|
|
|
67
|
map { $_*255 } |
|
|
48
|
|
|
|
|
137
|
|
|
74
|
|
|
|
|
|
|
namecolor('!'.sprintf('%02X', $r).'FFFF')); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# 248-255 |
|
78
|
1
|
|
|
|
|
4
|
foreach my $r (0,0x22,0x44,0x66,0x88,0xAA,0xCC,0xEE) { |
|
79
|
|
|
|
|
|
|
$csd->{' stream'} .= pack('CCC', |
|
80
|
8
|
|
|
|
|
30
|
map { $_*255 } |
|
|
24
|
|
|
|
|
62
|
|
|
81
|
|
|
|
|
|
|
namecolor('!'.sprintf('%02X', $r).'FF99')); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
17
|
$csd->{' stream'} .= "\x00" x 768; |
|
85
|
1
|
|
|
|
|
5
|
$csd->{' stream'} = substr($csd->{' stream'}, 0, 768); |
|
86
|
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
6
|
$self->add_elements(PDFName('DeviceRGB'), PDFNum(255), $csd); |
|
88
|
1
|
|
|
|
|
5
|
$self->{' csd'} = $csd; |
|
89
|
|
|
|
|
|
|
|
|
90
|
1
|
|
|
|
|
6
|
return $self; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |