multiply => 2, mult => 2,
dissolve => 3,
add => 4,
- subtract => 5, sub => 5,
+ subtract => 5, 'sub' => 5,
diff => 6,
lighten => 7,
darken => 8,
return 0 unless $self->{IMG};
- if (defined $opts{index}) {
- return i_tags_delete($self->{IMG}, $opts{index});
+ if (defined $opts{'index'}) {
+ return i_tags_delete($self->{IMG}, $opts{'index'});
}
elsif (defined $opts{name}) {
return i_tags_delbyname($self->{IMG}, $opts{name});
# has been there for half a year dude.
# Look, i just work here, ok?
- if (!$input{type} and $input{file}) {
- $input{type}=$FORMATGUESS->($input{file});
+ if (!$input{'type'} and $input{file}) {
+ $input{'type'}=$FORMATGUESS->($input{file});
}
- if (!$formats{$input{type}}) {
+ if (!$formats{$input{'type'}}) {
$self->{ERRSTR}='format not supported'; return undef;
}
my %iolready=(jpeg=>1, png=>1, tiff=>1, pnm=>1, raw=>1, bmp=>1, tga=>1);
- if ($iolready{$input{type}}) {
+ if ($iolready{$input{'type'}}) {
# Setup data source
$IO = io_new_fd($fd); # sort of simple for now eh?
- if ( $input{type} eq 'jpeg' ) {
+ if ( $input{'type'} eq 'jpeg' ) {
($self->{IMG},$self->{IPTCRAW})=i_readjpeg_wiol( $IO );
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}='unable to read jpeg image'; return undef;
return $self;
}
- if ( $input{type} eq 'tiff' ) {
+ if ( $input{'type'} eq 'tiff' ) {
$self->{IMG}=i_readtiff_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}='unable to read tiff image'; return undef;
return $self;
}
- if ( $input{type} eq 'pnm' ) {
+ if ( $input{'type'} eq 'pnm' ) {
$self->{IMG}=i_readpnm_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}='unable to read pnm image: '._error_as_msg(); return undef;
return $self;
}
- if ( $input{type} eq 'png' ) {
+ if ( $input{'type'} eq 'png' ) {
$self->{IMG}=i_readpng_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}='unable to read png image';
$self->{DEBUG} && print "loading a png file\n";
}
- if ( $input{type} eq 'bmp' ) {
+ if ( $input{'type'} eq 'bmp' ) {
$self->{IMG}=i_readbmp_wiol( $IO );
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}='unable to read bmp image';
$self->{DEBUG} && print "loading a bmp file\n";
}
- if ( $input{type} eq 'tga' ) {
+ if ( $input{'type'} eq 'tga' ) {
$self->{IMG}=i_readtga_wiol( $IO, -1 ); # Fixme, check if that length parameter is ever needed
if ( !defined($self->{IMG}) ) {
$self->{ERRSTR}=$self->_error_as_msg();
$self->{DEBUG} && print "loading a tga file\n";
}
- if ( $input{type} eq 'raw' ) {
+ if ( $input{'type'} eq 'raw' ) {
my %params=(datachannels=>3,storechannels=>3,interleave=>1,%input);
if ( !($params{xsize} && $params{ysize}) ) {
# Old code for reference while changing the new stuff
- if (!$input{type} and $input{file}) {
- $input{type}=$FORMATGUESS->($input{file});
+ if (!$input{'type'} and $input{file}) {
+ $input{'type'}=$FORMATGUESS->($input{file});
}
- if (!$input{type}) {
+ if (!$input{'type'}) {
$self->{ERRSTR}='type parameter missing and not possible to guess from extension'; return undef;
}
- if (!$formats{$input{type}}) {
+ if (!$formats{$input{'type'}}) {
$self->{ERRSTR}='format not supported';
return undef;
}
$fd=$input{fd};
}
- if ( $input{type} eq 'gif' ) {
+ if ( $input{'type'} eq 'gif' ) {
my $colors;
if ($input{colors} && !ref($input{colors})) {
# must be a reference to a scalar that accepts the colour map
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
if (!$input{file} and !$input{'fd'} and !$input{'data'}) { $self->{ERRSTR}='file/fd/data parameter missing'; return undef; }
- if (!$input{type} and $input{file}) { $input{type}=$FORMATGUESS->($input{file}); }
- if (!$input{type}) { $self->{ERRSTR}='type parameter missing and not possible to guess from extension'; return undef; }
+ if (!$input{'type'} and $input{file}) {
+ $input{'type'}=$FORMATGUESS->($input{file});
+ }
+ if (!$input{'type'}) {
+ $self->{ERRSTR}='type parameter missing and not possible to guess from extension';
+ return undef;
+ }
- if (!$formats{$input{type}}) { $self->{ERRSTR}='format not supported'; return undef; }
+ if (!$formats{$input{'type'}}) { $self->{ERRSTR}='format not supported'; return undef; }
if (exists $input{'fd'}) {
$fd=$input{'fd'};
$fd = $fh->fileno();
}
- if ($iolready{$input{type}}) {
+ if ($iolready{$input{'type'}}) {
if (defined $fd) {
$IO = io_new_fd($fd);
}
- if ($input{type} eq 'tiff') {
+ if ($input{'type'} eq 'tiff') {
if (defined $input{class} && $input{class} eq 'fax') {
if (!i_writetiff_wiol_faxable($self->{IMG}, $IO, $input{fax_fine})) {
$self->{ERRSTR}='Could not write to buffer';
return undef;
}
}
- } elsif ( $input{type} eq 'pnm' ) {
+ } elsif ( $input{'type'} eq 'pnm' ) {
if ( ! i_writeppm_wiol($self->{IMG},$IO) ) {
$self->{ERRSTR}='unable to write pnm image';
return undef;
}
$self->{DEBUG} && print "writing a pnm file\n";
- } elsif ( $input{type} eq 'raw' ) {
+ } elsif ( $input{'type'} eq 'raw' ) {
if ( !i_writeraw_wiol($self->{IMG},$IO) ) {
$self->{ERRSTR}='unable to write raw image';
return undef;
}
$self->{DEBUG} && print "writing a raw file\n";
- } elsif ( $input{type} eq 'png' ) {
+ } elsif ( $input{'type'} eq 'png' ) {
if ( !i_writepng_wiol($self->{IMG}, $IO) ) {
$self->{ERRSTR}='unable to write png image';
return undef;
}
$self->{DEBUG} && print "writing a png file\n";
- } elsif ( $input{type} eq 'jpeg' ) {
+ } elsif ( $input{'type'} eq 'jpeg' ) {
if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
$self->{ERRSTR} = $self->_error_as_msg();
return undef;
}
$self->{DEBUG} && print "writing a jpeg file\n";
- } elsif ( $input{type} eq 'bmp' ) {
+ } elsif ( $input{'type'} eq 'bmp' ) {
if ( !i_writebmp_wiol($self->{IMG}, $IO) ) {
$self->{ERRSTR}='unable to write bmp image';
return undef;
}
$self->{DEBUG} && print "writing a bmp file\n";
- } elsif ( $input{type} eq 'tga' ) {
+ } elsif ( $input{'type'} eq 'tga' ) {
if ( !i_writetga_wiol($self->{IMG}, $IO, $input{wierdpack}, $input{compress}, $input{idstring}) ) {
$self->{ERRSTR}=$self->_error_as_msg();
}
return $self;
} else {
- if ( $input{type} eq 'gif' ) {
+ if ( $input{'type'} eq 'gif' ) {
if (not $input{gifplanes}) {
my $gp;
my $count=i_count_colors($self->{IMG}, 256);
sub write_multi {
my ($class, $opts, @images) = @_;
- if ($opts->{type} eq 'gif') {
+ if ($opts->{'type'} eq 'gif') {
my $gif_delays = $opts->{gif_delays};
local $opts->{gif_delays} = $gif_delays;
unless (ref $opts->{gif_delays}) {
}
}
else {
- $ERRSTR = "Sorry, write_multi doesn't support $opts->{type} yet";
+ $ERRSTR = "Sorry, write_multi doesn't support $opts->{'type'} yet";
return 0;
}
}
sub read_multi {
my ($class, %opts) = @_;
- if ($opts{file} && !exists $opts{type}) {
+ if ($opts{file} && !exists $opts{'type'}) {
# guess the type
my $type = $FORMATGUESS->($opts{file});
- $opts{type} = $type;
+ $opts{'type'} = $type;
}
- unless ($opts{type}) {
+ unless ($opts{'type'}) {
$ERRSTR = "No type parameter supplied and it couldn't be guessed";
return;
}
return;
}
- if ($opts{type} eq 'gif') {
+ if ($opts{'type'} eq 'gif') {
my @imgs;
if ($fd) {
@imgs = i_readgif_multi($fd);
}
}
- $ERRSTR = "Cannot read multiple images from $opts{type} files";
+ $ERRSTR = "Cannot read multiple images from $opts{'type'} files";
return;
}
my %hsh;
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
- if (!$input{type}) { $self->{ERRSTR}='type parameter missing'; return undef; }
+ if (!$input{'type'}) { $self->{ERRSTR}='type parameter missing'; return undef; }
- if ( (grep { $_ eq $input{type} } keys %filters) != 1) {
+ if ( (grep { $_ eq $input{'type'} } keys %filters) != 1) {
$self->{ERRSTR}='type parameter not matching any filter'; return undef;
}
- if ($filters{$input{type}}{names}) {
- my $names = $filters{$input{type}}{names};
+ if ($filters{$input{'type'}}{names}) {
+ my $names = $filters{$input{'type'}}{names};
for my $name (keys %$names) {
if (defined $input{$name} && exists $names->{$name}{$input{$name}}) {
$input{$name} = $names->{$name}{$input{$name}};
}
}
}
- if (defined($filters{$input{type}}{defaults})) {
- %hsh=('image',$self->{IMG},%{$filters{$input{type}}{defaults}},%input);
+ if (defined($filters{$input{'type'}}{defaults})) {
+ %hsh=('image',$self->{IMG},%{$filters{$input{'type'}}{defaults}},%input);
} else {
%hsh=('image',$self->{IMG},%input);
}
- my @cs=@{$filters{$input{type}}{callseq}};
+ my @cs=@{$filters{$input{'type'}}{callseq}};
for(@cs) {
if (!defined($hsh{$_})) {
- $self->{ERRSTR}="missing parameter '$_' for filter ".$input{type}; return undef;
+ $self->{ERRSTR}="missing parameter '$_' for filter ".$input{'type'}; return undef;
}
}
- &{$filters{$input{type}}{callsub}}(%hsh);
+ &{$filters{$input{'type'}}{callsub}}(%hsh);
my @b=keys %hsh;
sub scale {
my $self=shift;
- my %opts=(scalefactor=>0.5,type=>'max',qtype=>'normal',@_);
+ my %opts=(scalefactor=>0.5,'type'=>'max',qtype=>'normal',@_);
my $img = Imager->new();
my $tmp = Imager->new();
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
- if ($opts{xpixels} and $opts{ypixels} and $opts{type}) {
+ if ($opts{xpixels} and $opts{ypixels} and $opts{'type'}) {
my ($xpix,$ypix)=( $opts{xpixels}/$self->getwidth() , $opts{ypixels}/$self->getheight() );
- if ($opts{type} eq 'min') { $opts{scalefactor}=min($xpix,$ypix); }
- if ($opts{type} eq 'max') { $opts{scalefactor}=max($xpix,$ypix); }
+ if ($opts{'type'} eq 'min') { $opts{scalefactor}=min($xpix,$ypix); }
+ if ($opts{'type'} eq 'max') { $opts{scalefactor}=max($xpix,$ypix); }
} elsif ($opts{xpixels}) { $opts{scalefactor}=$opts{xpixels}/$self->getwidth(); }
elsif ($opts{ypixels}) { $opts{scalefactor}=$opts{ypixels}/$self->getheight(); }
{op=>'-',trans=>'Sub'},
{op=>'*',trans=>'Mult'},
{op=>'/',trans=>'Div'},
- {op=>'-',type=>'unary',trans=>'u-'},
+ {op=>'-','type'=>'unary',trans=>'u-'},
{op=>'**'},
- {op=>'func',type=>'unary'}],
+ {op=>'func','type'=>'unary'}],
'grouping'=>[qw( \( \) )],
'func'=>[qw( sin cos )],
'vars'=>[qw( x y )]
my $self = shift;
my %opts = ( color=>Imager::Color->new(255, 255, 255), @_ );
- unless (exists $opts{x} && exists $opts{'y'}) {
+ unless (exists $opts{'x'} && exists $opts{'y'}) {
$self->{ERRSTR} = "missing seed x and y parameters";
return undef;
}
return;
}
}
- i_flood_cfill($self->{IMG}, $opts{x}, $opts{'y'}, $opts{fill}{fill});
+ i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
}
else {
- i_flood_fill($self->{IMG}, $opts{x}, $opts{'y'}, $opts{color});
+ i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{color});
}
$self;
sub getcolorcount {
my $self=shift;
- my %opts=(maxcolors=>2**30,@_);
+ my %opts=('maxcolors'=>2**30,@_);
if (!defined($self->{IMG})) { $self->{ERRSTR}='image is empty'; return undef; }
my $rc=i_count_colors($self->{IMG},$opts{'maxcolors'});
return ($rc==-1? undef : $rc);
my $n = $val * (1.0 - $sat * $f);
my $k = $val * (1.0 - $sat * (1 - $f));
my $v = $val;
- my %fields = ( m=>$m, n=>$n, v=>$v, k=>$k, );
+ my %fields = ( 'm'=>$m, 'n'=>$n, 'v'=>$v, 'k'=>$k, );
return @fields{split //, $hsv_map[$i]};
}
}
my %combine_types;
@combine_types{@combine_types} = 0 .. $#combine_types;
$combine_types{mult} = $combine_types{multiply};
-$combine_types{sub} = $combine_types{subtract};
+$combine_types{'sub'} = $combine_types{subtract};
$combine_types{sat} = $combine_types{saturation};
# this function tries to DWIM for color parameters
-
package Imager::Font;
use Imager::Color;
use strict;
-use File::Spec;
# the aim here is that we can:
# - add file based types in one place: here
sub draw {
my $self = shift;
- my %input = (x => 0, 'y' => 0, @_);
+ my %input = ('x' => 0, 'y' => 0, @_);
unless ($input{image}) {
$Imager::ERRSTR = 'No image supplied to $font->draw()';
return;
$Imager::ERRSTR = "Freetype2 not supported in this build";
return;
}
- my $id = i_ft2_new($hsh{file}, $hsh{index} || 0);
+ my $id = i_ft2_new($hsh{file}, $hsh{'index'} || 0);
unless ($id) { # the low-level code may miss some error handling
$Imager::ERRSTR = Imager::_error_as_msg();
return;
my $self = shift;
my %input = @_;
if (exists $input{channel}) {
- i_ft2_cp($self->{id}, $input{image}{IMG}, $input{x}, $input{'y'},
+ i_ft2_cp($self->{id}, $input{image}{IMG}, $input{'x'}, $input{'y'},
$input{channel}, $input{size}, $input{sizew} || 0,
$input{string}, , $input{align}, $input{aa}, $input{vlayout},
$input{utf8});
} else {
i_ft2_text($self->{id}, $input{image}{IMG},
- $input{x}, $input{'y'},
+ $input{'x'}, $input{'y'},
$input{color}, $input{size}, $input{sizew} || 0,
$input{string}, $input{align}, $input{aa}, $input{vlayout},
$input{utf8});
my %input = @_;
if ( exists $input{channel} ) {
Imager::i_tt_cp($self->{id},$input{image}{IMG},
- $input{x}, $input{'y'}, $input{channel}, $input{size},
+ $input{'x'}, $input{'y'}, $input{channel}, $input{size},
$input{string}, length($input{string}),$input{aa});
} else {
Imager::i_tt_text($self->{id}, $input{image}{IMG},
- $input{x}, $input{'y'}, $input{color},
+ $input{'x'}, $input{'y'}, $input{color},
$input{size}, $input{string},
length($input{string}), $input{aa});
}
use Imager::Color;
use vars qw(@ISA);
@ISA = qw(Imager::Font);
-use File::Spec;
my $t1aa;
return;
}
unless ($hsh{file} =~ m!^/! || $hsh{file} =~ m!^\./!) {
- $hsh{file} = File::Spec->catfile(File::Spec->curdir, $hsh{file});
+ $hsh{file} = './' . $hsh{file};
}
my $id = Imager::i_t1_new($hsh{file});
unless ($id >= 0) { # the low-level code may miss some error handling
my %input = @_;
t1_set_aa_level($input{aa});
if (exists $input{channel}) {
- Imager::i_t1_cp($input{image}{IMG}, $input{x}, $input{'y'},
+ Imager::i_t1_cp($input{image}{IMG}, $input{'x'}, $input{'y'},
$input{channel}, $self->{id}, $input{size},
$input{string}, length($input{string}), $input{align});
} else {
- Imager::i_t1_text($input{image}{IMG}, $input{x}, $input{'y'},
+ Imager::i_t1_text($input{image}{IMG}, $input{'x'}, $input{'y'},
$input{color}, $self->{id}, $input{size},
$input{string}, length($input{string}),
$input{align});
return undef;
}
- if ($opts{x} && $opts{'y'}) {
- return $class->translate(x=>-$opts{x}, 'y'=>-$opts{'y'})
+ if ($opts{'x'} && $opts{'y'}) {
+ return $class->translate('x'=>-$opts{'x'}, 'y'=>-$opts{'y'})
* $class->rotate(radians=>$angle)
- * $class->translate(x=>$opts{x}, 'y'=>$opts{'y'});
+ * $class->translate('x'=>$opts{'x'}, 'y'=>$opts{'y'});
}
else {
my $sin = sin($angle);
sub translate {
my ($class, %opts) = @_;
- if (defined $opts{x} && defined $opts{'y'}) {
- return bless [ 1, 0, $opts{x},
+ if (defined $opts{'x'} && defined $opts{'y'}) {
+ return bless [ 1, 0, $opts{'x'},
0, 1, $opts{'y'},
0, 0, 1 ], $class;
}
sub shear {
my ($class, %opts) = @_;
- if (defined $opts{x} || defined $opts{'y'}) {
- return bless [ 1, $opts{x}||0, 0,
- $opts{'y'}||0, 1, 0,
- 0, 0, 1 ], $class;
+ if (defined $opts{'x'} || defined $opts{'y'}) {
+ return bless [ 1, $opts{'x'}||0, 0,
+ $opts{'y'}||0, 1, 0,
+ 0, 0, 1 ], $class;
}
$Imager::ERRSTR = 'x and y parameters required';
return undef;
sub scale {
my ($class, %opts) = @_;
- if (defined $opts{x} || defined $opts{'y'}) {
- $opts{x} = 1 unless defined $opts{x};
+ if (defined $opts{'x'} || defined $opts{'y'}) {
+ $opts{'x'} = 1 unless defined $opts{'x'};
$opts{'y'} = 1 unless defined $opts{'y'};
if ($opts{cx} || $opts{cy}) {
- return $class->translate(x=>-$opts{cx}, 'y'=>-$opts{cy})
- * $class->scale(x=>$opts{x}, 'y'=>$opts{'y'})
- * $class->translate(x=>$opts{cx}, 'y'=>$opts{cy});
+ return $class->translate('x'=>-$opts{cx}, 'y'=>-$opts{cy})
+ * $class->scale('x'=>$opts{'x'}, 'y'=>$opts{'y'})
+ * $class->translate('x'=>$opts{cx}, 'y'=>$opts{cy});
}
else {
- return bless [ $opts{x}, 0, 0,
- 0, $opts{'y'}, 0,
- 0, 0, 1 ], $class;
+ return bless [ $opts{'x'}, 0, 0,
+ 0, $opts{'y'}, 0,
+ 0, 0, 1 ], $class;
}
}
else {
my %opts = %$opts;
$opts{$func->{type}} = $func->{$func->{type}};
my %con = %$constants;
- for my $name (keys %{$func->{constants}}) {
+ for my $name (keys %{$func->{'constants'}}) {
unless (exists $con{$name}) {
- if (exists $func->{constants}{$name}{default}) {
- $con{$name} = $func->{constants}{$name}{default};
+ if (exists $func->{'constants'}{$name}{default}) {
+ $con{$name} = $func->{'constants'}{$name}{default};
}
else {
$self->{error} = "No value or default for constant $name";
}
}
}
- $opts{constants} = \%con;
- unless (@in == @{$func->{inputs}}) {
+ $opts{'constants'} = \%con;
+ unless (@in == @{$func->{'inputs'}}) {
$self->{error} = @in." input images given, ".
- @{$func->{inputs}}." supplied";
+ @{$func->{'inputs'}}." supplied";
return;
}
Function : $name
Description: $func->{desc}
EOS
- if ($func->{inputs} && @{$func->{inputs}}) {
+ if ($func->{'inputs'} && @{$func->{'inputs'}}) {
$desc .= "Input images:\n";
my $i = 1;
- for my $in (@{$func->{inputs}}) {
+ for my $in (@{$func->{'inputs'}}) {
$desc .= " $i: $in->{desc}\n";
}
}
else {
$desc .= "There are no input images\n";
}
- if ($func->{constants} && keys %{$func->{constants}}) {
+ if ($func->{'constants'} && keys %{$func->{'constants'}}) {
$desc .= "Input constants:\n";
- for my $key (keys %{$func->{constants}}) {
- $desc .= " $key: $func->{constants}{$key}{desc}\n";
- $desc .= " Default: $func->{constants}{$key}{default}\n";
+ for my $key (keys %{$func->{'constants'}}) {
+ $desc .= " $key: $func->{'constants'}{$key}{desc}\n";
+ $desc .= " Default: $func->{'constants'}{$key}{default}\n";
}
}
else {
or print "not ";
print "ok 34\n";
close FH;
- use Data::Dumper;
- # build a big map of all tags for all images
- @tags =
- map {
- my $im = $_;
- [
- map { join ",", map { defined() ? $_ : "undef" } Imager::i_tags_get($im, $_) }
- 0..Imager::i_tags_count($_)-1
- ]
- } @imgs;
- my $dump = Dumper(\@tags);
- $dump =~ s/^/# /mg;
- print "# tags from gif\n", $dump;
+ eval {
+ require 'Data/Dumper.pm';
+ Data::Dumper->import();
+ };
+ unless ($@) {
+ # build a big map of all tags for all images
+ @tags =
+ map {
+ my $im = $_;
+ [
+ map { join ",", map { defined() ? $_ : "undef" } Imager::i_tags_get($im, $_) }
+ 0..Imager::i_tags_count($_)-1
+ ]
+ } @imgs;
+ my $dump = Dumper(\@tags);
+ $dump =~ s/^/# /mg;
+ print "# tags from gif\n", $dump;
+ }
# at this point @imgs should contain only paletted images
ok(35, Imager::i_img_type($imgs[0]) == 1, "imgs[0] not paletted");
0, 1, 0,
0, 0, 1 ]) or print "not ";
print "ok 2\n";
-my $trans = Imager::Matrix2d->translate(x=>10, 'y'=>-11);
+my $trans = Imager::Matrix2d->translate('x'=>10, 'y'=>-11);
almost_equal($trans, [ 1, 0, 10,
0, 1, -11,
0, 0, 1 ]) or print "not ";
0, 0, 1 ]) or print "not ";
print "ok 4\n";
-my $shear = Imager::Matrix2d->shear(x=>0.2, 'y'=>0.3);
+my $shear = Imager::Matrix2d->shear('x'=>0.2, 'y'=>0.3);
almost_equal($shear, [ 1, 0.2, 0,
0.3, 1, 0,
0, 0, 1 ]) or print "not ";
print "ok 5\n";
-my $scale = Imager::Matrix2d->scale(x=>1.2, 'y'=>0.8);
+my $scale = Imager::Matrix2d->scale('x'=>1.2, 'y'=>0.8);
almost_equal($scale, [ 1.2, 0, 0,
0, 0.8, 0,
0, 0, 1 ]) or print "not ";
$ffim->box(xmin=>10, ymin=>10, xmax=>20, ymax=>90, color=>$blue, filled=>1);
$ffim->box(xmin=>20, ymin=>45, xmax=>80, ymax=>55, color=>$blue, filled=>1);
$ffim->box(xmin=>80, ymin=>10, xmax=>90, ymax=>90, color=>$blue, filled=>1);
-ok(20, $ffim->flood_fill(x=>50, 'y'=>50, color=>$red), "flood fill");
+ok(20, $ffim->flood_fill('x'=>50, 'y'=>50, color=>$red), "flood fill");
$diff = Imager::i_img_diff($rffcmp, $ffim->{IMG});
ok(21, !$diff, "oo flood fill difference");
-$ffim->flood_fill(x=>50, 'y'=>50,
+$ffim->flood_fill('x'=>50, 'y'=>50,
fill=> {
hatch => 'check2x2'
});
my $img = Imager->new(xsize=>200, ysize=>200);
my $font = Imager::Font->new(face=>$fontname, size=>20);
-$img->string(x=>30, y=>30, string=>"Imager", color=>NC(255, 0, 0),
+$img->string('x'=>30, 'y'=>30, string=>"Imager", color=>NC(255, 0, 0),
font=>$font);
$img->write(file=>'testout/t37_oo.ppm') or print "not ";
print "ok 4 # ",$img->errstr||'',"\n";
print "ok 3\n";
#$fontname = 'fontfiles/arial.ttf';
-my $oof = Imager::Font->new(file=>$fontname, type=>'ft2', index=>0)
+my $oof = Imager::Font->new(file=>$fontname, type=>'ft2', 'index'=>0)
or print "not ";
print "ok 4\n";
$im->string(font=>$oof,
text=>"Via OO",
- x=>20,
- y=>20,
+ 'x'=>20,
+ 'y'=>20,
size=>60,
color=>NC(255, 128, 255),
aa => 1,
print "ok 6\n";
$im->string(font=>$oof,
text=>"Shear",
- x=>20,
+ 'x'=>20,
'y'=>40,
size=>60,
sizew=>50,
#$oof->transform(matrix=>m2d_identity());
$im->string(font=>$oof,
text=>"SPIN",
- x=>20,
+ 'x'=>20,
'y'=>50,
size=>50,
sizew=>40,
and
$im->string(font=>$oof,
text=>"SPIN",
- x=>20,
+ 'x'=>20,
'y'=>50,
size=>50,
sizew=>40,
#$text = "A".chr(0x2010)."A"; # this one works too
if ($im->string(font=>$oof,
text=>$text,
- x=>20,
+ 'x'=>20,
'y'=>200,
size=>50,
color=>NC(0,255,0),
#substr($text, -1, 0) = '';
if ($im->string(font=>$oof,
text=>$text,
- x=>20,
+ 'x'=>20,
'y'=>230,
size=>50,
color=>NC(255,128,0),
# $oof->hinting(hinting=>1);
$im->string(font=>$oof,
text=>"SPIN",
- x=>160,
+ 'x'=>160,
'y'=>70,
size=>65,
color=>NC(255, $steps * 5, 200-$steps * 5),