update desired debian packages
[imager.git] / PNG / PNG.pm
CommitLineData
1d7e3124
TC
1package Imager::File::PNG;
2use strict;
3use Imager;
4use vars qw($VERSION @ISA);
5
6BEGIN {
572d5255 7 $VERSION = "0.94";
a5919365
TC
8
9 require XSLoader;
10 XSLoader::load('Imager::File::PNG', $VERSION);
1d7e3124
TC
11}
12
13Imager->register_reader
14 (
15 type=>'png',
16 single =>
17 sub {
18 my ($im, $io, %hsh) = @_;
57520a19
TC
19 my $flags = 0;
20 $hsh{png_ignore_benign_errors}
21 and $flags |= IMPNG_READ_IGNORE_BENIGN_ERRORS;
22 $im->{IMG} = i_readpng_wiol($io, $flags);
1d7e3124
TC
23
24 unless ($im->{IMG}) {
25 $im->_set_error(Imager->_error_as_msg);
26 return;
27 }
28 return $im;
29 },
30 );
31
32Imager->register_writer
33 (
34 type=>'png',
35 single =>
36 sub {
37 my ($im, $io, %hsh) = @_;
38
39 $im->_set_opts(\%hsh, "i_", $im);
40 $im->_set_opts(\%hsh, "png_", $im);
41
42 unless (i_writepng_wiol($im->{IMG}, $io)) {
43 $im->_set_error(Imager->_error_as_msg);
44 return;
45 }
46 return $im;
47 },
48 );
49
50__END__
51
52=head1 NAME
53
54Imager::File::PNG - read and write PNG files
55
56=head1 SYNOPSIS
57
58 use Imager;
59
60 my $img = Imager->new;
61 $img->read(file=>"foo.png")
62 or die $img->errstr;
63
64 $img->write(file => "foo.png")
65 or die $img->errstr;
66
67=head1 DESCRIPTION
68
69Imager's PNG support is documented in L<Imager::Files>.
70
71=head1 AUTHOR
72
5b480b14 73Tony Cook <tonyc@cpan.org>
1d7e3124
TC
74
75=head1 SEE ALSO
76
77Imager, Imager::Files.
78
79=cut