Builder/Resource/ColorSpace/Indexed/Hue.pm

filter: Statementstmt 48.8% 21 / 43 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 50.9% 28 / 55 CC 6 SCAR 30.7
CC
6
Cov
45%
new
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 21.5
« Builder/Page.pm ↑ Summary Builder/Resource/BaseFont.pm »
1 package PDF::Builder::Resource::ColorSpace::Indexed::Hue;
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::Hue - Colorspace support for Device RGB
18  
19 Inherits from L<PDF::Builder::Resource::ColorSpace::Indexed>
20  
21 =head1 METHODS
22  
23 =head2 new
24  
25 =over
26  
27 Create a new Indexed Hue colorspace object.
28  
29 =back
30  
31 =cut
32  
33 0 ▶sub new {
Subroutine new: not called CC=6 SCAR=37.4
Pod documented
34 0 my ($class, $pdf) = @_;
35  
36 0 ▶ $class = ref($class) if ref($class);
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
37 0 my $self = $class->SUPER::new($pdf, pdfkey());
38 0 ▶ $pdf->new_obj($self) unless $self->is_obj($pdf);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_obj($pdf) 0 0 0
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 %cc;
46 0 my $stream = '';
47  
48 0 foreach my $s (4,3,2,1) {
49 0 foreach my $v (4,3) {
50 0 foreach my $r (0..31) {
51 $stream .= pack('CCC',
52 0 map { $_*255 }
53 namecolor(join('',
54 '!',
55 sprintf('%02X', $r*255/31),
56 sprintf('%02X', $s*255/4),
57 sprintf('%02X', $v*255/4))));
58 }
59 }
60 }
61  
62 0 $stream .= "\x00" x 768;
63 0 $stream = substr($stream, 0, 768);
64 0 $csd->{' stream'} = $stream;
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/Page.pm ↑ Summary Builder/Resource/BaseFont.pm »