Branch Coverage

blib/lib/Imager.pm
Criterion Covered Total %
branch 980 1410 69.5


line true false branch
149 0 57 if ($ex_version < "5.57")
253 2 44 unless &i_conv($hsh{'image'}, $hsh{'coef'})
281 0 3 unless my $new_color = _color($color)
288 0 1 unless &i_nearest_color($hsh{'image'}, $hsh{'xo'}, $hsh{'yo'}, \@colors, $hsh{'dist'})
338 0 3 unless my $new_color = _color($old)
428 0 9 unless &i_fountain($hsh{'image'}, $hsh{'xa'}, $hsh{'ya'}, $hsh{'xb'}, $hsh{'yb'}, $hsh{'ftype'}, $hsh{'repeat'}, $hsh{'combine'}, $hsh{'super_sample'}, $hsh{'ssample_param'}, \@segments)
458 0 30 if ($_[$i] eq '-log-stderr') { }
477 0 8 if (exists $parms{'warn_obsolete'})
481 8 0 if ($parms{'log'})
483 0 8 unless "Imager"->open_log("log", $parms{'log'}, "level", $parms{'loglevel'})
486 0 8 if (exists $parms{'t1log'})
487 0 0 if ($formats{'t1'})
488 0 0 if (Imager::Font::T1::i_init_t1($parms{'t1log'}))
506 0 34 unless ($is_logging)
524 1 34 unless defined $level
535 0 57 if ($DEBUG)
551 0 0 if ($^O eq "android")
557 0 0 unless (defined $DSO_handle)
559 0 0 if ($DEBUG)
561 0 0 if ($filters{$_})
567 0 0 if $DEBUG
569 0 0 if $@
579 0 0 if ($^O eq "android")
584 0 0 unless ($DSOs{$filename})
588 0 0 if $DEBUG
591 0 0 unless (defined $rc)
617 660 364 if (ref $arg) { }
618 521 139 if (UNIVERSAL::isa($arg, 'Imager::Color') or UNIVERSAL::isa($arg, 'Imager::Color::Float')) { }
623 3 136 if ($copy =~ /^HASH\(/) { }
136 0 elsif ($copy =~ /^ARRAY\(/) { }
645 55 68 if (not defined $combine and ref $self)
648 91 32 unless defined $combine
649 91 32 unless defined $combine
651 85 38 if (exists $combine_types{$combine})
661 0 8649 unless ref $self
664 8581 68 if $self->{'IMG'} and builtin::blessed($self->{'IMG'})
666 0 68 $self->{'IMG'} ? :
667 68 0 if $method
676 75 87 if defined $_
697 0 1278 if $self->{'DEBUG'}
698 14 1264 if (defined $hsh{'file'} or defined $hsh{'fh'} or defined $hsh{'fd'} or defined $hsh{'callback'} or defined $hsh{'readcb'} or defined $hsh{'data'} or defined $hsh{'io'}) { }
552 712 elsif (defined $hsh{'xsize'} or defined $hsh{'ysize'}) { }
0 712 elsif (%hsh) { }
710 6 8 if ($hsh{'filetype'})
713 5 9 unless ($self->read(%hsh, %extras))
719 25 527 unless ($self->img_set(%hsh))
738 1 216 unless $self->_valid_image("copy")
741 1 215 unless (defined wantarray)
757 1 28 unless $self->_valid_image("paste")
762 1 27 unless ($src)
766 1 26 unless ($src->_valid_image("paste"))
770 1 25 if $input{'left'} <= 0
771 1 25 if $input{'top'} <= 0
776 1 25 if ($input{'src_coords'}) { }
780 2 23 if (defined $input{'src_maxx'}) { }
1 22 elsif (defined $input{'width'}) { }
784 0 1 if ($input{'width'} <= 0)
793 3 22 if (defined $input{'src_maxy'}) { }
1 21 elsif (defined $input{'height'}) { }
797 0 1 if ($input{'height'} < 0)
808 0 26 if $src_right > $r
809 0 26 if $src_bottom > $b
811 0 26 if ($src_right <= $src_left or $src_bottom < $src_top)
829 1 47 unless $self->_valid_image("crop")
832 1 46 unless (defined wantarray)
844 34 12 if (defined $l) { }
3 9 elsif (defined $r) { }
1 8 elsif (defined $w) { }
845 1 33 if (defined $w) { }
1 32 elsif (not defined $r) { }
853 2 1 if (defined $w) { }
868 36 10 if (defined $t) { }
3 7 elsif (defined $b) { }
1 6 elsif (defined $h) { }
869 4 32 if (defined $h) { }
1 31 elsif (not defined $b) { }
877 2 1 if (defined $h) { }
893 0 46 if $l > $r
894 0 46 if $t > $b
896 1 45 if $l < 0
897 2 44 if $r > $self->getwidth
898 1 45 if $t < 0
899 3 43 if $b > $self->getheight
901 2 44 if ($l == $r or $t == $b)
905 2 42 if ($r < $l or $b < $t)
920 0 15 unless $self->_valid_image($name)
927 15 0 unless defined $tolerance
929 0 15 if (keys %hsh)
934 5 10 if ($auto)
935 0 5 if ($colors != $empty_trim_colors)
939 0 5 if ($tolerance < 0)
951 0 5 unless ($colors)
957 0 15 unless (ref $colors)
961 5 10 unless (UNIVERSAL::isa($colors, "Imager::TrimColorList"))
962 0 5 unless (builtin::reftype($colors) eq "ARRAY")
981 0 4 unless my($left, $top, $right, $bottom) = $self->_trim_rect("trim", %hsh)
984 0 4 if ($left == $self->getwidth) { }
999 0 42 unless $self->_valid_image
1007 42 0 if ($channels == $self->getchannels) { }
1013 0 42 unless ($out->{'IMG'})
1039 4 548 if ($hsh{'model'})
1040 4 0 if (my $channels = $model_channels{$hsh{'model'}}) { }
1049 25 527 if ($hsh{'type'} eq 'paletted' or $hsh{'type'} eq 'pseudo') { }
70 457 elsif ($hsh{'bits'} eq 'double') { }
22 435 elsif ($hsh{'bits'} == 16) { }
1064 25 527 unless ($self->{'IMG'})
1076 1 16 unless $self->_valid_image("masked")
1084 3 13 $opts{'mask'} ? :
1088 3 29 if ($val < 0)
1093 3 29 if ($val < 0)
1102 7 9 unless ($result->{'IMG'})
1118 13 1 if (@_ != 1 and not ref $_[0]) { }
1125 1 13 unless (defined wantarray)
1131 1 12 unless $self->_valid_image("to_paletted")
1135 2 10 unless ($result->{'IMG'} = &i_img_to_pal($self->{'IMG'}, $opts))
1146 1 6 unless (@images)
1152 1 6 unless ($img->{'IMG'})
1160 1 4 unless (@cols)
1171 1 2 unless (defined wantarray)
1177 1 1 unless $self->_valid_image("to_rgb8")
1181 0 1 unless ($result->{'IMG'} = &i_img_to_rgb($self->{'IMG'}))
1193 0 9 unless (defined wantarray)
1199 1 8 unless $self->_valid_image("to_rgb16")
1203 0 8 unless ($result->{'IMG'} = &i_img_to_rgb16($self->{'IMG'}))
1215 0 3 unless (defined wantarray)
1221 1 2 unless $self->_valid_image("to_rgb_double")
1225 0 2 unless ($result->{'IMG'} = &i_img_to_drgb($self->{'IMG'}))
1237 1 23 unless $self->_valid_image("addcolors")
1240 0 23 unless my(@colors) = @{$opts{'colors'};}
1245 1 48 unless ($color)
1258 1 11 unless $self->_valid_image("setcolors")
1261 1 10 unless my(@colors) = @{$opts{'colors'};}
1266 1 13 unless ($color)
1279 1 14 unless $self->_valid_image("getcolors")
1282 9 5 if (not exists $opts{'start'} || exists $opts{'count'}) { }
5 0 elsif (not exists $opts{'count'}) { }
0 0 elsif (not exists $opts{'start'}) { }
1300 1 14 unless $self->_valid_image("colorcount")
1309 1 2 unless $self->_valid_image("maxcolors")
1319 1 8 unless $self->_valid_image("findcolor")
1322 0 8 unless ($opts{'color'})
1328 0 8 unless my $color = _color($opts{'color'})
1336 1 54 unless $self->_valid_image("bits")
1340 12 42 if ($bits and $bits == 64)
1349 1 56 unless $self->_valid_image("type")
1352 30 26 &i_img_type($self->{'IMG'}) ? :
1358 1 1 unless $self->_valid_image("virtual")
1367 1 24 unless $self->_valid_image("is_bilevel")
1376 1 85 unless $self->_valid_image("tags")
1379 85 0 if (defined $opts{'name'}) { }
0 0 elsif (defined $opts{'code'}) { }
1387 5 80 wantarray ? :
1400 0 0 if (wantarray) { }
1413 1 22 unless $self->_valid_image("addtag")
1416 20 2 if ($opts{'name'}) { }
2 0 elsif ($opts{'code'}) { }
1417 20 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1418 17 3 if ($opts{'value'} =~ /^\d+$/) { }
1436 2 0 if $] >= "5.014"
1438 2 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1439 2 0 if ($opts{'value'} =~ /^\d+$/) { }
1465 1 20 unless $self->_valid_image("deltag")
1468 0 20 if (defined $opts{'index'}) { }
20 0 elsif (defined $opts{'name'}) { }
0 0 elsif (defined $opts{'code'}) { }
1475 0 0 if $] >= "5.014"
1488 1 22 unless $self->_valid_image("settag")
1491 20 2 if ($opts{'name'}) { }
2 0 elsif (defined $opts{'code'}) { }
1496 2 0 if $] >= "5.014"
1499 2 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1500 2 0 if ($opts{'value'} =~ /^\d+$/) { }
1526 0 221 if ($input->{'io'}) { }
4 217 elsif ($input->{'fd'}) { }
11 206 elsif ($input->{'fh'}) { }
135 71 elsif ($input->{'file'}) { }
63 8 elsif ($input->{'data'}) { }
8 0 elsif ($input->{'callback'} or $input->{'readcb'}) { }
1533 0 11 unless (&Scalar::Util::openhandle($input->{'fh'}))
1541 0 135 unless (CORE::open $file, "<", $input->{'file'})
1552 0 8 unless ($input->{'seekcb'})
1555 0 8 if ($input->{'maxbuffer'}) { }
1576 1 167 exists $input->{'buffered'} ? :
1580 19 149 if ($input->{'io'}) { }
0 149 elsif ($input->{'fd'}) { }
6 143 elsif ($input->{'fh'}) { }
113 30 elsif ($input->{'file'}) { }
20 10 elsif ($input->{'data'}) { }
10 0 elsif ($input->{'callback'} or $input->{'writecb'}) { }
1587 0 6 unless (&Scalar::Util::openhandle($input->{'fh'}))
1595 0 113 unless (CORE::open $fh, "+>", $input->{'file'})
1599 0 113 unless binmode $fh
1607 4 6 if ($input->{'maxbuffer'} and $input->{'maxbuffer'} == 1)
1619 5 163 unless ($buffered)
1639 0 1 unless (&i_add_file_magic($name, $bits, $mask))
1653 22 196 if (defined $self->{'IMG'})
1660 0 218 unless my($IO, $fh) = $self->_get_reader_io(\%input)
1663 112 106 unless ($type)
1667 1 217 if ($input{'file'} and not $type)
1672 2 216 unless ($type)
1674 1 1 if $input{'file'}
1681 0 0 if ($readers{$type} and $readers{$type}{'single'})
1685 3 213 unless ($formats_low{$type})
1692 194 19 unless defined $allow_incomplete
1694 75 138 if ($type eq "pnm")
1696 20 55 unless (defined $self->{'IMG'})
1700 0 55 if $self->{'DEBUG'}
1704 98 40 if ($type eq "bmp")
1706 46 52 unless (defined $self->{'IMG'})
1710 0 52 if $self->{'DEBUG'}
1713 22 70 if ($type eq "tga")
1715 4 18 unless (defined $self->{'IMG'})
1719 0 18 if $self->{'DEBUG'}
1722 18 70 if ($type eq "raw")
1723 0 18 unless ($input{'xsize'} and $input{'ysize'})
1729 1 17 unless (defined $interleave)
1743 4 14 unless (defined $self->{'IMG'})
1747 0 14 if $self->{'DEBUG'}
1757 0 3 unless defined $opts{'type'}
1762 0 3 unless defined $opts{'single'} or defined $opts{'multiple'}
1765 3 0 if ($opts{'single'})
1768 2 1 if ($opts{'multiple'})
1779 0 3 unless defined $opts{'type'}
1784 0 3 unless defined $opts{'single'} or defined $opts{'multiple'}
1787 3 0 if ($opts{'single'})
1790 2 1 if ($opts{'multiple'})
1824 3 57 if ($attempted_to_load{$file}) { }
1825 3 0 if ($file_load_errors{$file}) { }
1837 56 1 if $INC[-1] eq "."
1842 0 57 if ($loaded) { }
1862 214 3 if $formats_low{$type} or $readers{$type}
1864 0 3 unless $type =~ /^\w+$/
1870 2 1 if (not $loaded and $error =~ /^Can't locate /)
1873 2 0 if ($error =~ /^Can't locate /)
1877 3 0 unless ($loaded)
1886 168 3 if $formats_low{$type} or $writers{$type}
1888 0 3 unless $type =~ /^\w+$/
1894 2 1 if (not $loaded and $error =~ /^Can't locate /)
1897 2 0 if ($error =~ /^Can't locate /)
1901 3 0 unless ($loaded)
1915 0 0 if defined $y
1937 0 3292 if ($obsolete_opts{$opt})
1940 0 0 if (ref $new) { }
1948 0 0 if $warn_obsolete and $^W
1950 3273 19 unless $tagname =~ /^\Q$prefix\E/
1952 3 16 if ($color_opts{$opt})
1954 0 3 unless ($value)
1959 3 16 if (ref $value) { }
1960 3 0 if (UNIVERSAL::isa($value, 'Imager::Color')) { }
0 0 elsif (ref $value eq 'ARRAY') { }
1969 0 0 if (ref $val) { }
1970 0 0 if (UNIVERSAL::isa($val, 'Imager::Color')) { }
1972 0 0 if $i < @imgs
1982 0 0 if $i < @imgs
2017 1 171 unless $self->_valid_image("write")
2020 0 171 unless $self->_set_opts(\%input, "i_", $self)
2024 95 0 if (not $type and $input{'file'})
2027 0 171 unless ($type)
2035 0 171 if ($writers{$type} and $writers{$type}{'single'}) { }
2036 0 0 unless ($IO, $fh) = $self->_get_writer_io(\%input)
2039 0 0 unless $writers{$type}{'single'}->($self, $IO, %input, "type", $type)
2043 3 168 unless ($formats_low{$type})
2049 0 168 unless ($IO, $fh) = $self->_get_writer_io(\%input, $type)
2052 121 47 if ($type eq 'pnm') { }
10 37 elsif ($type eq 'raw') { }
21 16 elsif ($type eq 'bmp') { }
16 0 elsif ($type eq 'tga') { }
2053 0 121 unless $self->_set_opts(\%input, "pnm_", $self)
2055 5 116 unless (&i_writeppm_wiol($self->{'IMG'}, $IO))
2059 0 116 if $self->{'DEBUG'}
2062 0 10 unless $self->_set_opts(\%input, "raw_", $self)
2064 4 6 unless (&i_writeraw_wiol($self->{'IMG'}, $IO))
2068 0 6 if $self->{'DEBUG'}
2071 0 21 unless $self->_set_opts(\%input, "bmp_", $self)
2073 12 9 unless (&i_writebmp_wiol($self->{'IMG'}, $IO))
2077 0 9 if $self->{'DEBUG'}
2080 0 16 unless $self->_set_opts(\%input, "tga_", $self)
2083 4 12 unless (&i_writetga_wiol($self->{'IMG'}, $IO, $input{'wierdpack'}, $input{'compress'}, $input{'idstring'}))
2087 0 12 if $self->{'DEBUG'}
2091 17 126 if (exists $input{'data'})
2093 0 17 unless ($data)
2107 0 0 if (not $type and $opts->{'file'})
2110 0 3 unless ($type)
2117 1 2 unless (ref $img and builtin::blessed($img) and $img->isa("Imager"))
2121 1 1 unless ($img->_valid_image("write_multi"))
2127 0 0 unless $class->_set_opts($opts, "i_", @images)
2134 0 0 if ($writers{$type} and $writers{$type}{'multiple'}) { }
2135 0 0 unless ($IO, $file) = $class->_get_writer_io($opts, $type)
2138 0 0 unless $writers{$type}{'multiple'}->($class, $IO, $opts, @images)
2142 0 0 unless ($formats{$type})
2148 0 0 unless ($IO, $file) = $class->_get_writer_io($opts, $type)
2154 0 0 if (@images == 1) { }
2155 0 0 unless ($images[0]->write(%$opts, "io", $IO, "type", $type))
2166 0 0 if (exists $opts->{'data'})
2168 0 0 unless ($data)
2181 0 3 unless my($IO, $file) = $class->_get_reader_io(\%opts, $opts{'type'})
2185 3 0 unless ($type)
2189 1 2 if ($opts{'file'} and not $type)
2194 2 1 unless ($type)
2196 1 1 if $opts{'file'}
2203 0 0 if ($readers{$type} and $readers{$type}{'multiple'})
2207 0 1 unless ($formats{$type})
2214 1 0 if ($type eq 'pnm') { }
2219 0 0 if ($img->read(%opts, "io", $IO, "type", $type))
2226 0 1 unless (@imgs)
2240 1120 161 if (defined $self->{'IMG'}) { }
2260 1 86 unless $self->_valid_image("filter")
2263 0 86 unless ($input{'type'})
2265 0 86 unless (exists $filters{$input{'type'}})
2269 10 76 if ($filters{$input{'type'}}{'names'})
2272 12 28 if (defined $input{$name} and exists $names->{$name}{$input{$name}})
2277 85 1 if (defined $filters{$input{'type'}}{'defaults'}) { }
2291 0 292 unless (defined $hsh{$_})
2300 4 82 if ($@)
2307 0 82 if $self->{'DEBUG'}
2308 0 82 if $self->{'DEBUG'}
2318 0 1 unless defined $hsh{'type'}
2320 0 1 unless defined $hsh{'callsub'}
2322 0 1 unless defined $hsh{'callseq'}
2325 0 1 if exists $filters{$hsh{'type'}}
2339 1 360 if (defined $opts{$name} and ref $opts{$name})
2348 58 2 if (ref $self) { }
2349 58 0 unless defined $width
2350 58 0 unless defined $height
2353 1 1 unless (defined $width and defined $height)
2359 8 51 if ($opts{'xscalefactor'} and $opts{'yscalefactor'}) { }
3 48 elsif ($opts{'xscalefactor'}) { }
3 45 elsif ($opts{'yscalefactor'}) { }
2376 19 40 if ($opts{'xpixels'} and $opts{'ypixels'} and $opts{'type'}) { }
6 34 elsif ($opts{'xpixels'}) { }
3 31 elsif ($opts{'ypixels'}) { }
0 31 elsif ($opts{'constrain'} and ref $opts{'constrain'} and $opts{'constrain'}->can('constrain')) { }
2379 3 16 if ($opts{'type'} eq 'min') { }
9 7 elsif ($opts{'type'} eq 'max') { }
6 1 elsif ($opts{'type'} eq 'nonprop' or $opts{'type'} eq 'non-proportional') { }
2406 0 0 unless ($scalefactor)
2414 3 55 unless $new_width > 0
2416 3 55 unless $new_height > 0
2430 1 59 unless (defined wantarray)
2436 1 58 unless $self->_valid_image("scale")
2439 2 56 unless my($x_scale, $y_scale, $new_width, $new_height) = $self->scale_calculate(%opts)
2443 17 39 if ($opts{'qtype'} eq 'normal') { }
18 21 elsif ($opts{'qtype'} eq 'preview') { }
20 1 elsif ($opts{'qtype'} eq 'mixing') { }
2445 0 17 unless (defined $tmp->{'IMG'})
2450 0 17 unless (defined $img->{'IMG'})
2459 0 18 unless (defined $img->{'IMG'})
2467 0 20 unless ($img->{'IMG'})
2485 1 10 unless (defined wantarray)
2491 1 9 unless $self->_valid_image("scaleX")
2498 3 6 if ($opts{'pixels'})
2502 0 9 unless ($self->{'IMG'})
2509 0 9 unless (defined $img->{'IMG'})
2523 1 10 unless (defined wantarray)
2529 1 9 unless $self->_valid_image("scaleY")
2536 3 6 if ($opts{'pixels'})
2540 0 9 unless ($self->{'IMG'})
2546 0 9 unless (defined $img->{'IMG'})
2569 0 0 unless $self->_valid_image("transform")
2572 0 0 if ($opts{'xexpr'} and $opts{'yexpr'})
2573 0 0 unless ($I2P)
2576 0 0 if $INC[-1] eq "."
2580 0 0 if ($@)
2603 0 0 if (/$numre/) { }
2604 0 0 if (/$numre/) { }
2610 0 0 if (not exists $opts{'xopcodes'} or @{$opts{'xopcodes'};} == 0)
2617 0 0 unless (defined $OPCODES{$iop} or $iop =~ /^\d+$/)
2621 0 0 exists $OPCODES{$iop} ? :
2627 0 0 if (not exists $opts{'yopcodes'} or @{$opts{'yopcodes'};} == 0)
2634 0 0 unless (defined $OPCODES{$iop} or $iop =~ /^\d+$/)
2638 0 0 exists $OPCODES{$iop} ? :
2643 0 0 unless (exists $opts{'parm'})
2654 0 0 unless (defined $img->{'IMG'})
2666 26 4 if (@imgs)
2669 1 27 unless ($img->_valid_image("transform2"))
2687 28 1 if ($width) { }
2695 28 0 if ($height) { }
2704 0 28 unless ($code)
2709 0 28 unless ($channels >= 1 and $channels <= 4)
2718 1 27 unless (defined $img->{'IMG'})
2730 1 21 unless $self->_valid_image("rubthrough")
2733 1 20 unless ($opts{'src'} and $opts{'src'}->_valid_image("rubthrough"))
2745 18 2 unless defined $tx
2746 2 18 unless defined $tx
2749 18 2 unless defined $ty
2750 2 18 unless defined $ty
2752 0 20 unless (&i_rubthru($self->{'IMG'}, $opts{'src'}{'IMG'}, $tx, $ty, $opts{'src_minx'}, $opts{'src_miny'}, $opts{'src_maxx'}, $opts{'src_maxy'}))
2772 1 57 unless $self->_valid_image("compose")
2775 0 57 unless ($opts{'src'})
2780 1 56 unless ($opts{'src'}->_valid_image("compose"))
2787 56 0 unless defined $left
2788 9 47 unless defined $left
2791 56 0 unless defined $top
2792 9 47 unless defined $top
2795 48 8 unless defined $src_left
2796 48 8 unless defined $src_left
2799 48 8 unless defined $src_top
2800 48 8 unless defined $src_top
2803 0 56 if (not defined $width and defined $opts{'src_maxx'})
2806 52 4 unless defined $width
2809 0 56 if (not defined $height and defined $opts{'src_maxy'})
2812 52 4 unless defined $height
2816 31 25 if ($opts{'mask'}) { }
2817 1 30 unless ($opts{'mask'}->_valid_image("compose"))
2823 0 30 unless defined $mask_left
2824 0 30 unless defined $mask_left
2827 0 30 unless defined $mask_top
2828 0 30 unless defined $mask_top
2830 10 20 unless (&i_compose_mask($self->{'IMG'}, $src->{'IMG'}, $opts{'mask'}{'IMG'}, $left, $top, $src_left, $src_top, $mask_left, $mask_top, $width, $height, $combine, $opts{'opacity'}))
2839 10 15 unless (&i_compose($self->{'IMG'}, $src->{'IMG'}, $left, $top, $src_left, $src_top, $width, $height, $combine, $opts{'opacity'}))
2853 1 143 unless $self->_valid_image("flip")
2858 0 143 unless defined $opts{'dir'} and defined $xlate{$opts{'dir'}}
2860 143 0 if &i_flipxy($self->{'IMG'}, $dir)
2868 1 42 unless (defined wantarray)
2874 1 41 unless $self->_valid_image("rotate")
2877 30 11 if (defined $opts{'right'}) { }
11 0 elsif (defined $opts{'radians'} or defined $opts{'degrees'}) { }
2879 0 30 if ($degrees < 0)
2883 2 28 if ($degrees == 0) { }
28 0 elsif ($degrees == 90 or $degrees == 180 or $degrees == 270) { }
2888 28 0 if ($result->{'IMG'} = &i_rotate90($self->{'IMG'}, $degrees)) { }
2906 6 5 if ($back) { }
2908 1 5 unless ($back)
2918 10 0 if ($result->{'IMG'}) { }
2936 1 4 unless $self->_valid_image("matrix_transform")
2939 1 3 unless (defined wantarray)
2945 3 0 if ($opts{'matrix'}) { }
2950 1 2 if ($opts{'back'}) { }
2953 0 1 unless $result->{'IMG'} = &i_matrix_transform($self->{'IMG'}, $xsize, $ysize, $opts{'matrix'}, $opts{'back'})
2958 0 2 unless $result->{'IMG'} = &i_matrix_transform($self->{'IMG'}, $xsize, $ysize, $opts{'matrix'})
2987 1 982 unless $self->_valid_image("box")
2993 567 415 if (exists $opts{'box'}) { }
3000 284 131 unless defined($xmin = $opts{'xmin'})
3001 282 133 unless defined($xmax = $opts{'xmax'})
3002 302 113 unless defined($ymin = $opts{'ymin'})
3003 301 114 unless defined($ymax = $opts{'ymax'})
3006 865 117 if ($opts{'filled'}) { }
113 4 elsif ($opts{'fill'}) { }
3009 863 2 if (defined $color) { }
3010 145 718 unless (&_is_color_object($color))
3012 0 145 unless ($color)
3022 828 37 if ($color->isa('Imager::Color')) { }
3030 6 107 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3033 0 6 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3042 3 1 if (defined $color) { }
3043 2 1 unless (&_is_color_object($color))
3045 0 2 unless ($color)
3054 0 4 unless ($color)
3067 1 257 unless $self->_valid_image("arc")
3082 133 124 if ($opts{'aa'}) { }
3083 2 131 if ($opts{'fill'}) { }
33 98 elsif ($opts{'filled'}) { }
3084 2 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3087 0 2 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3092 1 1 if ($opts{'d1'} == 0 and $opts{'d2'} == 361) { }
3103 0 33 unless ($color)
3107 8 25 if ($opts{'d1'} == 0 and $opts{'d2'} == 361 and $opts{'aa'}) { }
3118 25 73 if ($opts{'d2'} - $opts{'d1'} >= 360) { }
3127 10 114 if ($opts{'fill'}) { }
3128 10 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3131 1 9 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3141 0 114 unless ($color)
3145 52 62 if ($opts{'filled'}) { }
3150 13 49 if ($opts{'d1'} == 0 and $opts{'d2'} == 361) { }
3159 0 255 unless ($good)
3178 1 211 unless $self->_valid_image("line")
3181 0 211 unless (exists $opts{'x1'} and exists $opts{'y1'})
3182 0 211 unless (exists $opts{'x2'} and exists $opts{'y2'})
3185 0 211 unless ($color)
3190 145 66 if defined $opts{'aa'}
3191 146 65 if ($opts{'antialias'}) { }
3210 1 5 unless $self->_valid_image("polyline")
3213 1 4 if (exists $opts{'points'})
3214 4 0 if (not exists $opts{'points'} and exists $opts{'x'} and exists $opts{'y'})
3221 0 5 unless ($color)
3225 1 4 if defined $opts{'aa'}
3226 2 3 if ($opts{'antialias'}) { }
3228 4 2 if (defined $ls)
3235 263 3 if (defined $ls)
3250 1 10 unless $self->_valid_image("polygon")
3253 8 2 if (exists $opts{'points'})
3258 0 10 unless (exists $opts{'x'} and exists $opts{'y'})
3264 4 6 if ($opts{'fill'}) { }
3265 3 1 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3268 0 3 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3273 1 3 unless (&i_poly_aa_cfill_m($self->{'IMG'}, $opts{'x'}, $opts{'y'}, $mode, $opts{'fill'}{'fill'}))
3280 0 6 unless ($color)
3284 1 5 unless (&i_poly_aa_m($self->{'IMG'}, $opts{'x'}, $opts{'y'}, $mode, $color))
3295 0 6 unless $self->_valid_image("polypolygon")
3299 0 6 unless $points
3304 6 0 if ($opts{'filled'}) { }
0 0 elsif ($opts{'fill'}) { }
3305 0 6 unless my $color = _color(_first($opts{'color'}, [0, 0, 0, 0]))
3308 0 6 unless &i_poly_poly_aa($self->{'IMG'}, $points, $mode, $color)
3313 0 0 unless $self->_valid_fill($fill, "polypolygon")
3317 0 0 unless &i_poly_poly_aa_cfill($self->{'IMG'}, $points, $mode, $fill->{'fill'})
3320 0 0 unless my $color = _color(_first($opts{'color'}, [0, 0, 0, 255]))
3325 0 0 if (_first($opts{'aa'}, 1)) { }
3365 0 0 unless $self->_valid_image("polybezier")
3368 0 0 if (exists $opts{'points'})
3373 0 0 unless (@{$opts{'x'};} and @{$opts{'x'};} == @{$opts{'y'};})
3379 0 0 unless ($color)
3392 1 89 unless $self->_valid_image("flood_fill")
3395 0 89 unless (exists $opts{'x'} and exists $opts{'y'})
3400 2 87 if ($opts{'border'}) { }
3402 0 2 unless ($border)
3406 1 1 if ($opts{'fill'}) { }
3407 1 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3410 0 1 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3420 0 1 unless ($color)
3427 2 0 if ($rc) { }
3436 1 86 if ($opts{'fill'}) { }
3437 1 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3440 0 1 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3449 0 86 unless ($color)
3455 87 0 if ($rc) { }
3468 1 127 unless $self->_valid_image("setpixel")
3472 1 126 unless (defined $color)
3474 1 0 unless defined $color
3477 84 43 unless (ref $color and UNIVERSAL::isa($color, "Imager::Color"))
3478 1 83 unless ($color = _color($color, "setpixel"))
3484 2 124 unless (exists $opts{'x'} and exists $opts{'y'})
3491 9 115 if (ref $x or ref $y) { }
3492 7 2 ref $x ? :
3493 7 2 ref $y ? :
3494 1 8 unless (@$x)
3498 1 7 unless (@$y)
3504 1 6 if (@$x < @$y) { }
1 5 elsif (@$y < @$x) { }
3512 5 2 if ($color->isa('Imager::Color')) { }
3514 15 2 unless &i_ppix($self->{'IMG'}, $x->[$i], $y->[$i], $color)
3520 6 2 unless &i_ppixf($self->{'IMG'}, $x->[$i], $y->[$i], $color)
3528 84 31 if ($color->isa('Imager::Color')) { }
3529 18 66 if &i_ppix($self->{'IMG'}, $x, $y, $color)
3533 18 13 if &i_ppixf($self->{'IMG'}, $x, $y, $color)
3546 1 238 unless $self->_valid_image("getpixel")
3549 2 236 unless (exists $opts{'x'} and exists $opts{'y'})
3557 19 217 if (ref $x or ref $y) { }
3558 17 2 ref $x ? :
3559 15 4 ref $y ? :
3560 1 18 unless (@$x)
3564 1 17 unless (@$y)
3570 1 16 if (@$x < @$y) { }
3 13 elsif (@$y < @$x) { }
3578 13 4 if ($type eq '8bit') { }
3 1 elsif ($type eq 'float' or $type eq 'double') { }
3592 16 0 wantarray ? :
3595 195 22 if ($type eq '8bit') { }
21 1 elsif ($type eq 'float' or $type eq 'double') { }
3612 1 38 unless $self->_valid_image("getscanline")
3615 17 21 unless defined $opts{'width'}
3617 1 37 unless (defined $opts{'y'})
3622 16 21 if ($opts{'type'} eq '8bit') { }
12 9 elsif ($opts{'type'} eq 'float') { }
8 1 elsif ($opts{'type'} eq 'index') { }
3631 0 8 unless (&i_img_type($self->{'IMG'}))
3648 1 214 unless $self->_valid_image("setscanline")
3651 0 214 unless (defined $opts{'y'})
3656 200 14 unless ($opts{'type'})
3657 49 151 if (ref $opts{'pixels'} and @{$opts{'pixels'};}) { }
3659 32 17 if ($opts{'pixels'}[0]->isa('Imager::Color')) { }
17 0 elsif ($opts{'pixels'}[0]->isa('Imager::Color::Float')) { }
3676 183 31 if ($opts{'type'} eq '8bit') { }
18 13 elsif ($opts{'type'} eq 'float') { }
13 0 elsif ($opts{'type'} eq 'index') { }
3677 32 151 if (ref $opts{'pixels'}) { }
3685 17 1 if (ref $opts{'pixels'}) { }
3693 9 4 if (ref $opts{'pixels'}) { }
3710 1 312 unless $self->_valid_image("getsamples")
3713 288 24 unless defined $opts{'width'}
3715 0 312 unless (defined $opts{'y'})
3720 3 309 if ($opts{'target'}) { }
3723 1 2 if ($opts{'type'} eq '8bit') { }
1 1 elsif ($opts{'type'} eq 'float') { }
1 0 elsif ($opts{'type'} =~ /^(\d+)bit$/) { }
3726 0 1 unless my(@samples) = &i_gsamp($self->{'IMG'}, $opts{'x'}, $opts{'x'} + $opts{'width'}, $opts{'y'}, $opts{'channels'})
3743 0 1 unless (defined $count)
3756 297 12 if ($opts{'type'} eq '8bit') { }
12 0 elsif ($opts{'type'} eq 'float') { }
0 0 elsif ($opts{'type'} =~ /^(\d+)bit$/) { }
3770 0 0 unless &i_gsamp_bits($self->{'IMG'}, $opts{'x'}, $opts{'x'} + $opts{'width'}, $opts{'y'}, $bits, \@data, 0, $opts{'channels'})
3783 1 14 unless $self->_valid_image("setsamples")
3791 13 35 if ($_[$i] eq 'data') { }
3801 1 13 unless (defined $data_index)
3805 1 12 unless (defined $_[$data_index])
3811 5 7 unless defined $type
3814 0 12 defined $opts{'width'} ? :
3817 5 7 if ($type eq '8bit') { }
5 2 elsif ($type eq 'float') { }
1 1 elsif ($type =~ /^([0-9]+)bit$/) { }
3828 0 1 unless (ref $_[$data_index])
3842 4 7 unless (defined $count)
3866 1 17 unless $self->_valid_image("convert")
3869 1 16 unless (defined wantarray)
3877 14 2 if (not exists $opts{'matrix'}) { }
3878 14 0 if (exists $opts{'preset'}) { }
3883 3 11 if ($opts{'preset'} eq 'gray' or $opts{'preset'} eq 'grey') { }
1 10 elsif ($opts{'preset'} eq 'noalpha') { }
0 10 elsif ($opts{'preset'} eq 'red' or $opts{'preset'} eq 'channel0') { }
0 10 elsif ($opts{'preset'} eq 'green' or $opts{'preset'} eq 'channel1') { }
3 7 elsif ($opts{'preset'} eq 'blue' or $opts{'preset'} eq 'channel2') { }
0 7 elsif ($opts{'preset'} eq 'alpha') { }
6 1 elsif ($opts{'preset'} eq 'rgb') { }
1 0 elsif ($opts{'preset'} eq 'addalpha') { }
3885 3 0 if ($self->getchannels == 3) { }
0 0 elsif ($self->getchannels == 4) { }
3900 1 0 if ($self->getchannels == 2 or $self->getchannels == 4) { }
3919 0 0 if ($self->getchannels == 2 or $self->getchannels == 4) { }
3928 6 0 if ($self->getchannels == 1) { }
0 0 elsif ($self->getchannels == 2) { }
3940 0 1 if ($self->getchannels == 1) { }
1 0 elsif ($self->getchannels == 3) { }
3962 1 15 unless ($new->{'IMG'})
3976 1 13 unless ($src)
3983 1 20 unless (eval { do { $img->isa("Imager") } })
3987 1 19 unless ($img->_valid_image("combine"))
3994 4 7 if (my $channels = delete $opts{'channels'}) { }
4000 4 7 unless ($result)
4018 1 5 unless $self->_valid_image("map")
4021 1 4 unless (exists $opts{'maps'})
4025 3 1 if (exists $opts{$chlist[$chnum]}) { }
0 1 elsif (exists $opts{'all'}) { }
4032 5 0 if ($opts{'maps'} and $self->{'IMG'})
4041 1 6 unless $self->_valid_image("difference")
4044 4 2 unless defined $opts{'mindist'}
4047 0 6 unless defined $opts{'other'}
4048 1 5 unless ($opts{'other'}->_valid_image("difference"))
4056 0 5 unless $result->{'IMG'} = &i_diff_image($self->{'IMG'}, $opts{'other'}{'IMG'}, $opts{'mindist'})
4064 0 1 unless $self->_valid_image("rgb_difference")
4068 0 1 unless defined $opts{'other'}
4069 0 1 unless ($opts{'other'}->_valid_image("rgb_difference"))
4076 0 1 unless $result->{'IMG'} = &i_rgbdiff_image($self->{'IMG'}, $opts{'other'}{'IMG'})
4095 1 2056 unless $self->_valid_image("getwidth")
4106 1 1753 unless $self->_valid_image("getheight")
4117 1 652 unless $self->_valid_image("getchannels")
4128 1 6 unless $self->_valid_image("colormodel")
4133 1 5 $opts{'numeric'} ? :
4139 1 5 unless $self->_valid_image("colorchannels")
4148 1 5 unless $self->_valid_image("alphachannel")
4159 1 1 unless $self->_valid_image("getmask")
4171 28 0 if $] >= "5.014"
4174 1 27 unless $self->_valid_image("setmask")
4177 0 27 unless (defined $opts{'mask'})
4193 1 9 unless $self->_valid_image("getcolorcount")
4197 1 8 $rc == -1 ? :
4205 1 3 unless $self->_valid_image("getcolorusagehash")
4210 0 3 unless (defined $max_colors and $max_colors > 0)
4218 0 3 if $channels == 2 or $channels == 4
4226 1 125 if keys %color_use > $max_colors
4238 1 5 unless $self->_valid_image("getcolorusage")
4243 0 5 unless (defined $max_colors and $max_colors > 0)
4256 1 0 unless $self->_valid_image("string")
4260 0 0 unless defined $input{'string'}
4262 0 0 unless (defined $input{'string'})
4267 0 0 unless ($input{'font'})
4272 0 0 unless ($input{'font'}->draw("image", $self, %input))
4283 1 0 if (ref $self) { }
4284 1 0 unless $self->_valid_image("align_string")
4295 0 0 unless defined $input{'string'}
4297 0 0 unless (exists $input{'string'})
4302 0 0 unless ($input{'font'})
4308 0 0 unless (@result = $input{'font'}->align("image", $img, %input))
4312 0 0 wantarray ? :
4323 23 2 if ($opts{'reset'}) { }
4331 22 53 if defined $opts{$key}
4353 1 10 if ($opts{'sample_size'} and $opts{'sample_size'} eq "float")
4358 1 37 unless (defined $opts{$name})
4362 1 36 unless ($opts{$name} == int $opts{$name})
4369 6 3 unless ($result)
4395 250 71 if (ref $_[0]) { }
4401 169 30 if (ref $self) { }
4440 0 115 unless my($ext) = $name =~ /\.([^.]+)$/
4444 2 113 unless ($type)
4448 0 115 if (not defined $type and $ext =~ /\A[a-zA-Z0-9_]{2,}\z/)
4460 1 0 unless exists $ext_types{lc $ext}
4473 0 1394 if ($_ < $mx)
4481 1124 19 if ($_ > $mx)
4506 0 0 unless defined $str
4513 0 0 if (/^\004\004/)
4516 0 0 if ($item =~ /^x/)
4520 0 0 if ($item =~ /^P/)
4524 0 0 if ($item =~ /^i/)
4528 0 0 if ($item =~ /^n/)
4542 0 0 unless $lang eq "C" or $lang eq "CPP"
4560 1 0 if $INC[-1] eq "."
4581 1 18 if (tied *$fh) { }
4592 0 2 unless defined $count
4594 1 1 unless $count
4599 2 0 if ($_[1] != 1 or $_[0] != 0)
4600 0 2 unless (CORE::seek $fh, $_[0], $_[1])
4636 0 50 if ($loaded) { }
4640 50 0 if ($error =~ /^Can't locate /)
4654 6 5 if exists $self->[0]{$key}
4656 4 1 unless $self->[3]{$key}
4676 0 0 if (exists $self->[0]{$key})
4677 0 0 unless my $value = $self->[0]{$key}
4682 0 0 unless $self->_check($key)
4690 7 10 unless (@{$self->[1];})
4696 0 49 if $self->[0]{$key}
4698 0 49 if $self->_check($key)
4702 0 17 unless @{$self->[1];}
4710 17 68 unless $self->[2] < @{$self->[1];}