- update the filter plugin documentation.
https://rt.cpan.org/Ticket/Display.html?id=56513
+ - add the matrix() method to Imager::Matrix2d to allow creation of a
+ matrix with specified co-efficients.
+ https://rt.cpan.org/Ticket/Display.html?id=29938
+
Imager 0.80 - 17 Jan 2011
===========
$m4 = Imager::Matrix2d->shear(x=>$sx, y=>$sy);
$m5 = Imager::Matrix2d->reflect(axis=>$axis);
$m6 = Imager::Matrix2d->scale(x=>$xratio, y=>$yratio);
+ $m8 = Imager::Matric2d->matrix($v11, $v12, $v13,
+ $v21, $v22, $v23,
+ $v31, $v32, $v33);
$m6 = $m1 * $m2;
$m7 = $m1 + $m2;
use Imager::Matrix2d qw(:handy);
}
}
+=item matrix($v11, $v12, $v13, $v21, $v22, $v23, $v31, $v32, $v33)
+
+Create a matrix with custom co-efficients.
+
+=cut
+
+sub matrix {
+ my ($class, @self) = @_;
+
+ if (@self == 9) {
+ return bless \@self, $class;
+ }
+ else {
+ $Imager::ERRSTR = "9 co-efficients required";
+ return;
+ }
+}
+
=item _mult()
Implements the overloaded '*' operator. Internal use.
#!perl -w
use strict;
-use Test::More tests => 10;
+use Test::More tests => 13;
use Imager;
BEGIN { use_ok('Imager::Matrix2d', ':handy') }
0, 0.8, 0,
0, 0, 1 ]), "scale matrix");
+my $custom = Imager::Matrix2d->matrix(1, 0, 0, 0, 1, 0, 0, 0, 1);
+ok(almost_equal($custom, [ 1, 0, 0,
+ 0, 1, 0,
+ 0, 0, 1 ]), "custom matrix");
+
my $trans_called;
$rotate = Imager::Matrix2d::Test->rotate(degrees=>90, x=>50);
ok($trans_called, "translate called on rotate with just x");
$rotate = Imager::Matrix2d::Test->rotate(degrees=>90, 'y'=>50);
ok($trans_called, "translate called on rotate with just y");
+ok(!Imager::Matrix2d->matrix(), "bad custom matrix");
+is(Imager->errstr, "9 co-efficients required", "check error");
+
sub almost_equal {
my ($m1, $m2) = @_;
++$trans_called;
return $class->SUPER::translate(%opts);
}
+