Branch Coverage

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


line true false branch
150 0 57 if ($ex_version < "5.57")
254 2 44 unless &i_conv($hsh{'image'}, $hsh{'coef'})
282 0 3 unless my $new_color = _color($color)
289 0 1 unless &i_nearest_color($hsh{'image'}, $hsh{'xo'}, $hsh{'yo'}, \@colors, $hsh{'dist'})
339 0 3 unless my $new_color = _color($old)
429 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)
459 0 30 if ($_[$i] eq '-log-stderr') { }
478 0 8 if (exists $parms{'warn_obsolete'})
482 8 0 if ($parms{'log'})
484 0 8 unless "Imager"->open_log("log", $parms{'log'}, "level", $parms{'loglevel'})
487 0 8 if (exists $parms{'t1log'})
488 0 0 if ($formats{'t1'})
489 0 0 if (Imager::Font::T1::i_init_t1($parms{'t1log'}))
507 0 34 unless ($is_logging)
525 1 34 unless defined $level
536 0 57 if ($DEBUG)
552 0 0 if ($^O eq "android")
558 0 0 unless (defined $DSO_handle)
560 0 0 if ($DEBUG)
562 0 0 if ($filters{$_})
568 0 0 if $DEBUG
570 0 0 if $@
580 0 0 if ($^O eq "android")
585 0 0 unless ($DSOs{$filename})
589 0 0 if $DEBUG
592 0 0 unless (defined $rc)
618 660 364 if (ref $arg) { }
619 521 139 if (UNIVERSAL::isa($arg, 'Imager::Color') or UNIVERSAL::isa($arg, 'Imager::Color::Float')) { }
624 3 136 if ($copy =~ /^HASH\(/) { }
136 0 elsif ($copy =~ /^ARRAY\(/) { }
646 55 68 if (not defined $combine and ref $self)
649 91 32 unless defined $combine
650 91 32 unless defined $combine
652 85 38 if (exists $combine_types{$combine})
662 0 8673 unless ref $self
665 8605 68 if $self->{'IMG'} and builtin::blessed($self->{'IMG'})
667 0 68 $self->{'IMG'} ? :
668 68 0 if $method
677 75 87 if defined $_
698 0 1278 if $self->{'DEBUG'}
699 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) { }
711 6 8 if ($hsh{'filetype'})
714 5 9 unless ($self->read(%hsh, %extras))
720 25 527 unless ($self->img_set(%hsh))
739 1 216 unless $self->_valid_image("copy")
742 1 215 unless (defined wantarray)
758 1 28 unless $self->_valid_image("paste")
763 1 27 unless ($src)
767 1 26 unless ($src->_valid_image("paste"))
771 1 25 if $input{'left'} <= 0
772 1 25 if $input{'top'} <= 0
777 1 25 if ($input{'src_coords'}) { }
781 2 23 if (defined $input{'src_maxx'}) { }
1 22 elsif (defined $input{'width'}) { }
785 0 1 if ($input{'width'} <= 0)
794 3 22 if (defined $input{'src_maxy'}) { }
1 21 elsif (defined $input{'height'}) { }
798 0 1 if ($input{'height'} < 0)
809 0 26 if $src_right > $r
810 0 26 if $src_bottom > $b
812 0 26 if ($src_right <= $src_left or $src_bottom < $src_top)
830 1 47 unless $self->_valid_image("crop")
833 1 46 unless (defined wantarray)
845 34 12 if (defined $l) { }
3 9 elsif (defined $r) { }
1 8 elsif (defined $w) { }
846 1 33 if (defined $w) { }
1 32 elsif (not defined $r) { }
854 2 1 if (defined $w) { }
869 36 10 if (defined $t) { }
3 7 elsif (defined $b) { }
1 6 elsif (defined $h) { }
870 4 32 if (defined $h) { }
1 31 elsif (not defined $b) { }
878 2 1 if (defined $h) { }
894 0 46 if $l > $r
895 0 46 if $t > $b
897 1 45 if $l < 0
898 2 44 if $r > $self->getwidth
899 1 45 if $t < 0
900 3 43 if $b > $self->getheight
902 2 44 if ($l == $r or $t == $b)
906 2 42 if ($r < $l or $b < $t)
921 0 15 unless $self->_valid_image($name)
928 15 0 unless defined $tolerance
930 0 15 if (keys %hsh)
935 5 10 if ($auto)
936 0 5 if ($colors != $empty_trim_colors)
940 0 5 if ($tolerance < 0)
952 0 5 unless ($colors)
958 0 15 unless (ref $colors)
962 5 10 unless (UNIVERSAL::isa($colors, "Imager::TrimColorList"))
963 0 5 unless (builtin::reftype($colors) eq "ARRAY")
982 0 4 unless my($left, $top, $right, $bottom) = $self->_trim_rect("trim", %hsh)
985 0 4 if ($left == $self->getwidth) { }
1000 0 42 unless $self->_valid_image
1008 42 0 if ($channels == $self->getchannels) { }
1014 0 42 unless ($out->{'IMG'})
1040 4 548 if ($hsh{'model'})
1041 4 0 if (my $channels = $model_channels{$hsh{'model'}}) { }
1050 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) { }
1065 25 527 unless ($self->{'IMG'})
1077 1 16 unless $self->_valid_image("masked")
1085 3 13 $opts{'mask'} ? :
1089 3 29 if ($val < 0)
1094 3 29 if ($val < 0)
1103 7 9 unless ($result->{'IMG'})
1119 13 1 if (@_ != 1 and not ref $_[0]) { }
1126 1 13 unless (defined wantarray)
1132 1 12 unless $self->_valid_image("to_paletted")
1136 2 10 unless ($result->{'IMG'} = &i_img_to_pal($self->{'IMG'}, $opts))
1147 1 6 unless (@images)
1153 1 6 unless ($img->{'IMG'})
1161 1 4 unless (@cols)
1172 1 2 unless (defined wantarray)
1178 1 1 unless $self->_valid_image("to_rgb8")
1182 0 1 unless ($result->{'IMG'} = &i_img_to_rgb($self->{'IMG'}))
1194 0 9 unless (defined wantarray)
1200 1 8 unless $self->_valid_image("to_rgb16")
1204 0 8 unless ($result->{'IMG'} = &i_img_to_rgb16($self->{'IMG'}))
1216 0 3 unless (defined wantarray)
1222 1 2 unless $self->_valid_image("to_rgb_double")
1226 0 2 unless ($result->{'IMG'} = &i_img_to_drgb($self->{'IMG'}))
1238 1 23 unless $self->_valid_image("addcolors")
1241 0 23 unless my(@colors) = @{$opts{'colors'};}
1246 1 48 unless ($color)
1259 1 11 unless $self->_valid_image("setcolors")
1262 1 10 unless my(@colors) = @{$opts{'colors'};}
1267 1 13 unless ($color)
1280 1 14 unless $self->_valid_image("getcolors")
1283 9 5 if (not exists $opts{'start'} || exists $opts{'count'}) { }
5 0 elsif (not exists $opts{'count'}) { }
0 0 elsif (not exists $opts{'start'}) { }
1301 1 14 unless $self->_valid_image("colorcount")
1310 1 2 unless $self->_valid_image("maxcolors")
1320 1 8 unless $self->_valid_image("findcolor")
1323 0 8 unless ($opts{'color'})
1329 0 8 unless my $color = _color($opts{'color'})
1337 1 54 unless $self->_valid_image("bits")
1341 12 42 if ($bits and $bits == 64)
1350 1 56 unless $self->_valid_image("type")
1353 30 26 &i_img_type($self->{'IMG'}) ? :
1359 1 1 unless $self->_valid_image("virtual")
1368 1 24 unless $self->_valid_image("is_bilevel")
1377 1 97 unless $self->_valid_image("tags")
1380 97 0 if (defined $opts{'name'}) { }
0 0 elsif (defined $opts{'code'}) { }
1388 5 92 wantarray ? :
1401 0 0 if (wantarray) { }
1416 1 34 unless $self->_valid_image("addtag")
1420 32 2 if ($opts{'name'}) { }
2 0 elsif ($opts{'code'}) { }
1421 32 0 if (defined $value) { }
0 0 elsif (defined $opts{'data'}) { }
1422 21 11 if ($value =~ /$int_re/ and $value >= -2147483648 and $value <= 2147483647) { }
1440 2 0 if $] >= "5.014"
1442 2 0 if (defined $value) { }
0 0 elsif (defined $opts{'data'}) { }
1443 2 0 if ($value =~ /$int_re/ and $value >= -2147483648 and $value <= 2147483647) { }
1469 1 20 unless $self->_valid_image("deltag")
1472 0 20 if (defined $opts{'index'}) { }
20 0 elsif (defined $opts{'name'}) { }
0 0 elsif (defined $opts{'code'}) { }
1479 0 0 if $] >= "5.014"
1492 1 22 unless $self->_valid_image("settag")
1495 20 2 if ($opts{'name'}) { }
2 0 elsif (defined $opts{'code'}) { }
1500 2 0 if $] >= "5.014"
1503 2 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1504 2 0 if ($opts{'value'} =~ /^\d+$/) { }
1530 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'}) { }
1537 0 11 unless (&Scalar::Util::openhandle($input->{'fh'}))
1545 0 135 unless (CORE::open $file, "<", $input->{'file'})
1556 0 8 unless ($input->{'seekcb'})
1559 0 8 if ($input->{'maxbuffer'}) { }
1580 1 167 exists $input->{'buffered'} ? :
1584 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'}) { }
1591 0 6 unless (&Scalar::Util::openhandle($input->{'fh'}))
1599 0 113 unless (CORE::open $fh, "+>", $input->{'file'})
1603 0 113 unless binmode $fh
1611 4 6 if ($input->{'maxbuffer'} and $input->{'maxbuffer'} == 1)
1623 5 163 unless ($buffered)
1643 0 1 unless (&i_add_file_magic($name, $bits, $mask))
1657 22 196 if (defined $self->{'IMG'})
1664 0 218 unless my($IO, $fh) = $self->_get_reader_io(\%input)
1667 112 106 unless ($type)
1671 1 217 if ($input{'file'} and not $type)
1676 2 216 unless ($type)
1678 1 1 if $input{'file'}
1685 0 0 if ($readers{$type} and $readers{$type}{'single'})
1689 3 213 unless ($formats_low{$type})
1696 194 19 unless defined $allow_incomplete
1698 75 138 if ($type eq "pnm")
1700 20 55 unless (defined $self->{'IMG'})
1704 0 55 if $self->{'DEBUG'}
1708 98 40 if ($type eq "bmp")
1710 46 52 unless (defined $self->{'IMG'})
1714 0 52 if $self->{'DEBUG'}
1717 22 70 if ($type eq "tga")
1719 4 18 unless (defined $self->{'IMG'})
1723 0 18 if $self->{'DEBUG'}
1726 18 70 if ($type eq "raw")
1727 0 18 unless ($input{'xsize'} and $input{'ysize'})
1733 1 17 unless (defined $interleave)
1747 4 14 unless (defined $self->{'IMG'})
1751 0 14 if $self->{'DEBUG'}
1761 0 3 unless defined $opts{'type'}
1766 0 3 unless defined $opts{'single'} or defined $opts{'multiple'}
1769 3 0 if ($opts{'single'})
1772 2 1 if ($opts{'multiple'})
1783 0 3 unless defined $opts{'type'}
1788 0 3 unless defined $opts{'single'} or defined $opts{'multiple'}
1791 3 0 if ($opts{'single'})
1794 2 1 if ($opts{'multiple'})
1828 3 57 if ($attempted_to_load{$file}) { }
1829 3 0 if ($file_load_errors{$file}) { }
1841 56 1 if $INC[-1] eq "."
1846 0 57 if ($loaded) { }
1866 214 3 if $formats_low{$type} or $readers{$type}
1868 0 3 unless $type =~ /^\w+$/
1874 2 1 if (not $loaded and $error =~ /^Can't locate /)
1877 2 0 if ($error =~ /^Can't locate /)
1881 3 0 unless ($loaded)
1890 168 3 if $formats_low{$type} or $writers{$type}
1892 0 3 unless $type =~ /^\w+$/
1898 2 1 if (not $loaded and $error =~ /^Can't locate /)
1901 2 0 if ($error =~ /^Can't locate /)
1905 3 0 unless ($loaded)
1919 0 0 if defined $y
1941 0 3292 if ($obsolete_opts{$opt})
1944 0 0 if (ref $new) { }
1952 0 0 if $warn_obsolete and $^W
1954 3273 19 unless $tagname =~ /^\Q$prefix\E/
1956 3 16 if ($color_opts{$opt})
1958 0 3 unless ($value)
1963 3 16 if (ref $value) { }
1964 3 0 if (UNIVERSAL::isa($value, 'Imager::Color')) { }
0 0 elsif (ref $value eq 'ARRAY') { }
1973 0 0 if (ref $val) { }
1974 0 0 if (UNIVERSAL::isa($val, 'Imager::Color')) { }
1976 0 0 if $i < @imgs
1986 0 0 if $i < @imgs
2021 1 171 unless $self->_valid_image("write")
2024 0 171 unless $self->_set_opts(\%input, "i_", $self)
2028 95 0 if (not $type and $input{'file'})
2031 0 171 unless ($type)
2039 0 171 if ($writers{$type} and $writers{$type}{'single'}) { }
2040 0 0 unless ($IO, $fh) = $self->_get_writer_io(\%input)
2043 0 0 unless $writers{$type}{'single'}->($self, $IO, %input, "type", $type)
2047 3 168 unless ($formats_low{$type})
2053 0 168 unless ($IO, $fh) = $self->_get_writer_io(\%input, $type)
2056 121 47 if ($type eq 'pnm') { }
10 37 elsif ($type eq 'raw') { }
21 16 elsif ($type eq 'bmp') { }
16 0 elsif ($type eq 'tga') { }
2057 0 121 unless $self->_set_opts(\%input, "pnm_", $self)
2059 5 116 unless (&i_writeppm_wiol($self->{'IMG'}, $IO))
2063 0 116 if $self->{'DEBUG'}
2066 0 10 unless $self->_set_opts(\%input, "raw_", $self)
2068 4 6 unless (&i_writeraw_wiol($self->{'IMG'}, $IO))
2072 0 6 if $self->{'DEBUG'}
2075 0 21 unless $self->_set_opts(\%input, "bmp_", $self)
2077 12 9 unless (&i_writebmp_wiol($self->{'IMG'}, $IO))
2081 0 9 if $self->{'DEBUG'}
2084 0 16 unless $self->_set_opts(\%input, "tga_", $self)
2087 4 12 unless (&i_writetga_wiol($self->{'IMG'}, $IO, $input{'wierdpack'}, $input{'compress'}, $input{'idstring'}))
2091 0 12 if $self->{'DEBUG'}
2095 17 126 if (exists $input{'data'})
2097 0 17 unless ($data)
2111 0 0 if (not $type and $opts->{'file'})
2114 0 3 unless ($type)
2121 1 2 unless (ref $img and builtin::blessed($img) and $img->isa("Imager"))
2125 1 1 unless ($img->_valid_image("write_multi"))
2131 0 0 unless $class->_set_opts($opts, "i_", @images)
2138 0 0 if ($writers{$type} and $writers{$type}{'multiple'}) { }
2139 0 0 unless ($IO, $file) = $class->_get_writer_io($opts, $type)
2142 0 0 unless $writers{$type}{'multiple'}->($class, $IO, $opts, @images)
2146 0 0 unless ($formats{$type})
2152 0 0 unless ($IO, $file) = $class->_get_writer_io($opts, $type)
2158 0 0 if (@images == 1) { }
2159 0 0 unless ($images[0]->write(%$opts, "io", $IO, "type", $type))
2170 0 0 if (exists $opts->{'data'})
2172 0 0 unless ($data)
2185 0 3 unless my($IO, $file) = $class->_get_reader_io(\%opts, $opts{'type'})
2189 3 0 unless ($type)
2193 1 2 if ($opts{'file'} and not $type)
2198 2 1 unless ($type)
2200 1 1 if $opts{'file'}
2207 0 0 if ($readers{$type} and $readers{$type}{'multiple'})
2211 0 1 unless ($formats{$type})
2218 1 0 if ($type eq 'pnm') { }
2223 0 0 if ($img->read(%opts, "io", $IO, "type", $type))
2230 0 1 unless (@imgs)
2244 1120 161 if (defined $self->{'IMG'}) { }
2264 1 86 unless $self->_valid_image("filter")
2267 0 86 unless ($input{'type'})
2269 0 86 unless (exists $filters{$input{'type'}})
2273 10 76 if ($filters{$input{'type'}}{'names'})
2276 12 28 if (defined $input{$name} and exists $names->{$name}{$input{$name}})
2281 85 1 if (defined $filters{$input{'type'}}{'defaults'}) { }
2295 0 292 unless (defined $hsh{$_})
2304 4 82 if ($@)
2311 0 82 if $self->{'DEBUG'}
2312 0 82 if $self->{'DEBUG'}
2322 0 1 unless defined $hsh{'type'}
2324 0 1 unless defined $hsh{'callsub'}
2326 0 1 unless defined $hsh{'callseq'}
2329 0 1 if exists $filters{$hsh{'type'}}
2343 1 360 if (defined $opts{$name} and ref $opts{$name})
2352 58 2 if (ref $self) { }
2353 58 0 unless defined $width
2354 58 0 unless defined $height
2357 1 1 unless (defined $width and defined $height)
2363 8 51 if ($opts{'xscalefactor'} and $opts{'yscalefactor'}) { }
3 48 elsif ($opts{'xscalefactor'}) { }
3 45 elsif ($opts{'yscalefactor'}) { }
2380 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')) { }
2383 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') { }
2410 0 0 unless ($scalefactor)
2418 3 55 unless $new_width > 0
2420 3 55 unless $new_height > 0
2434 1 59 unless (defined wantarray)
2440 1 58 unless $self->_valid_image("scale")
2443 2 56 unless my($x_scale, $y_scale, $new_width, $new_height) = $self->scale_calculate(%opts)
2447 17 39 if ($opts{'qtype'} eq 'normal') { }
18 21 elsif ($opts{'qtype'} eq 'preview') { }
20 1 elsif ($opts{'qtype'} eq 'mixing') { }
2449 0 17 unless (defined $tmp->{'IMG'})
2454 0 17 unless (defined $img->{'IMG'})
2463 0 18 unless (defined $img->{'IMG'})
2471 0 20 unless ($img->{'IMG'})
2489 1 10 unless (defined wantarray)
2495 1 9 unless $self->_valid_image("scaleX")
2502 3 6 if ($opts{'pixels'})
2506 0 9 unless ($self->{'IMG'})
2513 0 9 unless (defined $img->{'IMG'})
2527 1 10 unless (defined wantarray)
2533 1 9 unless $self->_valid_image("scaleY")
2540 3 6 if ($opts{'pixels'})
2544 0 9 unless ($self->{'IMG'})
2550 0 9 unless (defined $img->{'IMG'})
2573 0 0 unless $self->_valid_image("transform")
2576 0 0 if ($opts{'xexpr'} and $opts{'yexpr'})
2577 0 0 unless ($I2P)
2580 0 0 if $INC[-1] eq "."
2584 0 0 if ($@)
2607 0 0 if (/$numre/) { }
2608 0 0 if (/$numre/) { }
2614 0 0 if (not exists $opts{'xopcodes'} or @{$opts{'xopcodes'};} == 0)
2621 0 0 unless (defined $OPCODES{$iop} or $iop =~ /^\d+$/)
2625 0 0 exists $OPCODES{$iop} ? :
2631 0 0 if (not exists $opts{'yopcodes'} or @{$opts{'yopcodes'};} == 0)
2638 0 0 unless (defined $OPCODES{$iop} or $iop =~ /^\d+$/)
2642 0 0 exists $OPCODES{$iop} ? :
2647 0 0 unless (exists $opts{'parm'})
2658 0 0 unless (defined $img->{'IMG'})
2670 26 4 if (@imgs)
2673 1 27 unless ($img->_valid_image("transform2"))
2691 28 1 if ($width) { }
2699 28 0 if ($height) { }
2708 0 28 unless ($code)
2713 0 28 unless ($channels >= 1 and $channels <= 4)
2722 1 27 unless (defined $img->{'IMG'})
2734 1 21 unless $self->_valid_image("rubthrough")
2737 1 20 unless ($opts{'src'} and $opts{'src'}->_valid_image("rubthrough"))
2749 18 2 unless defined $tx
2750 2 18 unless defined $tx
2753 18 2 unless defined $ty
2754 2 18 unless defined $ty
2756 0 20 unless (&i_rubthru($self->{'IMG'}, $opts{'src'}{'IMG'}, $tx, $ty, $opts{'src_minx'}, $opts{'src_miny'}, $opts{'src_maxx'}, $opts{'src_maxy'}))
2776 1 57 unless $self->_valid_image("compose")
2779 0 57 unless ($opts{'src'})
2784 1 56 unless ($opts{'src'}->_valid_image("compose"))
2791 56 0 unless defined $left
2792 9 47 unless defined $left
2795 56 0 unless defined $top
2796 9 47 unless defined $top
2799 48 8 unless defined $src_left
2800 48 8 unless defined $src_left
2803 48 8 unless defined $src_top
2804 48 8 unless defined $src_top
2807 0 56 if (not defined $width and defined $opts{'src_maxx'})
2810 52 4 unless defined $width
2813 0 56 if (not defined $height and defined $opts{'src_maxy'})
2816 52 4 unless defined $height
2820 31 25 if ($opts{'mask'}) { }
2821 1 30 unless ($opts{'mask'}->_valid_image("compose"))
2827 0 30 unless defined $mask_left
2828 0 30 unless defined $mask_left
2831 0 30 unless defined $mask_top
2832 0 30 unless defined $mask_top
2834 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'}))
2843 10 15 unless (&i_compose($self->{'IMG'}, $src->{'IMG'}, $left, $top, $src_left, $src_top, $width, $height, $combine, $opts{'opacity'}))
2857 1 143 unless $self->_valid_image("flip")
2862 0 143 unless defined $opts{'dir'} and defined $xlate{$opts{'dir'}}
2864 143 0 if &i_flipxy($self->{'IMG'}, $dir)
2872 1 42 unless (defined wantarray)
2878 1 41 unless $self->_valid_image("rotate")
2881 30 11 if (defined $opts{'right'}) { }
11 0 elsif (defined $opts{'radians'} or defined $opts{'degrees'}) { }
2883 0 30 if ($degrees < 0)
2887 2 28 if ($degrees == 0) { }
28 0 elsif ($degrees == 90 or $degrees == 180 or $degrees == 270) { }
2892 28 0 if ($result->{'IMG'} = &i_rotate90($self->{'IMG'}, $degrees)) { }
2910 6 5 if ($back) { }
2912 1 5 unless ($back)
2922 10 0 if ($result->{'IMG'}) { }
2940 1 4 unless $self->_valid_image("matrix_transform")
2943 1 3 unless (defined wantarray)
2949 3 0 if ($opts{'matrix'}) { }
2954 1 2 if ($opts{'back'}) { }
2957 0 1 unless $result->{'IMG'} = &i_matrix_transform($self->{'IMG'}, $xsize, $ysize, $opts{'matrix'}, $opts{'back'})
2962 0 2 unless $result->{'IMG'} = &i_matrix_transform($self->{'IMG'}, $xsize, $ysize, $opts{'matrix'})
2991 1 982 unless $self->_valid_image("box")
2997 567 415 if (exists $opts{'box'}) { }
3004 284 131 unless defined($xmin = $opts{'xmin'})
3005 282 133 unless defined($xmax = $opts{'xmax'})
3006 302 113 unless defined($ymin = $opts{'ymin'})
3007 301 114 unless defined($ymax = $opts{'ymax'})
3010 865 117 if ($opts{'filled'}) { }
113 4 elsif ($opts{'fill'}) { }
3013 863 2 if (defined $color) { }
3014 145 718 unless (&_is_color_object($color))
3016 0 145 unless ($color)
3026 828 37 if ($color->isa('Imager::Color')) { }
3034 6 107 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3037 0 6 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3046 3 1 if (defined $color) { }
3047 2 1 unless (&_is_color_object($color))
3049 0 2 unless ($color)
3058 0 4 unless ($color)
3071 1 257 unless $self->_valid_image("arc")
3086 133 124 if ($opts{'aa'}) { }
3087 2 131 if ($opts{'fill'}) { }
33 98 elsif ($opts{'filled'}) { }
3088 2 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3091 0 2 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3096 1 1 if ($opts{'d1'} == 0 and $opts{'d2'} == 361) { }
3107 0 33 unless ($color)
3111 8 25 if ($opts{'d1'} == 0 and $opts{'d2'} == 361 and $opts{'aa'}) { }
3122 25 73 if ($opts{'d2'} - $opts{'d1'} >= 360) { }
3131 10 114 if ($opts{'fill'}) { }
3132 10 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3135 1 9 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3145 0 114 unless ($color)
3149 52 62 if ($opts{'filled'}) { }
3154 13 49 if ($opts{'d1'} == 0 and $opts{'d2'} == 361) { }
3163 0 255 unless ($good)
3182 1 211 unless $self->_valid_image("line")
3185 0 211 unless (exists $opts{'x1'} and exists $opts{'y1'})
3186 0 211 unless (exists $opts{'x2'} and exists $opts{'y2'})
3189 0 211 unless ($color)
3194 145 66 if defined $opts{'aa'}
3195 146 65 if ($opts{'antialias'}) { }
3214 1 5 unless $self->_valid_image("polyline")
3217 1 4 if (exists $opts{'points'})
3218 4 0 if (not exists $opts{'points'} and exists $opts{'x'} and exists $opts{'y'})
3225 0 5 unless ($color)
3229 1 4 if defined $opts{'aa'}
3230 2 3 if ($opts{'antialias'}) { }
3232 4 2 if (defined $ls)
3239 263 3 if (defined $ls)
3254 1 10 unless $self->_valid_image("polygon")
3257 8 2 if (exists $opts{'points'})
3262 0 10 unless (exists $opts{'x'} and exists $opts{'y'})
3268 4 6 if ($opts{'fill'}) { }
3269 3 1 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3272 0 3 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3277 1 3 unless (&i_poly_aa_cfill_m($self->{'IMG'}, $opts{'x'}, $opts{'y'}, $mode, $opts{'fill'}{'fill'}))
3284 0 6 unless ($color)
3288 1 5 unless (&i_poly_aa_m($self->{'IMG'}, $opts{'x'}, $opts{'y'}, $mode, $color))
3299 0 6 unless $self->_valid_image("polypolygon")
3303 0 6 unless $points
3308 6 0 if ($opts{'filled'}) { }
0 0 elsif ($opts{'fill'}) { }
3309 0 6 unless my $color = _color(_first($opts{'color'}, [0, 0, 0, 0]))
3312 0 6 unless &i_poly_poly_aa($self->{'IMG'}, $points, $mode, $color)
3317 0 0 unless $self->_valid_fill($fill, "polypolygon")
3321 0 0 unless &i_poly_poly_aa_cfill($self->{'IMG'}, $points, $mode, $fill->{'fill'})
3324 0 0 unless my $color = _color(_first($opts{'color'}, [0, 0, 0, 255]))
3329 0 0 if (_first($opts{'aa'}, 1)) { }
3369 0 0 unless $self->_valid_image("polybezier")
3372 0 0 if (exists $opts{'points'})
3377 0 0 unless (@{$opts{'x'};} and @{$opts{'x'};} == @{$opts{'y'};})
3383 0 0 unless ($color)
3396 1 89 unless $self->_valid_image("flood_fill")
3399 0 89 unless (exists $opts{'x'} and exists $opts{'y'})
3404 2 87 if ($opts{'border'}) { }
3406 0 2 unless ($border)
3410 1 1 if ($opts{'fill'}) { }
3411 1 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3414 0 1 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3424 0 1 unless ($color)
3431 2 0 if ($rc) { }
3440 1 86 if ($opts{'fill'}) { }
3441 1 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3444 0 1 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3453 0 86 unless ($color)
3459 87 0 if ($rc) { }
3472 1 127 unless $self->_valid_image("setpixel")
3476 1 126 unless (defined $color)
3478 1 0 unless defined $color
3481 84 43 unless (ref $color and UNIVERSAL::isa($color, "Imager::Color"))
3482 1 83 unless ($color = _color($color, "setpixel"))
3488 2 124 unless (exists $opts{'x'} and exists $opts{'y'})
3495 9 115 if (ref $x or ref $y) { }
3496 7 2 ref $x ? :
3497 7 2 ref $y ? :
3498 1 8 unless (@$x)
3502 1 7 unless (@$y)
3508 1 6 if (@$x < @$y) { }
1 5 elsif (@$y < @$x) { }
3516 5 2 if ($color->isa('Imager::Color')) { }
3518 15 2 unless &i_ppix($self->{'IMG'}, $x->[$i], $y->[$i], $color)
3524 6 2 unless &i_ppixf($self->{'IMG'}, $x->[$i], $y->[$i], $color)
3532 84 31 if ($color->isa('Imager::Color')) { }
3533 18 66 if &i_ppix($self->{'IMG'}, $x, $y, $color)
3537 18 13 if &i_ppixf($self->{'IMG'}, $x, $y, $color)
3550 1 238 unless $self->_valid_image("getpixel")
3553 2 236 unless (exists $opts{'x'} and exists $opts{'y'})
3561 19 217 if (ref $x or ref $y) { }
3562 17 2 ref $x ? :
3563 15 4 ref $y ? :
3564 1 18 unless (@$x)
3568 1 17 unless (@$y)
3574 1 16 if (@$x < @$y) { }
3 13 elsif (@$y < @$x) { }
3582 13 4 if ($type eq '8bit') { }
3 1 elsif ($type eq 'float' or $type eq 'double') { }
3596 16 0 wantarray ? :
3599 195 22 if ($type eq '8bit') { }
21 1 elsif ($type eq 'float' or $type eq 'double') { }
3616 1 38 unless $self->_valid_image("getscanline")
3619 17 21 unless defined $opts{'width'}
3621 1 37 unless (defined $opts{'y'})
3626 16 21 if ($opts{'type'} eq '8bit') { }
12 9 elsif ($opts{'type'} eq 'float') { }
8 1 elsif ($opts{'type'} eq 'index') { }
3635 0 8 unless (&i_img_type($self->{'IMG'}))
3652 1 214 unless $self->_valid_image("setscanline")
3655 0 214 unless (defined $opts{'y'})
3660 200 14 unless ($opts{'type'})
3661 49 151 if (ref $opts{'pixels'} and @{$opts{'pixels'};}) { }
3663 32 17 if ($opts{'pixels'}[0]->isa('Imager::Color')) { }
17 0 elsif ($opts{'pixels'}[0]->isa('Imager::Color::Float')) { }
3680 183 31 if ($opts{'type'} eq '8bit') { }
18 13 elsif ($opts{'type'} eq 'float') { }
13 0 elsif ($opts{'type'} eq 'index') { }
3681 32 151 if (ref $opts{'pixels'}) { }
3689 17 1 if (ref $opts{'pixels'}) { }
3697 9 4 if (ref $opts{'pixels'}) { }
3714 1 312 unless $self->_valid_image("getsamples")
3717 288 24 unless defined $opts{'width'}
3719 0 312 unless (defined $opts{'y'})
3724 3 309 if ($opts{'target'}) { }
3727 1 2 if ($opts{'type'} eq '8bit') { }
1 1 elsif ($opts{'type'} eq 'float') { }
1 0 elsif ($opts{'type'} =~ /^(\d+)bit$/) { }
3730 0 1 unless my(@samples) = &i_gsamp($self->{'IMG'}, $opts{'x'}, $opts{'x'} + $opts{'width'}, $opts{'y'}, $opts{'channels'})
3747 0 1 unless (defined $count)
3760 297 12 if ($opts{'type'} eq '8bit') { }
12 0 elsif ($opts{'type'} eq 'float') { }
0 0 elsif ($opts{'type'} =~ /^(\d+)bit$/) { }
3774 0 0 unless &i_gsamp_bits($self->{'IMG'}, $opts{'x'}, $opts{'x'} + $opts{'width'}, $opts{'y'}, $bits, \@data, 0, $opts{'channels'})
3787 1 14 unless $self->_valid_image("setsamples")
3795 13 35 if ($_[$i] eq 'data') { }
3805 1 13 unless (defined $data_index)
3809 1 12 unless (defined $_[$data_index])
3815 5 7 unless defined $type
3818 0 12 defined $opts{'width'} ? :
3821 5 7 if ($type eq '8bit') { }
5 2 elsif ($type eq 'float') { }
1 1 elsif ($type =~ /^([0-9]+)bit$/) { }
3832 0 1 unless (ref $_[$data_index])
3846 4 7 unless (defined $count)
3870 1 17 unless $self->_valid_image("convert")
3873 1 16 unless (defined wantarray)
3881 14 2 if (not exists $opts{'matrix'}) { }
3882 14 0 if (exists $opts{'preset'}) { }
3887 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') { }
3889 3 0 if ($self->getchannels == 3) { }
0 0 elsif ($self->getchannels == 4) { }
3904 1 0 if ($self->getchannels == 2 or $self->getchannels == 4) { }
3923 0 0 if ($self->getchannels == 2 or $self->getchannels == 4) { }
3932 6 0 if ($self->getchannels == 1) { }
0 0 elsif ($self->getchannels == 2) { }
3944 0 1 if ($self->getchannels == 1) { }
1 0 elsif ($self->getchannels == 3) { }
3966 1 15 unless ($new->{'IMG'})
3980 1 13 unless ($src)
3987 1 20 unless (eval { do { $img->isa("Imager") } })
3991 1 19 unless ($img->_valid_image("combine"))
3998 4 7 if (my $channels = delete $opts{'channels'}) { }
4004 4 7 unless ($result)
4022 1 5 unless $self->_valid_image("map")
4025 1 4 unless (exists $opts{'maps'})
4029 3 1 if (exists $opts{$chlist[$chnum]}) { }
0 1 elsif (exists $opts{'all'}) { }
4036 5 0 if ($opts{'maps'} and $self->{'IMG'})
4045 1 6 unless $self->_valid_image("difference")
4048 4 2 unless defined $opts{'mindist'}
4051 0 6 unless defined $opts{'other'}
4052 1 5 unless ($opts{'other'}->_valid_image("difference"))
4060 0 5 unless $result->{'IMG'} = &i_diff_image($self->{'IMG'}, $opts{'other'}{'IMG'}, $opts{'mindist'})
4068 0 1 unless $self->_valid_image("rgb_difference")
4072 0 1 unless defined $opts{'other'}
4073 0 1 unless ($opts{'other'}->_valid_image("rgb_difference"))
4080 0 1 unless $result->{'IMG'} = &i_rgbdiff_image($self->{'IMG'}, $opts{'other'}{'IMG'})
4099 1 2056 unless $self->_valid_image("getwidth")
4110 1 1753 unless $self->_valid_image("getheight")
4121 1 652 unless $self->_valid_image("getchannels")
4132 1 6 unless $self->_valid_image("colormodel")
4137 1 5 $opts{'numeric'} ? :
4143 1 5 unless $self->_valid_image("colorchannels")
4152 1 5 unless $self->_valid_image("alphachannel")
4163 1 1 unless $self->_valid_image("getmask")
4175 28 0 if $] >= "5.014"
4178 1 27 unless $self->_valid_image("setmask")
4181 0 27 unless (defined $opts{'mask'})
4197 1 9 unless $self->_valid_image("getcolorcount")
4201 1 8 $rc == -1 ? :
4209 1 3 unless $self->_valid_image("getcolorusagehash")
4214 0 3 unless (defined $max_colors and $max_colors > 0)
4222 0 3 if $channels == 2 or $channels == 4
4230 1 125 if keys %color_use > $max_colors
4242 1 5 unless $self->_valid_image("getcolorusage")
4247 0 5 unless (defined $max_colors and $max_colors > 0)
4260 1 0 unless $self->_valid_image("string")
4264 0 0 unless defined $input{'string'}
4266 0 0 unless (defined $input{'string'})
4271 0 0 unless ($input{'font'})
4276 0 0 unless ($input{'font'}->draw("image", $self, %input))
4287 1 0 if (ref $self) { }
4288 1 0 unless $self->_valid_image("align_string")
4299 0 0 unless defined $input{'string'}
4301 0 0 unless (exists $input{'string'})
4306 0 0 unless ($input{'font'})
4312 0 0 unless (@result = $input{'font'}->align("image", $img, %input))
4316 0 0 wantarray ? :
4327 23 2 if ($opts{'reset'}) { }
4335 22 53 if defined $opts{$key}
4357 1 10 if ($opts{'sample_size'} and $opts{'sample_size'} eq "float")
4362 1 37 unless (defined $opts{$name})
4366 1 36 unless ($opts{$name} == int $opts{$name})
4373 6 3 unless ($result)
4399 250 71 if (ref $_[0]) { }
4405 169 30 if (ref $self) { }
4444 0 115 unless my($ext) = $name =~ /\.([^.]+)$/
4448 2 113 unless ($type)
4452 0 115 if (not defined $type and $ext =~ /\A[a-zA-Z0-9_]{2,}\z/)
4464 1 0 unless exists $ext_types{lc $ext}
4477 0 1394 if ($_ < $mx)
4485 1124 19 if ($_ > $mx)
4510 0 0 unless defined $str
4517 0 0 if (/^\004\004/)
4520 0 0 if ($item =~ /^x/)
4524 0 0 if ($item =~ /^P/)
4528 0 0 if ($item =~ /^i/)
4532 0 0 if ($item =~ /^n/)
4546 0 0 unless $lang eq "C" or $lang eq "CPP"
4564 1 0 if $INC[-1] eq "."
4585 1 18 if (tied *$fh) { }
4596 0 2 unless defined $count
4598 1 1 unless $count
4603 2 0 if ($_[1] != 1 or $_[0] != 0)
4604 0 2 unless (CORE::seek $fh, $_[0], $_[1])
4640 0 50 if ($loaded) { }
4644 50 0 if ($error =~ /^Can't locate /)
4658 6 5 if exists $self->[0]{$key}
4660 4 1 unless $self->[3]{$key}
4680 0 0 if (exists $self->[0]{$key})
4681 0 0 unless my $value = $self->[0]{$key}
4686 0 0 unless $self->_check($key)
4694 7 10 unless (@{$self->[1];})
4700 0 49 if $self->[0]{$key}
4702 0 49 if $self->_check($key)
4706 0 17 unless @{$self->[1];}
4714 17 68 unless $self->[2] < @{$self->[1];}