1 package Imager::File::ICO;
4 use vars qw($VERSION @ISA);
11 XSLoader::load('Imager::File::ICO', $VERSION);
15 push @ISA, 'DynaLoader';
16 bootstrap Imager::File::ICO $VERSION;
20 Imager->register_reader
25 my ($im, $io, %hsh) = @_;
26 $im->{IMG} = i_readico_single($io, $hsh{page} || 0);
29 $im->_set_error(Imager->_error_as_msg);
38 my @imgs = i_readico_multi($io);
40 Imager->_set_error(Imager->_error_as_msg);
44 bless { IMG => $_, DEBUG => $Imager::DEBUG, ERRSTR => undef }, 'Imager'
49 # the readers can read CUR files too
50 Imager->register_reader
55 my ($im, $io, %hsh) = @_;
56 $im->{IMG} = i_readico_single($io, $hsh{page} || 0);
59 $im->_set_error(Imager->_error_as_msg);
68 my @imgs = i_readico_multi($io);
70 Imager->_set_error(Imager->_error_as_msg);
74 bless { IMG => $_, DEBUG => $Imager::DEBUG, ERRSTR => undef }, 'Imager'
79 Imager->register_writer
84 my ($im, $io, %hsh) = @_;
86 unless (i_writeico_wiol($io, $im->{IMG})) {
87 $im->_set_error(Imager->_error_as_msg);
94 my ($class, $io, $opts, @images) = @_;
96 if (!i_writeico_multi_wiol($io, map $_->{IMG}, @images)) {
97 Imager->_set_error(Imager->_error_as_msg);
105 Imager->register_writer
110 my ($im, $io, %hsh) = @_;
112 unless (i_writecur_wiol($io, $im->{IMG})) {
113 $im->_set_error(Imager->_error_as_msg);
120 my ($class, $io, $opts, @images) = @_;
122 if (!i_writecur_multi_wiol($io, map $_->{IMG}, @images)) {
123 Imager->_set_error(Imager->_error_as_msg);
137 Imager::File::ICO - read MS Icon files
143 my $img = Imager->new;
144 $img->read(file=>"foo.ico")
147 my @imgs = Imager->read_multi(file => "foo.ico")
148 or die Imager->errstr;
150 $img->write(file => "foo.ico")
153 Imager->write_multi({ file => "foo.ico" }, @imgs)
154 or die Imager->errstr;
158 Imager's MS Icon support is documented in L<Imager::Files>.
162 Tony Cook <tony@imager.perl.org>
166 Imager, Imager::Files.