| PDF-API2 documentation | Contained in the PDF-API2 distribution. |
PDF::API2::Resource::XObject::Image
Returns a image-resource object. base class for all types of bitmap-images.
Returns a image resource object. This method is different from 'new' that it needs an PDF::API2-object rather than a Text::PDF::File-object.
Alfred Reibenschuh
| PDF-API2 documentation | Contained in the PDF-API2 distribution. |
package PDF::API2::Resource::XObject::Image; our $VERSION = '2.019'; use base 'PDF::API2::Resource::XObject'; use PDF::API2::Util; use PDF::API2::Basic::PDF::Utils; no warnings qw[ deprecated recursion uninitialized ];
sub new { my ($class,$pdf,$name) = @_; my $self; $class = ref $class if ref $class; $self=$class->SUPER::new($pdf,$name); $pdf->new_obj($self) unless($self->is_obj($pdf)); $self->subtype('Image'); $self->{' apipdf'}=$pdf; return($self); }
sub new_api { my ($class,$api,@opts)=@_; my $obj=$class->new($api->{pdf},@opts); $obj->{' api'}=$api; return($obj); }
sub width { my $self = shift @_; my $x=shift @_; $self->{Width}=PDFNum($x) if(defined $x); return($self->{Width}->val); }
sub height { my $self = shift @_; my $x=shift @_; $self->{Height}=PDFNum($x) if(defined $x); return($self->{Height}->val); }
sub smask { my $self = shift @_; my $maskobj = shift @_; $self->{SMask}=$maskobj; return $self; }
sub mask { my $self = shift @_; $self->{Mask}=PDFArray(map { PDFNum($_) } @_); return $self; }
sub imask { my $self = shift @_; $self->{Mask}=shift @_; return $self; }
sub colorspace { my $self = shift @_; my $obj = shift @_; $self->{'ColorSpace'}=ref $obj ? $obj : PDFName($obj) ; return $self; }
sub filters { my $self = shift @_; $self->{Filter}=PDFArray(map { ref($_) ? $_ : PDFName($_) } @_); return $self; }
sub bpc { my $self = shift @_; $self->{BitsPerComponent}=PDFNum(shift @_); return $self; } sub outobjdeep { my ($self, @opts) = @_; foreach my $k (qw/ api apipdf /) { $self->{" $k"}=undef; delete($self->{" $k"}); } $self->SUPER::outobjdeep(@opts); } 1; __END__