.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Imager::Matrix2d 3pm" .TH Imager::Matrix2d 3pm "2014-01-10" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" .Vb 1 \& Imager::Matrix2d \- simple wrapper for matrix construction .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 10 \& use Imager::Matrix2d; \& $m1 = Imager::Matrix2d\->identity; \& $m2 = Imager::Matrix2d\->rotate(radians=>$angle, x=>$cx, y=>$cy); \& $m3 = Imager::Matrix2d\->translate(x=>$dx, y=>$dy); \& $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); \& # various m2d_* functions imported \& # where m2d_(.*) calls Imager::Matrix2d\->$1() .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides a simple wrapper around a reference to an array of 9 coefficients, treated as a matrix: .PP .Vb 3 \& [ 0, 1, 2, \& 3, 4, 5, \& 6, 7, 8 ] .Ve .PP Most of the methods in this class are constructors. The others are overloaded operators. .PP Note that since Imager represents images with y increasing from top to bottom, rotation angles are clockwise, rather than counter-clockwise. .IP "\fIidentity()\fR" 4 .IX Item "identity()" Returns the identity matrix. .IP "rotate(radians=>$angle)" 4 .IX Item "rotate(radians=>$angle)" .PD 0 .IP "rotate(degrees=>$angle)" 4 .IX Item "rotate(degrees=>$angle)" .PD Creates a matrix that rotates around the origin, or around the point (x,y) if the 'x' and 'y' parameters are provided. .IP "translate(x=>$dx, y=>$dy)" 4 .IX Item "translate(x=>$dx, y=>$dy)" .PD 0 .IP "translate(x=>$dx)" 4 .IX Item "translate(x=>$dx)" .IP "translate(y=>$dy)" 4 .IX Item "translate(y=>$dy)" .PD Translates by the specify amounts. .IP "shear(x=>$sx, y=>$sy)" 4 .IX Item "shear(x=>$sx, y=>$sy)" .PD 0 .IP "shear(x=>$sx)" 4 .IX Item "shear(x=>$sx)" .IP "shear(y=>$sy)" 4 .IX Item "shear(y=>$sy)" .PD Shear by the given amounts. .IP "reflect(axis=>$axis)" 4 .IX Item "reflect(axis=>$axis)" Reflect around the given axis, either 'x' or 'y'. .IP "reflect(radians=>$angle)" 4 .IX Item "reflect(radians=>$angle)" .PD 0 .IP "reflect(degrees=>$angle)" 4 .IX Item "reflect(degrees=>$angle)" .PD Reflect around a line drawn at the given angle from the origin. .IP "scale(x=>$xratio, y=>$yratio)" 4 .IX Item "scale(x=>$xratio, y=>$yratio)" Scales at the given ratios. .Sp You can also specify a center for the scaling with the \f(CW\*(C`cx\*(C'\fR and \f(CW\*(C`cy\*(C'\fR parameters. .ie n .IP "matrix($v11, $v12, $v13, $v21, $v22, $v23, $v31, $v32, $v33)" 4 .el .IP "matrix($v11, \f(CW$v12\fR, \f(CW$v13\fR, \f(CW$v21\fR, \f(CW$v22\fR, \f(CW$v23\fR, \f(CW$v31\fR, \f(CW$v32\fR, \f(CW$v33\fR)" 4 .IX Item "matrix($v11, $v12, $v13, $v21, $v22, $v23, $v31, $v32, $v33)" Create a matrix with custom coefficients. .IP "\fI_mult()\fR" 4 .IX Item "_mult()" Implements the overloaded '*' operator. Internal use. .Sp Currently both the left and right-hand sides of the operator must be an Imager::Matrix2d. .IP "\fI_add()\fR" 4 .IX Item "_add()" Implements the overloaded binary '+' operator. .Sp Currently both the left and right sides of the operator must be Imager::Matrix2d objects. .IP "\fI_string()\fR" 4 .IX Item "_string()" Implements the overloaded stringification operator. .Sp This returns a string containing 3 lines of text with no terminating newline. .Sp I tried to make it fairly nicely formatted. You might disagree :) .IP "_eq" 4 .IX Item "_eq" Implement the overloaded equality operator. .Sp Provided for older perls that don't handle magic auto generation of eq from "". .PP The following functions are shortcuts to the various constructors. .PP These are not methods. .PP You can import these methods with: .PP .Vb 1 \& use Imager::Matrix2d \*(Aq:handy\*(Aq; .Ve .IP "m2d_identity" 4 .IX Item "m2d_identity" .PD 0 .IP "\fIm2d_rotate()\fR" 4 .IX Item "m2d_rotate()" .IP "\fIm2d_translate()\fR" 4 .IX Item "m2d_translate()" .IP "\fIm2d_shear()\fR" 4 .IX Item "m2d_shear()" .IP "\fIm2d_reflect()\fR" 4 .IX Item "m2d_reflect()" .IP "\fIm2d_scale()\fR" 4 .IX Item "m2d_scale()" .PD .SH "AUTHOR" .IX Header "AUTHOR" Tony Cook .SH "BUGS" .IX Header "BUGS" Needs a way to invert a matrix. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIImager\fR\|(3), \fIImager::Font\fR\|(3) .PP http://imager.perl.org/