| 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 <areibens@cpan.org>. | ||||||||||||||||||||
| 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: Shading.pm,v 2.0 2005/11/16 02:16:04 areibens Exp $ | ||||||||||||||||||||
| 31 | # | ||||||||||||||||||||
| 32 | #======================================================================= | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | package PDF::API3::Compat::API2::Resource::Shading; | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 1 | ▶ | BEGIN { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 39 | 1 | ▶ | use vars qw(@ISA $VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 40 | 1 | ▶ | use PDF::API3::Compat::API2::Resource; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 41 | 1 | ▶ | use PDF::API3::Compat::API2::Basic::PDF::Utils; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 42 | 1 | ▶ | use PDF::API3::Compat::API2::Util; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 43 | 1 | ▶ | use Math::Trig; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | @ISA = qw(PDF::API3::Compat::API2::Resource); | |||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 1 | ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:16:04 $ | |||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | 1 | ▶ | no warnings qw[ deprecated recursion uninitialized ]; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | =item $cs = PDF::API3::Compat::API2::Resource::Shading->new $pdf, $key, %parameters | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | Returns a new shading object. base class for all shadings. | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 59 | 0 | my ($class,$pdf,$key,%opts)=@_; | |||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 0 | ▶ | $class = ref $class if ref $class; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 62 | 0 | ▶ | $self=$class->SUPER::new($pdf,$key || pdfkey()); | ||||||||||||||||||
|
Condition0%0/3
$key || pdfkey()
MC/DC0%0/2
$key || pdfkey()
$key
pdfkey()
Truth table0%0/3
A || B
A= $keyB= pdfkey()
| |||||||||||||||||||||
| 63 | 0 | ▶ | $pdf->new_obj($self) unless($self->is_obj($pdf)); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 64 | 0 | $self->{' apipdf'}=$pdf; | |||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | # $self->{ColorSpace}=PDFName($opts{-colorspace}||'DeviceRGB'); | ||||||||||||||||||||
| 67 | # | ||||||||||||||||||||
| 68 | # $sh->{ShadingType}=PDFNum(2); | ||||||||||||||||||||
| 69 | # $sh->{Coords}=PDFArray(PDFNum(0),PDFNum(0),PDFNum(1),PDFNum(1)); | ||||||||||||||||||||
| 70 | # $sh->{Function}=PDFDict(); | ||||||||||||||||||||
| 71 | # $sh->{Function}->{FunctionType}=PDFNum(2); | ||||||||||||||||||||
| 72 | # $sh->{Function}->{Domain}=PDFArray(PDFNum(0),PDFNum(1)); | ||||||||||||||||||||
| 73 | # $sh->{Function}->{C0}=PDFArray(PDFNum(1),PDFNum(1),PDFNum(1)); | ||||||||||||||||||||
| 74 | # $sh->{Function}->{C1}=PDFArray(PDFNum(0),PDFNum(0),PDFNum(1)); | ||||||||||||||||||||
| 75 | # $sh->{Function}->{N}=PDFNum(1); | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 0 | return($self); | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | =item $cs = PDF::API3::Compat::API2::Resource::Shading->new_api $api, $name | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | Returns a shading object. This method is different from 'new' that | ||||||||||||||||||||
| 83 | it needs an PDF::API3::Compat::API2-object rather than a Text::PDF::File-object. | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | =cut | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 0 | ▶ | sub new_api { | ||||||||||||||||||
|
Subroutine
new_api: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 88 | 0 | my ($class,$api,@opts)=@_; | |||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | 0 | my $obj=$class->new($api->{pdf},@opts); | |||||||||||||||||||
| 91 | 0 | $self->{' api'}=$api; | |||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 0 | return($obj); | |||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 0 | ▶ | sub outobjdeep { | ||||||||||||||||||
|
Subroutine
outobjdeep: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 97 | 0 | my ($self, @opts) = @_; | |||||||||||||||||||
| 98 | 0 | foreach my $k (qw/ api apipdf /) { | |||||||||||||||||||
| 99 | 0 | $self->{" $k"}=undef; | |||||||||||||||||||
| 100 | 0 | delete($self->{" $k"}); | |||||||||||||||||||
| 101 | } | ||||||||||||||||||||
| 102 | 0 | $self->SUPER::outobjdeep(@opts); | |||||||||||||||||||
| 103 | } | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 1 | 1; | |||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | __END__ | ||||||||||||||||||||