File Coverage

blib/lib/PDF/API3/Compat/API2/Resource/ColorSpace.pm
Criterion Covered Total %
statement 23 49 46.9
branch 0 8 0.0
condition 0 9 0.0
subroutine 8 14 57.1
pod 5 6 83.3
total 36 86 41.8


line stmt bran cond sub pod time code
1             #=======================================================================
2             # ____ ____ _____ _ ____ ___ ____
3             # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4             # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5             # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6             # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7             #
8             # A Perl Module Chain to faciliate the Creation and Modification
9             # of High-Quality "Portable Document Format (PDF)" Files.
10             #
11             # Copyright 1999-2005 Alfred Reibenschuh .
12             #
13             #=======================================================================
14             #
15             # This library is free software; you can redistribute it and/or
16             # modify it under the terms of the GNU Lesser General Public
17             # License as published by the Free Software Foundation; either
18             # version 2 of the License, or (at your option) any later version.
19             #
20             # This library is distributed in the hope that it will be useful,
21             # but WITHOUT ANY WARRANTY; without even the implied warranty of
22             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23             # Lesser General Public License for more details.
24             #
25             # You should have received a copy of the GNU Lesser General Public
26             # License along with this library; if not, write to the
27             # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28             # Boston, MA 02111-1307, USA.
29             #
30             # $Id: ColorSpace.pm,v 2.0 2005/11/16 02:16:04 areibens Exp $
31             #
32             #=======================================================================
33            
34             package PDF::API3::Compat::API2::Resource::ColorSpace;
35            
36             BEGIN {
37            
38 1     1   10 use strict;
  1         3  
  1         43  
39 1     1   6 use vars qw(@ISA $VERSION);
  1         2  
  1         59  
40 1     1   6 use PDF::API3::Compat::API2::Basic::PDF::Array;
  1         4  
  1         32  
41 1     1   7 use PDF::API3::Compat::API2::Basic::PDF::Utils;
  1         3  
  1         169  
42 1     1   7 use PDF::API3::Compat::API2::Util;
  1         5  
  1         230  
43 1     1   7 use Math::Trig;
  1         3  
  1         361  
44            
45 1     1   21 @ISA = qw(PDF::API3::Compat::API2::Basic::PDF::Array);
46            
47 1         42 ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:16:04 $
48            
49             }
50 1     1   9 no warnings qw[ deprecated recursion uninitialized ];
  1         3  
  1         987  
51            
52             =item $cs = PDF::API3::Compat::API2::Resource::ColorSpace->new $pdf, $key, %parameters
53            
54             Returns a new colorspace object. base class for all colorspaces.
55            
56             =cut
57            
58             sub new {
59 0     0 1   my ($class,$pdf,$key,%opts)=@_;
60            
61 0 0         $class = ref $class if ref $class;
62 0           $self=$class->SUPER::new();
63 0 0         $pdf->new_obj($self) unless($self->is_obj($pdf));
64 0   0       $self->name($key || pdfkey());
65 0           $self->{' apipdf'}=$pdf;
66            
67 0           return($self);
68             }
69            
70             =item $cs = PDF::API3::Compat::API2::Resource::ColorSpace->new_api $api, $name
71            
72             Returns a color-space object. This method is different from 'new' that
73             it needs an PDF::API3::Compat::API2-object rather than a Text::PDF::File-object.
74            
75             =cut
76            
77             sub new_api {
78 0     0 1   my ($class,$api,@opts)=@_;
79            
80 0           my $obj=$class->new($api->{pdf},@opts);
81 0           $self->{' api'}=$api;
82            
83 0           return($obj);
84             }
85            
86             =item $name = $res->name $name
87            
88             Returns or sets the Name of the resource.
89            
90             =cut
91            
92             sub name {
93 0     0 1   my $self=shift @_;
94 0 0 0       if(scalar @_ >0 && defined($_[0])) {
95 0           $self->{' name'}=$_[0];
96             }
97 0           return($self->{' name'});
98             }
99             sub type {
100 0     0 0   my $self=shift @_;
101 0 0 0       if(scalar @_ >0 && defined($_[0])) {
102 0           $self->{' type'}=$_[0];
103             }
104 0           return($self->{' type'});
105             }
106            
107             =item @param = $cs->param @param
108            
109             Returns properly formatted color-parameters based on the colorspace.
110            
111             =cut
112            
113             sub param {
114 0     0 1   my $self=shift @_;
115 0           return(@_);
116             }
117            
118             sub outobjdeep {
119 0     0 1   my ($self, @opts) = @_;
120 0           foreach my $k (qw/ api apipdf /) {
121 0           $self->{" $k"}=undef;
122 0           delete($self->{" $k"});
123             }
124 0           $self->SUPER::outobjdeep(@opts);
125             }
126            
127             1;
128            
129             __END__