]> git.imager.perl.org - imager.git/blob - SGI/SGI.pm
67cc6a9babb8e2dc2a90f725a461d08b8cb2e27e
[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.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
20 Imager->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
36 Imager->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
58 Imager::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
79 Imager's MS Icon support is documented in L<Imager::Files>.
80
81 =head1 AUTHOR
82
83 Tony Cook <tony@imager.perl.org>
84
85 =head1 SEE ALSO
86
87 Imager, Imager::Files.
88
89 =cut