Subject: | Imager::Matrix2d should either allow addition/multiplication of custom matrices or an initialize from values constructor |
Date: | Fri, 12 Oct 2007 12:08:24 +1000 |
To: | bug-Imager [...] rt.cpan.org |
From: | tonyc [...] cpan.org |
Trying to build a perspective matrix with some offsets to centre it:
my $offset1 = Imager::Matrix2d->translate(x => -$work->getwidth / 2, y => 0);
my $persp = [ 1, 0, 0,
0, 1, 0,
0, -0.001, 1 ];
my $offset2 = Imager::Matrix2d->translate(x => $work->getwidth / 2, y => 0);
my $matrix = $offset1 * $persp * $offset2;
# $matrix undef
But since there's no way to build an object the only way to make it
work is to break encapsulation and bless the custom matrix into
Imager::Matrix2d.