]> git.imager.perl.org - imager.git/blob - PNG/PNG.pm
allow freetype-config to be found on cygwin
[imager.git] / PNG / PNG.pm
1 package Imager::File::PNG;
2 use strict;
3 use Imager;
4 use vars qw($VERSION @ISA);
5
6 BEGIN {
7   $VERSION = "0.85";
8
9   require XSLoader;
10   XSLoader::load('Imager::File::PNG', $VERSION);
11 }
12
13 Imager->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
29 Imager->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
51 Imager::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
66 Imager's PNG support is documented in L<Imager::Files>.
67
68 =head1 AUTHOR
69
70 Tony Cook <tonyc@cpan.org>
71
72 =head1 SEE ALSO
73
74 Imager, Imager::Files.
75
76 =cut