]> git.imager.perl.org - imager.git/blame - PNG/PNG.pm
mark mm_log() for the API with the right gcc -Wformat magic
[imager.git] / PNG / PNG.pm
CommitLineData
1d7e3124
TC
1package Imager::File::PNG;
2use strict;
3use Imager;
4use vars qw($VERSION @ISA);
5
6BEGIN {
0953e1cf 7 $VERSION = "0.87";
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) = @_;
19 $im->{IMG} = i_readpng_wiol($io);
20
21 unless ($im->{IMG}) {
22 $im->_set_error(Imager->_error_as_msg);
23 return;
24 }
25 return $im;
26 },
27 );
28
29Imager->register_writer
30 (
31 type=>'png',
32 single =>
33 sub {
34 my ($im, $io, %hsh) = @_;
35
36 $im->_set_opts(\%hsh, "i_", $im);
37 $im->_set_opts(\%hsh, "png_", $im);
38
39 unless (i_writepng_wiol($im->{IMG}, $io)) {
40 $im->_set_error(Imager->_error_as_msg);
41 return;
42 }
43 return $im;
44 },
45 );
46
47__END__
48
49=head1 NAME
50
51Imager::File::PNG - read and write PNG files
52
53=head1 SYNOPSIS
54
55 use Imager;
56
57 my $img = Imager->new;
58 $img->read(file=>"foo.png")
59 or die $img->errstr;
60
61 $img->write(file => "foo.png")
62 or die $img->errstr;
63
64=head1 DESCRIPTION
65
66Imager's PNG support is documented in L<Imager::Files>.
67
68=head1 AUTHOR
69
5b480b14 70Tony Cook <tonyc@cpan.org>
1d7e3124
TC
71
72=head1 SEE ALSO
73
74Imager, Imager::Files.
75
76=cut