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