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: Image.pm,v 2.0 2005/11/16 02:18:23 areibens Exp $
|
31
|
|
|
|
|
|
|
#
|
32
|
|
|
|
|
|
|
#=======================================================================
|
33
|
|
|
|
|
|
|
package PDF::API3::Compat::API2::Resource::XObject::Image;
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
BEGIN {
|
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
5
|
use PDF::API3::Compat::API2::Util;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
180
|
|
38
|
1
|
|
|
1
|
|
8
|
use PDF::API3::Compat::API2::Basic::PDF::Utils;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
118
|
|
39
|
1
|
|
|
1
|
|
604
|
use PDF::API3::Compat::API2::Resource::XObject;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
6
|
use POSIX;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
42
|
1
|
|
|
1
|
|
2563
|
use Compress::Zlib;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
396
|
|
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
7
|
use vars qw(@ISA $VERSION);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
128
|
|
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
21
|
@ISA = qw( PDF::API3::Compat::API2::Resource::XObject );
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
32
|
( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:18:23 $
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
}
|
51
|
1
|
|
|
1
|
|
6
|
no warnings qw[ deprecated recursion uninitialized ];
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
707
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item $res = PDF::API3::Compat::API2::Resource::XObject::Image->new $pdf, $name
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Returns a image-resource object. base class for all types of bitmap-images.
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new {
|
60
|
0
|
|
|
0
|
1
|
|
my ($class,$pdf,$name) = @_;
|
61
|
0
|
|
|
|
|
|
my $self;
|
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class;
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self=$class->SUPER::new($pdf,$name);
|
66
|
0
|
0
|
|
|
|
|
$pdf->new_obj($self) unless($self->is_obj($pdf));
|
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$self->subtype('Image');
|
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$self->{' apipdf'}=$pdf;
|
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return($self);
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item $res = PDF::API3::Compat::API2::Resource::XObject::Image->new_api $api, $name
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns a image resource object. This method is different from 'new' that
|
78
|
|
|
|
|
|
|
it needs an PDF::API3::Compat::API2-object rather than a Text::PDF::File-object.
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub new_api {
|
83
|
0
|
|
|
0
|
1
|
|
my ($class,$api,@opts)=@_;
|
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
my $obj=$class->new($api->{pdf},@opts);
|
86
|
0
|
|
|
|
|
|
$obj->{' api'}=$api;
|
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return($obj);
|
89
|
|
|
|
|
|
|
}
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item $wd = $img->width
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub width {
|
96
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
97
|
0
|
|
|
|
|
|
my $x=shift @_;
|
98
|
0
|
0
|
|
|
|
|
$self->{Width}=PDFNum($x) if(defined $x);
|
99
|
0
|
|
|
|
|
|
return($self->{Width}->val);
|
100
|
|
|
|
|
|
|
}
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item $ht = $img->height
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub height {
|
107
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
108
|
0
|
|
|
|
|
|
my $x=shift @_;
|
109
|
0
|
0
|
|
|
|
|
$self->{Height}=PDFNum($x) if(defined $x);
|
110
|
0
|
|
|
|
|
|
return($self->{Height}->val);
|
111
|
|
|
|
|
|
|
}
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item $img->smask $smaskobj
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub smask {
|
118
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
119
|
0
|
|
|
|
|
|
my $maskobj = shift @_;
|
120
|
0
|
|
|
|
|
|
$self->{SMask}=$maskobj;
|
121
|
0
|
|
|
|
|
|
return $self;
|
122
|
|
|
|
|
|
|
}
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item $img->mask @maskcolorange
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub mask {
|
129
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
130
|
0
|
|
|
|
|
|
$self->{Mask}=PDFArray(map { PDFNum($_) } @_);
|
|
0
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
return $self;
|
132
|
|
|
|
|
|
|
}
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item $img->imask $maskobj
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub imask {
|
139
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
140
|
0
|
|
|
|
|
|
$self->{Mask}=shift @_;
|
141
|
0
|
|
|
|
|
|
return $self;
|
142
|
|
|
|
|
|
|
}
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item $img->colorspace $csobj
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub colorspace {
|
149
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
150
|
0
|
|
|
|
|
|
my $obj = shift @_;
|
151
|
0
|
0
|
|
|
|
|
$self->{'ColorSpace'}=ref $obj ? $obj : PDFName($obj) ;
|
152
|
0
|
|
|
|
|
|
return $self;
|
153
|
|
|
|
|
|
|
}
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item $img->filters @filternames
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub filters {
|
160
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
161
|
0
|
0
|
|
|
|
|
$self->{Filter}=PDFArray(map { ref($_) ? $_ : PDFName($_) } @_);
|
|
0
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
return $self;
|
163
|
|
|
|
|
|
|
}
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item $img->bpc $num
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub bpc {
|
170
|
0
|
|
|
0
|
1
|
|
my $self = shift @_;
|
171
|
0
|
|
|
|
|
|
$self->{BitsPerComponent}=PDFNum(shift @_);
|
172
|
0
|
|
|
|
|
|
return $self;
|
173
|
|
|
|
|
|
|
}
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub outobjdeep {
|
176
|
0
|
|
|
0
|
1
|
|
my ($self, @opts) = @_;
|
177
|
0
|
|
|
|
|
|
foreach my $k (qw/ api apipdf /) {
|
178
|
0
|
|
|
|
|
|
$self->{" $k"}=undef;
|
179
|
0
|
|
|
|
|
|
delete($self->{" $k"});
|
180
|
|
|
|
|
|
|
}
|
181
|
0
|
|
|
|
|
|
$self->SUPER::outobjdeep(@opts);
|
182
|
|
|
|
|
|
|
}
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
1;
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
__END__
|