| 1 | package PDF::Builder::Resource::ColorSpace; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use base 'PDF::Builder::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 = '3.028'; # VERSION | |||||||||||||||||||
| 9 | 2 | our $LAST_UPDATE = '3.027'; # manually update whenever code is changed | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | ▶ | use PDF::Builder::Basic::PDF::Utils; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 2 | ▶ | use PDF::Builder::Util; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 2 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | PDF::Builder::Resource::ColorSpace - Base class for PDF color spaces | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | Inherits from L<PDF::Builder::Basic::PDF::Array> | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | =head1 METHODS | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | =head2 new | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | $cs = PDF::Builder::Resource::ColorSpace->new($pdf, $key, %opts) | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | =over | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | Returns a new colorspace object, base class for all colorspaces. | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | =back | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | =cut | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||
| 36 | 1 | my ($class, $pdf, $key, %opts) = @_; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 1 | ▶ | $class = ref($class) if ref($class); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | 1 | my $self = $class->SUPER::new(); | |||||||||||||||||||
| 40 | 1 | ▶ | $pdf->new_obj($self) unless $self->is_obj($pdf); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 41 | 1 | ▶ | $self->name($key || pdfkey()); | ||||||||||||||||||
|
Condition33%1/3
$key || pdfkey()
MC/DC0%0/2
$key || pdfkey()
$key
pdfkey()
Truth table33%1/3
A || B
A= $keyB= pdfkey()
| |||||||||||||||||||||
| 42 | 1 | $self->{' apipdf'} = $pdf; | |||||||||||||||||||
| 43 | 1 | weaken $self->{' apipdf'}; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | return $self; | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | =head2 name | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | $name = $res->name($name) # Set | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | $name = $res->name() # Get | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | =over | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | Returns or sets the Name of the resource. | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | =back | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | =cut | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 3 | ▶ | sub name { | ||||||||||||||||||
|
Subroutine
name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 63 | 3 | my ($self, $name) = @_; | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 3 | ▶ | if (defined $name) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 66 | 1 | $self->{' name'} = $name; | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | 3 | return $self->{' name'}; | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 1 | ▶ | sub type { | ||||||||||||||||||
|
Subroutine
type: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 72 | 1 | my ($self, $type) = @_; | |||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 1 | ▶ | if (defined $type) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 75 | 1 | $self->{' type'} = $type; | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | 1 | return $self->{' type'}; | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | =head2 param | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | @param = $cs->param(@param) | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | =over | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | Returns properly formatted color-parameters based on the colorspace. | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | =back | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | 0 | ▶ | sub param { | ||||||||||||||||||
|
Subroutine
param: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 93 | 0 | my $self = shift; | |||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 0 | return @_; | |||||||||||||||||||
| 96 | } | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | #sub outobjdeep { | ||||||||||||||||||||
| 99 | # my ($self, @opts) = @_; | ||||||||||||||||||||
| 100 | # | ||||||||||||||||||||
| 101 | # foreach my $k (qw/ api apipdf /) { | ||||||||||||||||||||
| 102 | # $self->{" $k"} = undef; | ||||||||||||||||||||
| 103 | # delete($self->{" $k"}); | ||||||||||||||||||||
| 104 | # } | ||||||||||||||||||||
| 105 | # return $self->SUPER::outobjdeep(@opts); | ||||||||||||||||||||
| 106 | #} | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | 2 | 1; | |||||||||||||||||||