Branch Coverage

/root/.cpan/build/Imager-1.019-0/blib/lib/Imager.pm
Criterion Covered Total %
branch 981 1406 69.7


line true false branch
149 0 58 if ($ex_version < "5.57")
253 2 43 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 34 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 58 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 659 364 if (ref $arg) { }
618 520 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 8601 unless ref $self
664 8533 68 if $self->{'IMG'} and &Scalar::Util::blessed($self->{'IMG'})
666 0 68 $self->{'IMG'} ? :
667 68 0 if $method
676 75 87 if defined $_
697 0 1272 if $self->{'DEBUG'}
698 14 1258 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'}) { }
554 704 elsif (defined $hsh{'xsize'} or defined $hsh{'ysize'}) { }
0 704 elsif (%hsh) { }
710 6 8 if ($hsh{'filetype'})
713 5 9 unless ($self->read(%hsh, %extras))
719 25 529 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 46 unless $self->_valid_image("crop")
832 1 45 unless (defined wantarray)
844 33 12 if (defined $l) { }
3 9 elsif (defined $r) { }
1 8 elsif (defined $w) { }
845 1 32 if (defined $w) { }
1 31 elsif (not defined $r) { }
853 2 1 if (defined $w) { }
868 35 10 if (defined $t) { }
3 7 elsif (defined $b) { }
1 6 elsif (defined $h) { }
869 4 31 if (defined $h) { }
1 30 elsif (not defined $b) { }
877 2 1 if (defined $h) { }
893 0 45 if $l > $r
894 0 45 if $t > $b
896 1 44 if $l < 0
897 2 43 if $r > $self->getwidth
898 1 44 if $t < 0
899 3 42 if $b > $self->getheight
901 2 43 if ($l == $r or $t == $b)
905 2 41 if ($r < $l or $b < $t)
920 0 12 unless $self->_valid_image($name)
927 12 0 unless defined $tolerance
929 0 12 if (keys %hsh)
934 5 7 if ($auto)
935 0 5 if ($colors != $empty_trim_colors)
939 0 5 if ($tolerance < 0)
951 0 5 unless ($colors)
957 0 12 unless (ref $colors)
961 5 7 unless (UNIVERSAL::isa($colors, "Imager::TrimColorList"))
962 0 5 unless (&Scalar::Util::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 41 unless $self->_valid_image
1007 41 0 if ($channels == $self->getchannels) { }
1013 0 41 unless ($out->{'IMG'})
1039 4 550 if ($hsh{'model'})
1040 4 0 if (my $channels = $model_channels{$hsh{'model'}}) { }
1049 25 529 if ($hsh{'type'} eq 'paletted' or $hsh{'type'} eq 'pseudo') { }
70 459 elsif ($hsh{'bits'} eq 'double') { }
22 437 elsif ($hsh{'bits'} == 16) { }
1064 25 529 unless ($self->{'IMG'})
1076 1 9 unless $self->_valid_image("masked")
1084 3 6 $opts{'mask'} ? :
1090 1 8 unless ($result->{'IMG'})
1106 13 1 if (@_ != 1 and not ref $_[0]) { }
1113 1 13 unless (defined wantarray)
1119 1 12 unless $self->_valid_image("to_paletted")
1123 2 10 unless ($result->{'IMG'} = &i_img_to_pal($self->{'IMG'}, $opts))
1134 1 6 unless (@images)
1140 1 6 unless ($img->{'IMG'})
1148 1 4 unless (@cols)
1159 1 2 unless (defined wantarray)
1165 1 1 unless $self->_valid_image("to_rgb8")
1169 0 1 unless ($result->{'IMG'} = &i_img_to_rgb($self->{'IMG'}))
1181 0 8 unless (defined wantarray)
1187 1 7 unless $self->_valid_image("to_rgb16")
1191 0 7 unless ($result->{'IMG'} = &i_img_to_rgb16($self->{'IMG'}))
1203 0 3 unless (defined wantarray)
1209 1 2 unless $self->_valid_image("to_rgb_double")
1213 0 2 unless ($result->{'IMG'} = &i_img_to_drgb($self->{'IMG'}))
1225 1 23 unless $self->_valid_image("addcolors")
1228 0 23 unless my(@colors) = @{$opts{'colors'};}
1233 1 48 unless ($color)
1246 1 11 unless $self->_valid_image("setcolors")
1249 1 10 unless my(@colors) = @{$opts{'colors'};}
1254 1 13 unless ($color)
1267 1 14 unless $self->_valid_image("getcolors")
1270 9 5 if (not exists $opts{'start'} || exists $opts{'count'}) { }
5 0 elsif (not exists $opts{'count'}) { }
0 0 elsif (not exists $opts{'start'}) { }
1288 1 14 unless $self->_valid_image("colorcount")
1297 1 2 unless $self->_valid_image("maxcolors")
1307 1 8 unless $self->_valid_image("findcolor")
1310 0 8 unless ($opts{'color'})
1316 0 8 unless my $color = _color($opts{'color'})
1324 1 52 unless $self->_valid_image("bits")
1328 12 40 if ($bits and $bits == 64)
1337 1 56 unless $self->_valid_image("type")
1340 30 26 &i_img_type($self->{'IMG'}) ? :
1346 1 1 unless $self->_valid_image("virtual")
1355 1 24 unless $self->_valid_image("is_bilevel")
1364 1 85 unless $self->_valid_image("tags")
1367 85 0 if (defined $opts{'name'}) { }
0 0 elsif (defined $opts{'code'}) { }
1375 5 80 wantarray ? :
1388 0 0 if (wantarray) { }
1401 1 22 unless $self->_valid_image("addtag")
1404 20 2 if ($opts{'name'}) { }
2 0 elsif ($opts{'code'}) { }
1405 20 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1406 17 3 if ($opts{'value'} =~ /^\d+$/) { }
1424 2 0 if $] >= "5.014"
1426 2 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1427 2 0 if ($opts{'value'} =~ /^\d+$/) { }
1453 1 20 unless $self->_valid_image("deltag")
1456 0 20 if (defined $opts{'index'}) { }
20 0 elsif (defined $opts{'name'}) { }
0 0 elsif (defined $opts{'code'}) { }
1463 0 0 if $] >= "5.014"
1476 1 22 unless $self->_valid_image("settag")
1479 20 2 if ($opts{'name'}) { }
2 0 elsif (defined $opts{'code'}) { }
1484 2 0 if $] >= "5.014"
1487 2 0 if (defined $opts{'value'}) { }
0 0 elsif (defined $opts{'data'}) { }
1488 2 0 if ($opts{'value'} =~ /^\d+$/) { }
1514 0 226 if ($input->{'io'}) { }
4 222 elsif ($input->{'fd'}) { }
11 211 elsif ($input->{'fh'}) { }
140 71 elsif ($input->{'file'}) { }
63 8 elsif ($input->{'data'}) { }
8 0 elsif ($input->{'callback'} or $input->{'readcb'}) { }
1521 0 11 unless (&Scalar::Util::openhandle($input->{'fh'}))
1529 0 140 unless (CORE::open $file, "<", $input->{'file'})
1540 0 8 unless ($input->{'seekcb'})
1543 0 8 if ($input->{'maxbuffer'}) { }
1564 1 167 exists $input->{'buffered'} ? :
1568 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'}) { }
1575 0 6 unless (&Scalar::Util::openhandle($input->{'fh'}))
1583 0 113 unless (CORE::open $fh, "+>", $input->{'file'})
1587 0 113 unless binmode $fh
1595 4 6 if ($input->{'maxbuffer'} and $input->{'maxbuffer'} == 1)
1607 5 163 unless ($buffered)
1627 0 1 unless (&i_add_file_magic($name, $bits, $mask))
1641 22 199 if (defined $self->{'IMG'})
1648 0 221 unless my($IO, $fh) = $self->_get_reader_io(\%input)
1651 116 105 unless ($type)
1655 1 220 if ($input{'file'} and not $type)
1660 2 219 unless ($type)
1662 1 1 if $input{'file'}
1669 0 0 if ($readers{$type} and $readers{$type}{'single'})
1673 6 213 unless ($formats_low{$type})
1680 194 19 unless defined $allow_incomplete
1682 75 138 if ($type eq "pnm")
1684 20 55 unless (defined $self->{'IMG'})
1688 0 55 if $self->{'DEBUG'}
1692 98 40 if ($type eq "bmp")
1694 46 52 unless (defined $self->{'IMG'})
1698 0 52 if $self->{'DEBUG'}
1701 22 70 if ($type eq "tga")
1703 4 18 unless (defined $self->{'IMG'})
1707 0 18 if $self->{'DEBUG'}
1710 18 70 if ($type eq "raw")
1711 0 18 unless ($input{'xsize'} and $input{'ysize'})
1717 1 17 unless (defined $interleave)
1731 4 14 unless (defined $self->{'IMG'})
1735 0 14 if $self->{'DEBUG'}
1745 0 3 unless defined $opts{'type'}
1750 0 3 unless defined $opts{'single'} or defined $opts{'multiple'}
1753 3 0 if ($opts{'single'})
1756 2 1 if ($opts{'multiple'})
1767 0 3 unless defined $opts{'type'}
1772 0 3 unless defined $opts{'single'} or defined $opts{'multiple'}
1775 3 0 if ($opts{'single'})
1778 2 1 if ($opts{'multiple'})
1812 22 83 if ($attempted_to_load{$file}) { }
1813 22 0 if ($file_load_errors{$file}) { }
1825 82 1 if $INC[-1] eq "."
1830 0 83 if ($loaded) { }
1850 214 8 if $formats_low{$type} or $readers{$type}
1852 0 8 unless $type =~ /^\w+$/
1858 7 1 if (not $loaded and $error =~ /^Can't locate /)
1861 7 0 if ($error =~ /^Can't locate /)
1865 8 0 unless ($loaded)
1874 168 8 if $formats_low{$type} or $writers{$type}
1876 0 8 unless $type =~ /^\w+$/
1882 7 1 if (not $loaded and $error =~ /^Can't locate /)
1885 7 0 if ($error =~ /^Can't locate /)
1889 8 0 unless ($loaded)
1903 0 0 if defined $y
1925 0 3320 if ($obsolete_opts{$opt})
1928 0 0 if (ref $new) { }
1936 0 0 if $warn_obsolete and $^W
1938 3301 19 unless $tagname =~ /^\Q$prefix\E/
1940 3 16 if ($color_opts{$opt})
1942 0 3 unless ($value)
1947 3 16 if (ref $value) { }
1948 3 0 if (UNIVERSAL::isa($value, 'Imager::Color')) { }
0 0 elsif (ref $value eq 'ARRAY') { }
1957 0 0 if (ref $val) { }
1958 0 0 if (UNIVERSAL::isa($val, 'Imager::Color')) { }
1960 0 0 if $i < @imgs
1970 0 0 if $i < @imgs
2005 1 174 unless $self->_valid_image("write")
2008 0 174 unless $self->_set_opts(\%input, "i_", $self)
2012 99 0 if (not $type and $input{'file'})
2015 0 174 unless ($type)
2023 0 174 if ($writers{$type} and $writers{$type}{'single'}) { }
2024 0 0 unless ($IO, $fh) = $self->_get_writer_io(\%input)
2027 0 0 unless $writers{$type}{'single'}->($self, $IO, %input, "type", $type)
2031 6 168 unless ($formats_low{$type})
2037 0 168 unless ($IO, $fh) = $self->_get_writer_io(\%input, $type)
2040 121 47 if ($type eq 'pnm') { }
10 37 elsif ($type eq 'raw') { }
21 16 elsif ($type eq 'bmp') { }
16 0 elsif ($type eq 'tga') { }
2041 0 121 unless $self->_set_opts(\%input, "pnm_", $self)
2043 5 116 unless (&i_writeppm_wiol($self->{'IMG'}, $IO))
2047 0 116 if $self->{'DEBUG'}
2050 0 10 unless $self->_set_opts(\%input, "raw_", $self)
2052 4 6 unless (&i_writeraw_wiol($self->{'IMG'}, $IO))
2056 0 6 if $self->{'DEBUG'}
2059 0 21 unless $self->_set_opts(\%input, "bmp_", $self)
2061 12 9 unless (&i_writebmp_wiol($self->{'IMG'}, $IO))
2065 0 9 if $self->{'DEBUG'}
2068 0 16 unless $self->_set_opts(\%input, "tga_", $self)
2071 4 12 unless (&i_writetga_wiol($self->{'IMG'}, $IO, $input{'wierdpack'}, $input{'compress'}, $input{'idstring'}))
2075 0 12 if $self->{'DEBUG'}
2079 17 126 if (exists $input{'data'})
2081 0 17 unless ($data)
2095 2 0 if (not $type and $opts->{'file'})
2098 0 5 unless ($type)
2105 1 6 unless (ref $img and &Scalar::Util::blessed($img) and $img->isa("Imager"))
2109 1 5 unless ($img->_valid_image("write_multi"))
2115 0 2 unless $class->_set_opts($opts, "i_", @images)
2122 0 2 if ($writers{$type} and $writers{$type}{'multiple'}) { }
2123 0 0 unless ($IO, $file) = $class->_get_writer_io($opts, $type)
2126 0 0 unless $writers{$type}{'multiple'}->($class, $IO, $opts, @images)
2130 2 0 unless ($formats{$type})
2136 0 0 unless ($IO, $file) = $class->_get_writer_io($opts, $type)
2142 0 0 if (@images == 1) { }
2143 0 0 unless ($images[0]->write(%$opts, "io", $IO, "type", $type))
2154 0 0 if (exists $opts->{'data'})
2156 0 0 unless ($data)
2169 0 5 unless my($IO, $file) = $class->_get_reader_io(\%opts, $opts{'type'})
2173 5 0 unless ($type)
2177 1 4 if ($opts{'file'} and not $type)
2182 2 3 unless ($type)
2184 1 1 if $opts{'file'}
2191 0 0 if ($readers{$type} and $readers{$type}{'multiple'})
2195 2 1 unless ($formats{$type})
2202 1 0 if ($type eq 'pnm') { }
2207 0 0 if ($img->read(%opts, "io", $IO, "type", $type))
2214 0 1 unless (@imgs)
2228 1117 158 if (defined $self->{'IMG'}) { }
2248 1 85 unless $self->_valid_image("filter")
2251 0 85 unless ($input{'type'})
2253 0 85 if (grep({$_ eq $input{'type'};} keys %filters) != 1)
2257 10 75 if ($filters{$input{'type'}}{'names'})
2260 12 28 if (defined $input{$name} and exists $names->{$name}{$input{$name}})
2265 84 1 if (defined $filters{$input{'type'}}{'defaults'}) { }
2279 0 290 unless (defined $hsh{$_})
2288 4 81 if ($@)
2295 0 81 if $self->{'DEBUG'}
2296 0 81 if $self->{'DEBUG'}
2306 0 1 unless defined $hsh{'type'}
2308 0 1 unless defined $hsh{'callsub'}
2310 0 1 unless defined $hsh{'callseq'}
2313 0 1 if exists $filters{$hsh{'type'}}
2327 1 360 if (defined $opts{$name} and ref $opts{$name})
2336 58 2 if (ref $self) { }
2337 58 0 unless defined $width
2338 58 0 unless defined $height
2341 1 1 unless (defined $width and defined $height)
2347 8 51 if ($opts{'xscalefactor'} and $opts{'yscalefactor'}) { }
3 48 elsif ($opts{'xscalefactor'}) { }
3 45 elsif ($opts{'yscalefactor'}) { }
2364 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')) { }
2367 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') { }
2394 0 0 unless ($scalefactor)
2402 3 55 unless $new_width > 0
2404 3 55 unless $new_height > 0
2418 1 59 unless (defined wantarray)
2424 1 58 unless $self->_valid_image("scale")
2427 2 56 unless my($x_scale, $y_scale, $new_width, $new_height) = $self->scale_calculate(%opts)
2431 17 39 if ($opts{'qtype'} eq 'normal') { }
18 21 elsif ($opts{'qtype'} eq 'preview') { }
20 1 elsif ($opts{'qtype'} eq 'mixing') { }
2433 0 17 unless (defined $tmp->{'IMG'})
2438 0 17 unless (defined $img->{'IMG'})
2447 0 18 unless (defined $img->{'IMG'})
2455 0 20 unless ($img->{'IMG'})
2473 1 10 unless (defined wantarray)
2479 1 9 unless $self->_valid_image("scaleX")
2486 3 6 if ($opts{'pixels'})
2490 0 9 unless ($self->{'IMG'})
2497 0 9 unless (defined $img->{'IMG'})
2511 1 10 unless (defined wantarray)
2517 1 9 unless $self->_valid_image("scaleY")
2524 3 6 if ($opts{'pixels'})
2528 0 9 unless ($self->{'IMG'})
2534 0 9 unless (defined $img->{'IMG'})
2557 0 0 unless $self->_valid_image("transform")
2560 0 0 if ($opts{'xexpr'} and $opts{'yexpr'})
2561 0 0 unless ($I2P)
2564 0 0 if $INC[-1] eq "."
2568 0 0 if ($@)
2591 0 0 if (/$numre/) { }
2592 0 0 if (/$numre/) { }
2598 0 0 if (not exists $opts{'xopcodes'} or @{$opts{'xopcodes'};} == 0)
2605 0 0 unless (defined $OPCODES{$iop} or $iop =~ /^\d+$/)
2609 0 0 exists $OPCODES{$iop} ? :
2615 0 0 if (not exists $opts{'yopcodes'} or @{$opts{'yopcodes'};} == 0)
2622 0 0 unless (defined $OPCODES{$iop} or $iop =~ /^\d+$/)
2626 0 0 exists $OPCODES{$iop} ? :
2631 0 0 unless (exists $opts{'parm'})
2642 0 0 unless (defined $img->{'IMG'})
2654 26 4 if (@imgs)
2657 1 27 unless ($img->_valid_image("transform2"))
2675 28 1 if ($width) { }
2683 28 0 if ($height) { }
2692 0 28 unless ($code)
2697 0 28 unless ($channels >= 1 and $channels <= 4)
2706 1 27 unless (defined $img->{'IMG'})
2718 1 21 unless $self->_valid_image("rubthrough")
2721 1 20 unless ($opts{'src'} and $opts{'src'}->_valid_image("rubthrough"))
2733 18 2 unless defined $tx
2734 2 18 unless defined $tx
2737 18 2 unless defined $ty
2738 2 18 unless defined $ty
2740 0 20 unless (&i_rubthru($self->{'IMG'}, $opts{'src'}{'IMG'}, $tx, $ty, $opts{'src_minx'}, $opts{'src_miny'}, $opts{'src_maxx'}, $opts{'src_maxy'}))
2760 1 57 unless $self->_valid_image("compose")
2763 0 57 unless ($opts{'src'})
2768 1 56 unless ($opts{'src'}->_valid_image("compose"))
2775 56 0 unless defined $left
2776 9 47 unless defined $left
2779 56 0 unless defined $top
2780 9 47 unless defined $top
2783 48 8 unless defined $src_left
2784 48 8 unless defined $src_left
2787 48 8 unless defined $src_top
2788 48 8 unless defined $src_top
2791 0 56 if (not defined $width and defined $opts{'src_maxx'})
2794 52 4 unless defined $width
2797 0 56 if (not defined $height and defined $opts{'src_maxy'})
2800 52 4 unless defined $height
2804 31 25 if ($opts{'mask'}) { }
2805 1 30 unless ($opts{'mask'}->_valid_image("compose"))
2811 0 30 unless defined $mask_left
2812 0 30 unless defined $mask_left
2815 0 30 unless defined $mask_top
2816 0 30 unless defined $mask_top
2818 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'}))
2827 10 15 unless (&i_compose($self->{'IMG'}, $src->{'IMG'}, $left, $top, $src_left, $src_top, $width, $height, $combine, $opts{'opacity'}))
2841 1 143 unless $self->_valid_image("flip")
2846 0 143 unless defined $opts{'dir'} and defined $xlate{$opts{'dir'}}
2848 143 0 if &i_flipxy($self->{'IMG'}, $dir)
2856 1 40 unless (defined wantarray)
2862 1 39 unless $self->_valid_image("rotate")
2865 28 11 if (defined $opts{'right'}) { }
11 0 elsif (defined $opts{'radians'} or defined $opts{'degrees'}) { }
2867 0 28 if ($degrees < 0)
2871 2 26 if ($degrees == 0) { }
26 0 elsif ($degrees == 90 or $degrees == 180 or $degrees == 270) { }
2876 26 0 if ($result->{'IMG'} = &i_rotate90($self->{'IMG'}, $degrees)) { }
2894 6 5 if ($back) { }
2896 1 5 unless ($back)
2906 10 0 if ($result->{'IMG'}) { }
2924 1 4 unless $self->_valid_image("matrix_transform")
2927 1 3 unless (defined wantarray)
2933 3 0 if ($opts{'matrix'}) { }
2938 1 2 if ($opts{'back'}) { }
2941 0 1 unless $result->{'IMG'} = &i_matrix_transform($self->{'IMG'}, $xsize, $ysize, $opts{'matrix'}, $opts{'back'})
2946 0 2 unless $result->{'IMG'} = &i_matrix_transform($self->{'IMG'}, $xsize, $ysize, $opts{'matrix'})
2975 1 980 unless $self->_valid_image("box")
2981 565 415 if (exists $opts{'box'}) { }
2988 284 131 unless defined($xmin = $opts{'xmin'})
2989 282 133 unless defined($xmax = $opts{'xmax'})
2990 302 113 unless defined($ymin = $opts{'ymin'})
2991 301 114 unless defined($ymax = $opts{'ymax'})
2994 863 117 if ($opts{'filled'}) { }
113 4 elsif ($opts{'fill'}) { }
2997 861 2 if (defined $color) { }
2998 145 716 unless (&_is_color_object($color))
3000 0 145 unless ($color)
3010 826 37 if ($color->isa('Imager::Color')) { }
3018 6 107 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3021 0 6 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3030 3 1 if (defined $color) { }
3031 2 1 unless (&_is_color_object($color))
3033 0 2 unless ($color)
3042 0 4 unless ($color)
3055 1 256 unless $self->_valid_image("arc")
3070 133 123 if ($opts{'aa'}) { }
3071 2 131 if ($opts{'fill'}) { }
33 98 elsif ($opts{'filled'}) { }
3072 2 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3075 0 2 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3080 1 1 if ($opts{'d1'} == 0 and $opts{'d2'} == 361) { }
3091 0 33 unless ($color)
3095 8 25 if ($opts{'d1'} == 0 and $opts{'d2'} == 361 and $opts{'aa'}) { }
3106 25 73 if ($opts{'d2'} - $opts{'d1'} >= 360) { }
3115 10 113 if ($opts{'fill'}) { }
3116 10 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3119 1 9 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3129 0 113 unless ($color)
3133 51 62 if ($opts{'filled'}) { }
3138 13 49 if ($opts{'d1'} == 0 and $opts{'d2'} == 361) { }
3147 0 254 unless ($good)
3166 1 211 unless $self->_valid_image("line")
3169 0 211 unless (exists $opts{'x1'} and exists $opts{'y1'})
3170 0 211 unless (exists $opts{'x2'} and exists $opts{'y2'})
3173 0 211 unless ($color)
3178 145 66 if defined $opts{'aa'}
3179 146 65 if ($opts{'antialias'}) { }
3198 1 5 unless $self->_valid_image("polyline")
3201 1 4 if (exists $opts{'points'})
3202 4 0 if (not exists $opts{'points'} and exists $opts{'x'} and exists $opts{'y'})
3209 0 5 unless ($color)
3213 1 4 if defined $opts{'aa'}
3214 2 3 if ($opts{'antialias'}) { }
3216 4 2 if (defined $ls)
3223 263 3 if (defined $ls)
3238 1 10 unless $self->_valid_image("polygon")
3241 8 2 if (exists $opts{'points'})
3246 0 10 unless (exists $opts{'x'} and exists $opts{'y'})
3252 4 6 if ($opts{'fill'}) { }
3253 3 1 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3256 0 3 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3261 1 3 unless (&i_poly_aa_cfill_m($self->{'IMG'}, $opts{'x'}, $opts{'y'}, $mode, $opts{'fill'}{'fill'}))
3268 0 6 unless ($color)
3272 1 5 unless (&i_poly_aa_m($self->{'IMG'}, $opts{'x'}, $opts{'y'}, $mode, $color))
3283 0 6 unless $self->_valid_image("polypolygon")
3287 0 6 unless $points
3292 6 0 if ($opts{'filled'}) { }
0 0 elsif ($opts{'fill'}) { }
3293 0 6 unless my $color = _color(_first($opts{'color'}, [0, 0, 0, 0]))
3296 0 6 unless &i_poly_poly_aa($self->{'IMG'}, $points, $mode, $color)
3301 0 0 unless $self->_valid_fill($fill, "polypolygon")
3305 0 0 unless &i_poly_poly_aa_cfill($self->{'IMG'}, $points, $mode, $fill->{'fill'})
3308 0 0 unless my $color = _color(_first($opts{'color'}, [0, 0, 0, 255]))
3313 0 0 if (_first($opts{'aa'}, 1)) { }
3353 0 0 unless $self->_valid_image("polybezier")
3356 0 0 if (exists $opts{'points'})
3361 0 0 unless (@{$opts{'x'};} and @{$opts{'x'};} == @{$opts{'y'};})
3367 0 0 unless ($color)
3380 1 89 unless $self->_valid_image("flood_fill")
3383 0 89 unless (exists $opts{'x'} and exists $opts{'y'})
3388 2 87 if ($opts{'border'}) { }
3390 0 2 unless ($border)
3394 1 1 if ($opts{'fill'}) { }
3395 1 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3398 0 1 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3408 0 1 unless ($color)
3415 2 0 if ($rc) { }
3424 1 86 if ($opts{'fill'}) { }
3425 1 0 unless (UNIVERSAL::isa($opts{'fill'}, "Imager::Fill"))
3428 0 1 unless ($opts{'fill'} = "Imager::Fill"->new(%{$opts{"fill"};}))
3437 0 86 unless ($color)
3443 87 0 if ($rc) { }
3456 1 127 unless $self->_valid_image("setpixel")
3460 1 126 unless (defined $color)
3462 1 0 unless defined $color
3465 84 43 unless (ref $color and UNIVERSAL::isa($color, "Imager::Color"))
3466 1 83 unless ($color = _color($color, "setpixel"))
3472 2 124 unless (exists $opts{'x'} and exists $opts{'y'})
3479 9 115 if (ref $x or ref $y) { }
3480 7 2 ref $x ? :
3481 7 2 ref $y ? :
3482 1 8 unless (@$x)
3486 1 7 unless (@$y)
3492 1 6 if (@$x < @$y) { }
1 5 elsif (@$y < @$x) { }
3500 5 2 if ($color->isa('Imager::Color')) { }
3502 15 2 unless &i_ppix($self->{'IMG'}, $x->[$i], $y->[$i], $color)
3508 6 2 unless &i_ppixf($self->{'IMG'}, $x->[$i], $y->[$i], $color)
3516 84 31 if ($color->isa('Imager::Color')) { }
3517 18 66 if &i_ppix($self->{'IMG'}, $x, $y, $color)
3521 18 13 if &i_ppixf($self->{'IMG'}, $x, $y, $color)
3534 1 238 unless $self->_valid_image("getpixel")
3537 2 236 unless (exists $opts{'x'} and exists $opts{'y'})
3545 19 217 if (ref $x or ref $y) { }
3546 17 2 ref $x ? :
3547 15 4 ref $y ? :
3548 1 18 unless (@$x)
3552 1 17 unless (@$y)
3558 1 16 if (@$x < @$y) { }
3 13 elsif (@$y < @$x) { }
3566 13 4 if ($type eq '8bit') { }
3 1 elsif ($type eq 'float' or $type eq 'double') { }
3580 16 0 wantarray ? :
3583 195 22 if ($type eq '8bit') { }
21 1 elsif ($type eq 'float' or $type eq 'double') { }
3600 1 38 unless $self->_valid_image("getscanline")
3603 17 21 unless defined $opts{'width'}
3605 1 37 unless (defined $opts{'y'})
3610 16 21 if ($opts{'type'} eq '8bit') { }
12 9 elsif ($opts{'type'} eq 'float') { }
8 1 elsif ($opts{'type'} eq 'index') { }
3619 0 8 unless (&i_img_type($self->{'IMG'}))
3636 1 214 unless $self->_valid_image("setscanline")
3639 0 214 unless (defined $opts{'y'})
3644 200 14 unless ($opts{'type'})
3645 49 151 if (ref $opts{'pixels'} and @{$opts{'pixels'};}) { }
3647 32 17 if ($opts{'pixels'}[0]->isa('Imager::Color')) { }
17 0 elsif ($opts{'pixels'}[0]->isa('Imager::Color::Float')) { }
3664 183 31 if ($opts{'type'} eq '8bit') { }
18 13 elsif ($opts{'type'} eq 'float') { }
13 0 elsif ($opts{'type'} eq 'index') { }
3665 32 151 if (ref $opts{'pixels'}) { }
3673 17 1 if (ref $opts{'pixels'}) { }
3681 9 4 if (ref $opts{'pixels'}) { }
3698 1 312 unless $self->_valid_image("getsamples")
3701 288 24 unless defined $opts{'width'}
3703 0 312 unless (defined $opts{'y'})
3708 3 309 if ($opts{'target'}) { }
3711 1 2 if ($opts{'type'} eq '8bit') { }
1 1 elsif ($opts{'type'} eq 'float') { }
1 0 elsif ($opts{'type'} =~ /^(\d+)bit$/) { }
3714 0 1 unless my(@samples) = &i_gsamp($self->{'IMG'}, $opts{'x'}, $opts{'x'} + $opts{'width'}, $opts{'y'}, $opts{'channels'})
3731 0 1 unless (defined $count)
3744 297 12 if ($opts{'type'} eq '8bit') { }
12 0 elsif ($opts{'type'} eq 'float') { }
0 0 elsif ($opts{'type'} =~ /^(\d+)bit$/) { }
3758 0 0 unless &i_gsamp_bits($self->{'IMG'}, $opts{'x'}, $opts{'x'} + $opts{'width'}, $opts{'y'}, $bits, \@data, 0, $opts{'channels'})
3771 1 14 unless $self->_valid_image("setsamples")
3779 13 35 if ($_[$i] eq 'data') { }
3789 1 13 unless (defined $data_index)
3793 1 12 unless (defined $_[$data_index])
3799 5 7 unless defined $type
3802 0 12 defined $opts{'width'} ? :
3805 5 7 if ($type eq '8bit') { }
5 2 elsif ($type eq 'float') { }
1 1 elsif ($type =~ /^([0-9]+)bit$/) { }
3816 0 1 unless (ref $_[$data_index])
3830 4 7 unless (defined $count)
3854 1 17 unless $self->_valid_image("convert")
3857 1 16 unless (defined wantarray)
3865 14 2 if (not exists $opts{'matrix'}) { }
3866 14 0 if (exists $opts{'preset'}) { }
3871 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') { }
3873 3 0 if ($self->getchannels == 3) { }
0 0 elsif ($self->getchannels == 4) { }
3888 1 0 if ($self->getchannels == 2 or $self->getchannels == 4) { }
3907 0 0 if ($self->getchannels == 2 or $self->getchannels == 4) { }
3916 6 0 if ($self->getchannels == 1) { }
0 0 elsif ($self->getchannels == 2) { }
3928 0 1 if ($self->getchannels == 1) { }
1 0 elsif ($self->getchannels == 3) { }
3950 1 15 unless ($new->{'IMG'})
3964 1 13 unless ($src)
3971 1 20 unless (eval { do { $img->isa("Imager") } })
3975 1 19 unless ($img->_valid_image("combine"))
3982 4 7 if (my $channels = delete $opts{'channels'}) { }
3988 4 7 unless ($result)
4006 1 5 unless $self->_valid_image("map")
4009 1 4 unless (exists $opts{'maps'})
4013 3 1 if (exists $opts{$chlist[$chnum]}) { }
0 1 elsif (exists $opts{'all'}) { }
4020 5 0 if ($opts{'maps'} and $self->{'IMG'})
4029 1 6 unless $self->_valid_image("difference")
4032 4 2 unless defined $opts{'mindist'}
4035 0 6 unless defined $opts{'other'}
4036 1 5 unless ($opts{'other'}->_valid_image("difference"))
4044 0 5 unless $result->{'IMG'} = &i_diff_image($self->{'IMG'}, $opts{'other'}{'IMG'}, $opts{'mindist'})
4052 0 1 unless $self->_valid_image("rgb_difference")
4056 0 1 unless defined $opts{'other'}
4057 0 1 unless ($opts{'other'}->_valid_image("rgb_difference"))
4064 0 1 unless $result->{'IMG'} = &i_rgbdiff_image($self->{'IMG'}, $opts{'other'}{'IMG'})
4083 1 2041 unless $self->_valid_image("getwidth")
4094 1 1738 unless $self->_valid_image("getheight")
4105 1 648 unless $self->_valid_image("getchannels")
4116 1 6 unless $self->_valid_image("colormodel")
4121 1 5 $opts{'numeric'} ? :
4127 1 5 unless $self->_valid_image("colorchannels")
4136 1 5 unless $self->_valid_image("alphachannel")
4147 1 1 unless $self->_valid_image("getmask")
4159 28 0 if $] >= "5.014"
4162 1 27 unless $self->_valid_image("setmask")
4165 0 27 unless (defined $opts{'mask'})
4181 1 9 unless $self->_valid_image("getcolorcount")
4185 1 8 $rc == -1 ? :
4193 1 3 unless $self->_valid_image("getcolorusagehash")
4198 0 3 unless (defined $max_colors and $max_colors > 0)
4206 0 3 if $channels == 2 or $channels == 4
4214 1 125 if keys %color_use > $max_colors
4226 1 5 unless $self->_valid_image("getcolorusage")
4231 0 5 unless (defined $max_colors and $max_colors > 0)
4244 1 0 unless $self->_valid_image("string")
4248 0 0 unless defined $input{'string'}
4250 0 0 unless (defined $input{'string'})
4255 0 0 unless ($input{'font'})
4260 0 0 unless ($input{'font'}->draw("image", $self, %input))
4271 1 0 if (ref $self) { }
4272 1 0 unless $self->_valid_image("align_string")
4283 0 0 unless defined $input{'string'}
4285 0 0 unless (exists $input{'string'})
4290 0 0 unless ($input{'font'})
4296 0 0 unless (@result = $input{'font'}->align("image", $img, %input))
4300 0 0 wantarray ? :
4311 23 2 if ($opts{'reset'}) { }
4319 22 53 if defined $opts{$key}
4341 1 10 if ($opts{'sample_size'} and $opts{'sample_size'} eq "float")
4346 1 37 unless (defined $opts{$name})
4350 1 36 unless ($opts{$name} == int $opts{$name})
4357 6 3 unless ($result)
4383 260 71 ref $_[0] ? :
4389 169 34 if (ref $self) { }
4428 0 121 unless my($ext) = $name =~ /\.([^.]+)$/
4432 2 119 unless ($type)
4436 0 121 if (not defined $type and $ext =~ /\A[a-zA-Z0-9_]{2,}\z/)
4448 1 0 unless exists $ext_types{lc $ext}
4461 0 1389 if ($_ < $mx)
4469 1120 19 if ($_ > $mx)
4494 0 0 unless defined $str
4501 0 0 if (/^\004\004/)
4504 0 0 if ($item =~ /^x/)
4508 0 0 if ($item =~ /^P/)
4512 0 0 if ($item =~ /^i/)
4516 0 0 if ($item =~ /^n/)
4530 0 0 unless $lang eq "C" or $lang eq "CPP"
4548 1 0 if $INC[-1] eq "."
4569 1 18 if (tied *$fh) { }
4580 0 2 unless defined $count
4582 1 1 unless $count
4587 2 0 if ($_[1] != 1 or $_[0] != 0)
4588 0 2 unless (CORE::seek $fh, $_[0], $_[1])
4624 0 75 if ($loaded) { }
4628 75 0 if ($error =~ /^Can't locate /)
4642 10 9 if exists $self->[0]{$key}
4644 4 5 unless $self->[3]{$key}
4664 0 0 if (exists $self->[0]{$key})
4665 0 0 unless my $value = $self->[0]{$key}
4670 0 0 unless $self->_check($key)
4678 10 23 unless (@{$self->[1];})
4684 0 70 if $self->[0]{$key}
4686 0 70 if $self->_check($key)
4690 0 33 unless @{$self->[1];}
4698 33 132 unless $self->[2] < @{$self->[1];}