line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Imager::File::QOI; |
2
|
2
|
|
|
2
|
|
20972
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
47
|
|
3
|
2
|
|
|
2
|
|
9
|
use Imager; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
4
|
2
|
|
|
2
|
|
80
|
use vars qw($VERSION @ISA); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
122
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
BEGIN { |
7
|
2
|
|
|
2
|
|
6
|
$VERSION = "0.010"; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
|
|
6
|
require XSLoader; |
10
|
2
|
|
|
|
|
1418
|
XSLoader::load('Imager::File::QOI', $VERSION); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Imager->register_reader |
14
|
|
|
|
|
|
|
( |
15
|
|
|
|
|
|
|
type=>'qoi', |
16
|
|
|
|
|
|
|
single => |
17
|
|
|
|
|
|
|
sub { |
18
|
|
|
|
|
|
|
my ($im, $io, %hsh) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $page = $hsh{page}; |
21
|
|
|
|
|
|
|
defined $page or $page = 0; |
22
|
|
|
|
|
|
|
$im->{IMG} = i_readqoi($io, $page); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
unless ($im->{IMG}) { |
25
|
|
|
|
|
|
|
$im->_set_error(Imager->_error_as_msg); |
26
|
|
|
|
|
|
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $im; |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
multiple => |
32
|
|
|
|
|
|
|
sub { |
33
|
|
|
|
|
|
|
my ($io, %hsh) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @imgs = i_readqoi_multi($io); |
36
|
|
|
|
|
|
|
unless (@imgs) { |
37
|
|
|
|
|
|
|
Imager->_set_error(Imager->_error_as_msg); |
38
|
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return map bless({ IMG => $_, ERRSTR => undef }, "Imager"), @imgs; |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Imager->register_writer |
46
|
|
|
|
|
|
|
( |
47
|
|
|
|
|
|
|
type=>'qoi', |
48
|
|
|
|
|
|
|
single => |
49
|
|
|
|
|
|
|
sub { |
50
|
|
|
|
|
|
|
my ($im, $io, %hsh) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$im->_set_opts(\%hsh, "i_", $im); |
53
|
|
|
|
|
|
|
$im->_set_opts(\%hsh, "qoi_", $im); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
unless (i_writeqoi($im->{IMG}, $io)) { |
56
|
|
|
|
|
|
|
$im->_set_error(Imager->_error_as_msg); |
57
|
|
|
|
|
|
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
return $im; |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
multiple => |
62
|
|
|
|
|
|
|
sub { |
63
|
|
|
|
|
|
|
my ($class, $io, $opts, @ims) = @_; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Imager->_set_opts($opts, "qoi_", @ims); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my @work = map $_->{IMG}, @ims; |
68
|
|
|
|
|
|
|
my $result = i_writeqoi_multi($io, @work); |
69
|
|
|
|
|
|
|
unless ($result) { |
70
|
|
|
|
|
|
|
$class->_set_error($class->_error_as_msg); |
71
|
|
|
|
|
|
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
return 1; |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
eval { |
79
|
|
|
|
|
|
|
# from Imager 1.008 |
80
|
|
|
|
|
|
|
Imager->add_type_extensions("qoi", "qoi"); |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |