check Affix::Infix2Postfix is available before testing transform()
[imager.git] / SGI / SGI.pm
CommitLineData
d5477d3d
TC
1package Imager::File::SGI;
2use strict;
3use Imager;
4use vars qw($VERSION @ISA);
5
6BEGIN {
7 $VERSION = "0.01";
8
9 eval {
10 require XSLoader;
11 XSLoader::load('Imager::File::SGI', $VERSION);
12 1;
13 } or do {
14 require DynaLoader;
15 push @ISA, 'DynaLoader';
16 bootstrap Imager::File::SGI $VERSION;
17 };
18}
19
20Imager->register_reader
21 (
22 type=>'sgi',
23 single =>
24 sub {
25 my ($im, $io, %hsh) = @_;
26 $im->{IMG} = i_readsgi_wiol($io, $hsh{page} || 0);
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=>'sgi',
39 single =>
40 sub {
41 my ($im, $io, %hsh) = @_;
42
43 $im->_set_opts(\%hsh, "i_", $im);
44 $im->_set_opts(\%hsh, "sgi_", $im);
45
46 unless (i_writesgi_wiol($io, $im->{IMG})) {
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::ICO - read MS Icon files
59
60=head1 SYNOPSIS
61
62 use Imager;
63
64 my $img = Imager->new;
65 $img->read(file=>"foo.ico")
66 or die $img->errstr;
67
68 my @imgs = Imager->read_multi(file => "foo.ico")
69 or die Imager->errstr;
70
71 $img->write(file => "foo.ico")
72 or die $img->errstr;
73
74 Imager->write_multi({ file => "foo.ico" }, @imgs)
75 or die Imager->errstr;
76
77=head1 DESCRIPTION
78
79Imager's MS Icon support is documented in L<Imager::Files>.
80
81=head1 AUTHOR
82
83Tony Cook <tony@imager.perl.org>
84
85=head1 SEE ALSO
86
87Imager, Imager::Files.
88
89=cut