| 1 | package Imager::File::ICO; | ||||||||||||
| 2 | 13 | ▶ | use 5.006; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 13 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 13 | ▶ | use Imager; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 13 | ▶ | BEGIN { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 13 | our $VERSION = "0.10"; | |||||||||||
| 8 | |||||||||||||
| 9 | 13 | require XSLoader; | |||||||||||
| 10 | 13 | XSLoader::load('Imager::File::ICO', $VERSION); | |||||||||||
| 11 | } | ||||||||||||
| 12 | |||||||||||||
| 13 | Imager->register_reader | ||||||||||||
| 14 | ( | ||||||||||||
| 15 | type=>'ico', | ||||||||||||
| 16 | single => | ||||||||||||
| 17 | 39 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||
| 18 | 39 | my ($im, $io, %hsh) = @_; | |||||||||||
| 19 | my $masked = | ||||||||||||
| 20 | 39 | ▶ | exists $hsh{ico_masked} ? $hsh{ico_masked} : 1; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | my $alpha_masked = | ||||||||||||
| 22 | 39 | ▶ | exists $hsh{ico_alpha_masked} ? $hsh{ico_alpha_masked} : 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | |||||||||||||
| 24 | 39 | ▶ | $im->{IMG} = i_readico_single($io, $hsh{page} || 0, $masked, | ||||||||||
|
Condition100%2/2
$hsh{'page'} || 0
MC/DC100%1/1
$hsh{'page'} || 0
$hsh{'page'}
Truth table100%2/2
A
A= $hsh{'page'}
| |||||||||||||
| 25 | $alpha_masked); | ||||||||||||
| 26 | |||||||||||||
| 27 | 39 | ▶ | unless ($im->{IMG}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | 16 | $im->_set_error(Imager->_error_as_msg); | |||||||||||
| 29 | 16 | return; | |||||||||||
| 30 | } | ||||||||||||
| 31 | 23 | return $im; | |||||||||||
| 32 | }, | ||||||||||||
| 33 | multiple => | ||||||||||||
| 34 | 5 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||
| 35 | 5 | my ($io, %hsh) = @_; | |||||||||||
| 36 | |||||||||||||
| 37 | my $masked = | ||||||||||||
| 38 | 5 | ▶ | exists $hsh{ico_masked} ? $hsh{ico_masked} : 1; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 5 | my @imgs = i_readico_multi($io, $masked); | |||||||||||
| 40 | 5 | ▶ | unless (@imgs) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 41 | 2 | Imager->_set_error(Imager->_error_as_msg); | |||||||||||
| 42 | 2 | return; | |||||||||||
| 43 | } | ||||||||||||
| 44 | return map { | ||||||||||||
| 45 | 3 | bless { IMG => $_, DEBUG => $Imager::DEBUG, ERRSTR => undef }, 'Imager' | |||||||||||
| 46 | } @imgs; | ||||||||||||
| 47 | }, | ||||||||||||
| 48 | 13 | ); | |||||||||||
| 49 | |||||||||||||
| 50 | # the readers can read CUR files too | ||||||||||||
| 51 | Imager->register_reader | ||||||||||||
| 52 | ( | ||||||||||||
| 53 | type=>'cur', | ||||||||||||
| 54 | single => | ||||||||||||
| 55 | 7 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.4
| |||||||||||||
| 56 | 7 | my ($im, $io, %hsh) = @_; | |||||||||||
| 57 | my $masked = | ||||||||||||
| 58 | 7 | ▶ | exists $hsh{ico_masked} ? $hsh{ico_masked} : 1; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 59 | my $alpha_masked = | ||||||||||||
| 60 | 7 | ▶ | exists $hsh{ico_alpha_masked} ? $hsh{ico_alpha_masked} : 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 61 | 7 | ▶ | $im->{IMG} = i_readico_single($io, $hsh{page} || 0, $masked, | ||||||||||
|
Condition50%1/2
$hsh{'page'} || 0
MC/DC0%0/1
$hsh{'page'} || 0
$hsh{'page'}
Truth table50%1/2
A
A= $hsh{'page'}
| |||||||||||||
| 62 | $alpha_masked); | ||||||||||||
| 63 | |||||||||||||
| 64 | 7 | ▶ | unless ($im->{IMG}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 65 | 2 | $im->_set_error(Imager->_error_as_msg); | |||||||||||
| 66 | 2 | return; | |||||||||||
| 67 | } | ||||||||||||
| 68 | 5 | return $im; | |||||||||||
| 69 | }, | ||||||||||||
| 70 | multiple => | ||||||||||||
| 71 | 2 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.0
| |||||||||||||
| 72 | 2 | my ($io, %hsh) = @_; | |||||||||||
| 73 | |||||||||||||
| 74 | my $masked = | ||||||||||||
| 75 | 2 | ▶ | exists $hsh{ico_masked} ? $hsh{ico_masked} : 1; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 76 | 2 | my @imgs = i_readico_multi($io, $masked); | |||||||||||
| 77 | 2 | ▶ | unless (@imgs) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 78 | 0 | Imager->_set_error(Imager->_error_as_msg); | |||||||||||
| 79 | 0 | return; | |||||||||||
| 80 | } | ||||||||||||
| 81 | return map { | ||||||||||||
| 82 | 2 | bless { IMG => $_, DEBUG => $Imager::DEBUG, ERRSTR => undef }, 'Imager' | |||||||||||
| 83 | } @imgs; | ||||||||||||
| 84 | }, | ||||||||||||
| 85 | 13 | ); | |||||||||||
| 86 | |||||||||||||
| 87 | Imager->register_writer | ||||||||||||
| 88 | ( | ||||||||||||
| 89 | type=>'ico', | ||||||||||||
| 90 | single => | ||||||||||||
| 91 | 34 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||
| 92 | 34 | my ($im, $io, %hsh) = @_; | |||||||||||
| 93 | |||||||||||||
| 94 | 34 | ▶ | unless (i_writeico_wiol($io, $im->{IMG})) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 95 | 18 | $im->_set_error(Imager->_error_as_msg); | |||||||||||
| 96 | 18 | return; | |||||||||||
| 97 | } | ||||||||||||
| 98 | 16 | return $im; | |||||||||||
| 99 | }, | ||||||||||||
| 100 | multiple => | ||||||||||||
| 101 | 5 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||
| 102 | 5 | my ($class, $io, $opts, @images) = @_; | |||||||||||
| 103 | |||||||||||||
| 104 | 5 | ▶ | if (!i_writeico_multi_wiol($io, map $_->{IMG}, @images)) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 105 | 3 | Imager->_set_error(Imager->_error_as_msg); | |||||||||||
| 106 | 3 | return; | |||||||||||
| 107 | } | ||||||||||||
| 108 | |||||||||||||
| 109 | 2 | return 1; | |||||||||||
| 110 | }, | ||||||||||||
| 111 | 13 | ); | |||||||||||
| 112 | |||||||||||||
| 113 | Imager->register_writer | ||||||||||||
| 114 | ( | ||||||||||||
| 115 | type=>'cur', | ||||||||||||
| 116 | single => | ||||||||||||
| 117 | 8 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||
| 118 | 8 | my ($im, $io, %hsh) = @_; | |||||||||||
| 119 | |||||||||||||
| 120 | 8 | ▶ | unless (i_writecur_wiol($io, $im->{IMG})) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 121 | 4 | $im->_set_error(Imager->_error_as_msg); | |||||||||||
| 122 | 4 | return; | |||||||||||
| 123 | } | ||||||||||||
| 124 | 4 | return $im; | |||||||||||
| 125 | }, | ||||||||||||
| 126 | multiple => | ||||||||||||
| 127 | 5 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||
| 128 | 5 | my ($class, $io, $opts, @images) = @_; | |||||||||||
| 129 | |||||||||||||
| 130 | 5 | ▶ | if (!i_writecur_multi_wiol($io, map $_->{IMG}, @images)) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 131 | 3 | Imager->_set_error(Imager->_error_as_msg); | |||||||||||
| 132 | 3 | return; | |||||||||||
| 133 | } | ||||||||||||
| 134 | |||||||||||||
| 135 | 2 | return 1; | |||||||||||
| 136 | }, | ||||||||||||
| 137 | 13 | ); | |||||||||||
| 138 | |||||||||||||
| 139 | 13 | 1; | |||||||||||
| 140 | |||||||||||||
| 141 | __END__ | ||||||||||||