]> git.imager.perl.org - imager.git/blob - SGI/SGI.pm
b033b2dd8e13efdf3152dfc2d52bd04cc28656b6
[imager.git] / SGI / SGI.pm
1 package Imager::File::SGI;
2 use strict;
3 use Imager;
4 use vars qw($VERSION @ISA);
5
6 BEGIN {
7   $VERSION = "0.04";
8   
9   require XSLoader;
10   XSLoader::load('Imager::File::SGI', $VERSION);
11 }
12
13 Imager->register_reader
14   (
15    type=>'sgi',
16    single => 
17    sub { 
18      my ($im, $io, %hsh) = @_;
19      $im->{IMG} = i_readsgi_wiol($io, $hsh{page} || 0);
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=>'sgi',
32    single => 
33    sub { 
34      my ($im, $io, %hsh) = @_;
35
36      $im->_set_opts(\%hsh, "i_", $im);
37      $im->_set_opts(\%hsh, "sgi_", $im);
38
39      unless (i_writesgi_wiol($io, $im->{IMG})) {
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::ICO - read MS Icon files
52
53 =head1 SYNOPSIS
54
55   use Imager;
56
57   my $img = Imager->new;
58   $img->read(file=>"foo.ico")
59     or die $img->errstr;
60
61   my @imgs = Imager->read_multi(file => "foo.ico")
62     or die Imager->errstr;
63
64   $img->write(file => "foo.ico")
65     or die $img->errstr;
66
67   Imager->write_multi({ file => "foo.ico" }, @imgs)
68     or die Imager->errstr;
69
70 =head1 DESCRIPTION
71
72 Imager's MS Icon support is documented in L<Imager::Files>.
73
74 =head1 AUTHOR
75
76 Tony Cook <tonyc@cpan.org>
77
78 =head1 SEE ALSO
79
80 Imager, Imager::Files.
81
82 =cut