Initial Commit
This commit is contained in:
79
database/perl/vendor/lib/Imager/File/PNG.pm
vendored
Normal file
79
database/perl/vendor/lib/Imager/File/PNG.pm
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
package Imager::File::PNG;
|
||||
use 5.006;
|
||||
use strict;
|
||||
use Imager;
|
||||
|
||||
BEGIN {
|
||||
our $VERSION = "0.95";
|
||||
|
||||
require XSLoader;
|
||||
XSLoader::load('Imager::File::PNG', $VERSION);
|
||||
}
|
||||
|
||||
Imager->register_reader
|
||||
(
|
||||
type=>'png',
|
||||
single =>
|
||||
sub {
|
||||
my ($im, $io, %hsh) = @_;
|
||||
my $flags = 0;
|
||||
$hsh{png_ignore_benign_errors}
|
||||
and $flags |= IMPNG_READ_IGNORE_BENIGN_ERRORS;
|
||||
$im->{IMG} = i_readpng_wiol($io, $flags);
|
||||
|
||||
unless ($im->{IMG}) {
|
||||
$im->_set_error(Imager->_error_as_msg);
|
||||
return;
|
||||
}
|
||||
return $im;
|
||||
},
|
||||
);
|
||||
|
||||
Imager->register_writer
|
||||
(
|
||||
type=>'png',
|
||||
single =>
|
||||
sub {
|
||||
my ($im, $io, %hsh) = @_;
|
||||
|
||||
$im->_set_opts(\%hsh, "i_", $im);
|
||||
$im->_set_opts(\%hsh, "png_", $im);
|
||||
|
||||
unless (i_writepng_wiol($im->{IMG}, $io)) {
|
||||
$im->_set_error(Imager->_error_as_msg);
|
||||
return;
|
||||
}
|
||||
return $im;
|
||||
},
|
||||
);
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Imager::File::PNG - read and write PNG files
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Imager;
|
||||
|
||||
my $img = Imager->new;
|
||||
$img->read(file=>"foo.png")
|
||||
or die $img->errstr;
|
||||
|
||||
$img->write(file => "foo.png")
|
||||
or die $img->errstr;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Imager's PNG support is documented in L<Imager::Files>.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Tony Cook <tonyc@cpan.org>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
Imager, Imager::Files.
|
||||
|
||||
=cut
|
||||
Reference in New Issue
Block a user