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         $m6 = $m1 * $m2;
17         $m7 = $m1 + $m2;
18         use Imager::Matrix2d qw(:handy);
19         # various m2d_* functions imported
20         # where m2d_(.*) calls Imager::Matrix2d->$1()
21

DESCRIPTION

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

AUTHOR

103       Tony Cook <tony@develop-help.com>
104

BUGS

106       Needs a way to invert matrixes.
107

SEE ALSO

109       Imager(3), Imager::Font(3)
110
111       http://imager.perl.org/
112
113
114
115perl v5.8.8                       2008-03-28               Imager::Matrix2d(3)
Impressum