line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Builder::Resource::ColorSpace::Indexed::WebColor; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
907
|
use base 'PDF::Builder::Resource::ColorSpace::Indexed'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
500
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
34
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
99
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '3.024'; # VERSION |
9
|
|
|
|
|
|
|
our $LAST_UPDATE = '3.024'; # 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. Inherits from L |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
12
|
use PDF::Builder::Basic::PDF::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
167
|
|
18
|
2
|
|
|
2
|
|
14
|
use PDF::Builder::Util; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
246
|
|
19
|
2
|
|
|
2
|
|
13
|
use Scalar::Util qw(weaken); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
836
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
1
|
3
|
my ($class, $pdf) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
3
|
$class = ref($class) if ref($class); |
25
|
1
|
|
|
|
|
3
|
my $self = $class->SUPER::new($pdf, pdfkey()); |
26
|
1
|
50
|
|
|
|
3
|
$pdf->new_obj($self) unless $self->is_obj($pdf); |
27
|
1
|
|
|
|
|
2
|
$self->{' apipdf'} = $pdf; |
28
|
1
|
|
|
|
|
3
|
weaken $self->{' apipdf'}; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
3
|
my $csd = PDFDict(); |
31
|
1
|
|
|
|
|
4
|
$pdf->new_obj($csd); |
32
|
1
|
|
|
|
|
3
|
$csd->{'Filter'} = PDFArray(PDFName('ASCIIHexDecode')); |
33
|
|
|
|
|
|
|
#$csd->{'WhitePoint'} = PDFArray(map {PDFNum($_)} (0.95049, 1, 1.08897)); |
34
|
|
|
|
|
|
|
#$csd->{'BlackPoint'} = PDFArray(map {PDFNum($_)} (0, 0, 0)); |
35
|
|
|
|
|
|
|
#$csd->{'Gamma'} = PDFArray(map {PDFNum($_)} (2.22218, 2.22218, 2.22218)); |
36
|
1
|
|
|
|
|
2
|
$csd->{' stream'} = ''; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# 0-215 |
39
|
1
|
|
|
|
|
2
|
foreach my $r (0,0x33,0x66,0x99,0xCC,0xFF) { |
40
|
6
|
|
|
|
|
8
|
foreach my $g (0,0x33,0x66,0x99,0xCC,0xFF) { |
41
|
36
|
|
|
|
|
44
|
foreach my $b (0,0x33,0x66,0x99,0xCC,0xFF) { |
42
|
216
|
|
|
|
|
335
|
$csd->{' stream'} .= pack('CCC', $r,$g,$b); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# 216-231 |
48
|
1
|
|
|
|
|
2
|
foreach my $r (0,0x11,0x22,0x33,0x44,0x55,0x66,0x77, |
49
|
|
|
|
|
|
|
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF) { |
50
|
16
|
|
|
|
|
25
|
$csd->{' stream'} .= pack('CCC', $r,$r,$r); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# 232-247 |
54
|
1
|
|
|
|
|
1
|
foreach my $r (0,0x11,0x22,0x33,0x44,0x55,0x66,0x77, |
55
|
|
|
|
|
|
|
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF) { |
56
|
|
|
|
|
|
|
$csd->{' stream'} .= pack('CCC', |
57
|
16
|
|
|
|
|
52
|
map { $_*255 } |
|
48
|
|
|
|
|
116
|
|
58
|
|
|
|
|
|
|
namecolor('!'.sprintf('%02X', $r).'FFFF')); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# 248-255 |
62
|
1
|
|
|
|
|
2
|
foreach my $r (0,0x22,0x44,0x66,0x88,0xAA,0xCC,0xEE) { |
63
|
|
|
|
|
|
|
$csd->{' stream'} .= pack('CCC', |
64
|
8
|
|
|
|
|
27
|
map { $_*255 } |
|
24
|
|
|
|
|
59
|
|
65
|
|
|
|
|
|
|
namecolor('!'.sprintf('%02X', $r).'FF99')); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
16
|
$csd->{' stream'} .= "\x00" x 768; |
69
|
1
|
|
|
|
|
5
|
$csd->{' stream'} = substr($csd->{' stream'}, 0, 768); |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
10
|
$self->add_elements(PDFName('DeviceRGB'), PDFNum(255), $csd); |
72
|
1
|
|
|
|
|
2
|
$self->{' csd'} = $csd; |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
3
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |