BEGIN {
require Exporter;
@ISA = qw(Exporter);
- $VERSION = '0.47';
+ $VERSION = '0.48';
eval {
require XSLoader;
XSLoader::load(Imager => $VERSION);
}
};
- $filters{nearest_color} ={
- callseq => ['image', 'xo', 'yo', 'colors', 'dist'],
- defaults => { },
- callsub => sub { my %hsh=@_; i_nearest_color($hsh{image}, $hsh{xo}, $hsh{yo}, $hsh{colors}, $hsh{dist}); }
- };
+ $filters{nearest_color} =
+ {
+ callseq => ['image', 'xo', 'yo', 'colors', 'dist'],
+ defaults => { },
+ callsub =>
+ sub {
+ my %hsh=@_;
+ # make sure the segments are specified with colors
+ my @colors;
+ for my $color (@{$hsh{colors}}) {
+ my $new_color = _color($color)
+ or die $Imager::ERRSTR."\n";
+ push @colors, $new_color;
+ }
+
+ i_nearest_color($hsh{image}, $hsh{xo}, $hsh{yo}, \@colors,
+ $hsh{dist})
+ or die Imager->_error_as_msg() . "\n";
+ },
+ };
$filters{gaussian} = {
callseq => [ 'image', 'stddev' ],
defaults => { },
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);
+ $hsh{ssample_param}, \@segments)
+ or die Imager->_error_as_msg() . "\n";
},
};
$filters{unsharpmask} =
my $self=shift;
my %opts=(tx => 0,ty => 0, @_);
- unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
- unless ($opts{src} && $opts{src}->{IMG}) { $self->{ERRSTR}='empty input image for source'; return undef; }
+ unless ($self->{IMG}) {
+ $self->{ERRSTR}='empty input image';
+ return undef;
+ }
+ unless ($opts{src} && $opts{src}->{IMG}) {
+ $self->{ERRSTR}='empty input image for src';
+ return undef;
+ }
%opts = (src_minx => 0,
src_miny => 0,
%opts);
unless (i_rubthru($self->{IMG}, $opts{src}->{IMG}, $opts{tx}, $opts{ty},
- $opts{src_minx}, $opts{src_miny}, $opts{src_maxx}, $opts{src_maxy})) {
- $self->{ERRSTR} = $self->_error_as_msg();
+ $opts{src_minx}, $opts{src_miny},
+ $opts{src_maxx}, $opts{src_maxy})) {
+ $self->_set_error($self->_error_as_msg());
return undef;
}
return $self;
elsif (defined $opts{radians} || defined $opts{degrees}) {
my $amount = $opts{radians} || $opts{degrees} * 3.1415926535 / 180;
+ my $back = $opts{back};
my $result = Imager->new;
- if ($opts{back}) {
- $result->{IMG} = i_rotate_exact($self->{IMG}, $amount, $opts{back});
+ if ($back) {
+ $back = _color($back);
+ unless ($back) {
+ $self->_set_error(Imager->errstr);
+ return undef;
+ }
+
+ $result->{IMG} = i_rotate_exact($self->{IMG}, $amount, $back);
}
else {
$result->{IMG} = i_rotate_exact($self->{IMG}, $amount);
masked() - L<Imager::ImageTypes/masked> - make a masked image
-matrix_transform() - L<Imager::Engines/"Matrix Transformations">
+matrix_transform() - L<Imager::Engines/matrix_transform>
maxcolors() - L<Imager::ImageTypes/maxcolors>
scale() - L<Imager::Transformations/scale>
-setscanline() - L<Imager::Draw/setscanline>
-
scaleX() - L<Imager::Transformations/scaleX>
scaleY() - L<Imager::Transformations/scaleY>
setpixel() - L<Imager::Draw/setpixel>
+setscanline() - L<Imager::Draw/setscanline>
+
+settag() - L<Imager::ImageTypes/settag>
+
set_file_limits() - L<Imager::Files/"Limiting the sizes of images you read">
string() - L<Imager::Draw/string> - draw text on an image