API2/Resource/ColorSpace.pm

filter: Statementstmt 100% 38 / 38 Branchbran 62.5% 5 / 8 Conditioncond 44.4% 4 / 9 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 10 / 10 Podpod 75.0% 3 / 4 totaltotal 81.3% 61 / 75 SCAR 21.0
CC
8
Cov
85%
new
4.3
type
3.3
name
3.0
CRAP 8.2
« API2/Basic/PDF/Array.pm ↑ Summary API2/Resource/XObject/Image.pm »
1 package PDF::API2::Resource::ColorSpace;
2  
3 2 ▶use base 'PDF::API2::Basic::PDF::Array';
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 =head1 NAME
15  
16 PDF::API2::Resource::ColorSpace - Base class for PDF color spaces
17  
18 =head1 METHODS
19  
20 =over
21  
22 =item $cs = PDF::API2::Resource::ColorSpace->new $pdf, $key, %parameters
23  
24 Returns a new colorspace object. base class for all colorspaces.
25  
26 =cut
27  
28 sub new {
29 1 ▶ my ($class, $pdf, $key) = @_;
Subroutine new: called CC=4 SCAR=14.6
Pod documented
30  
31 1 ▶ $class = ref($class) if ref($class);
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 1 1
32 1 my $self = $class->SUPER::new();
33 1 ▶ $pdf->new_obj($self) unless $self->is_obj($pdf);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_obj($pdf) 1 0 1
34 1 ▶ $self->name($key || pdfkey());
Condition33%1/3
$key || pdfkey()
l!l&&r!l&&!r
100
MC/DC0%0/2
$key || pdfkey()
$key pdfkey()
Truth table33%1/3
A || B
A= $keyB= pdfkey()
ABresult
1X1
011
000
35 1 $self->{' apipdf'} = $pdf;
36 1 weaken $self->{' apipdf'};
37  
38 1 return $self;
39 }
40  
41 =item $name = $res->name $name
42  
43 Returns or sets the Name of the resource.
44  
45 =cut
46  
47 sub name {
48 3 ▶ my $self = shift();
Subroutine name: called CC=3 SCAR=11.0
Pod documented
49 3 ▶ if (@_ and defined $_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and defined $_[0]) 1 2 3
Condition66%2/3
@_ and defined $_[0]
!ll&&!rl&&r
201
MC/DC50%1/2
@_ and defined $_[0]
@_ defined $_[0]
Truth table66%2/3
A and B
A= @_B= defined $_[0]
ABresult
0X0
100
111
50 1 $self->{' name'} = $_[0];
51 }
52 3 return $self->{' name'};
53 }
54  
55 sub type {
56 1 ▶ my $self = shift();
Subroutine type: called CC=3 SCAR=12.0
Pod undocumented
57 1 ▶ if (@_ and defined $_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and defined $_[0]) 1 0 1
Condition33%1/3
@_ and defined $_[0]
!ll&&!rl&&r
001
MC/DC0%0/2
@_ and defined $_[0]
@_ defined $_[0]
Truth table33%1/3
A and B
A= @_B= defined $_[0]
ABresult
0X0
100
111
58 1 $self->{' type'} = $_[0];
59 }
60 1 return $self->{' type'};
61 }
62  
63 =item @param = $cs->param @param
64  
65 Returns properly formatted color-parameters based on the colorspace.
66  
67 =cut
68  
69 sub param {
70 1 ▶ my $self = shift();
Subroutine param: called CC=1 SCAR=0.0
Pod documented
71 1 return @_;
72 }
73  
74 =back
75  
76 =cut
77  
78 2 1;
« API2/Basic/PDF/Array.pm ↑ Summary API2/Resource/XObject/Image.pm »