1Imager::Matrix2d(3)   User Contributed Perl Documentation  Imager::Matrix2d(3)
2
3
4

NAME

6         Imager::Matrix2d - simple wrapper for matrix construction
7

SYNOPSIS

9         use Imager::Matrix2d;
10         $m1 = Imager::Matrix2d->identity;
11         $m2 = Imager::Matrix2d->rotate(radians=>$angle, x=>$cx, y=>$cy);
12         $m3 = Imager::Matrix2d->translate(x=>$dx, y=>$dy);
13         $m4 = Imager::Matrix2d->shear(x=>$sx, y=>$sy);
14         $m5 = Imager::Matrix2d->reflect(axis=>$axis);
15         $m6 = Imager::Matrix2d->scale(x=>$xratio, y=>$yratio);
16         $m8 = Imager::Matric2d->matrix($v11, $v12, $v13,
17                                        $v21, $v22, $v23,
18                                        $v31, $v32, $v33);
19         $m6 = $m1 * $m2;
20         $m7 = $m1 + $m2;
21         use Imager::Matrix2d qw(:handy);
22         # various m2d_* functions imported
23         # where m2d_(.*) calls Imager::Matrix2d->$1()
24

DESCRIPTION

26       This class provides a simple wrapper around a reference to an array of
27       9 co-efficients, treated as a matrix:
28
29        [ 0, 1, 2,
30          3, 4, 5,
31          6, 7, 8 ]
32
33       Most of the methods in this class are constructors.  The others are
34       overloaded operators.
35
36       Note that since Imager represents images with y increasing from top to
37       bottom, rotation angles are clockwise, rather than counter-clockwise.
38
39       identity()
40           Returns the identity matrix.
41
42       rotate(radians=>$angle)
43       rotate(degrees=>$angle)
44           Creates a matrix that rotates around the origin, or around the
45           point (x,y) if the 'x' and 'y' parameters are provided.
46
47       translate(x=>$dx, y=>$dy)
48       translate(x=>$dx)
49       translate(y=>$dy)
50           Translates by the specify amounts.
51
52       shear(x=>$sx, y=>$sy)
53       shear(x=>$sx)
54       shear(y=>$sy)
55           Shear by the given amounts.
56
57       reflect(axis=>$axis)
58           Reflect around the given axis, either 'x' or 'y'.
59
60       reflect(radians=>$angle)
61       reflect(degrees=>$angle)
62           Reflect around a line drawn at the given angle from the origin.
63
64       scale(x=>$xratio, y=>$yratio)
65           Scales at the given ratios.
66
67           You can also specify a center for the scaling with the "cx" and
68           "cy" parameters.
69
70       matrix($v11, $v12, $v13, $v21, $v22, $v23, $v31, $v32, $v33)
71           Create a matrix with custom co-efficients.
72
73       _mult()
74           Implements the overloaded '*' operator.  Internal use.
75
76           Currently both the left and right-hand sides of the operator must
77           be an Imager::Matrix2d.
78
79       _add()
80           Implements the overloaded binary '+' operator.
81
82           Currently both the left and right sides of the operator must be
83           Imager::Matrix2d objects.
84
85       _string()
86           Implements the overloaded stringification operator.
87
88           This returns a string containing 3 lines of text with no
89           terminating newline.
90
91           I tried to make it fairly nicely formatted.  You might disagree :)
92
93       The following functions are shortcuts to the various constructors.
94
95       These are not methods.
96
97       You can import these methods with:
98
99         use Imager::Matrix2d ':handy';
100
101       m2d_identity
102       m2d_rotate()
103       m2d_translate()
104       m2d_shear()
105       m2d_reflect()
106       m2d_scale()
107

AUTHOR

109       Tony Cook <tony@develop-help.com>
110

BUGS

112       Needs a way to invert a matrix.
113

SEE ALSO

115       Imager(3), Imager::Font(3)
116
117       http://imager.perl.org/
118
119
120
121perl v5.12.3                      2011-06-06               Imager::Matrix2d(3)
Impressum