[cairo-commit] [cairo-www] src/matrix_transform.mdwn

Carl Worth cworth at freedesktop.org
Mon Nov 12 11:15:42 PST 2007


 src/matrix_transform.mdwn |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit c55a1073c432bd90cbe731206a8e2f16ea862d36
Author: frob <frob at df.ru>
Date:   Mon Nov 12 11:15:41 2007 -0800

    added 2 flip/rotation matrixes and 'xx <-> a11;...' equivivalents

diff --git a/src/matrix_transform.mdwn b/src/matrix_transform.mdwn
index 951e4e4..42c64aa 100644
--- a/src/matrix_transform.mdwn
+++ b/src/matrix_transform.mdwn
@@ -14,7 +14,10 @@ mtrx have to be used in the command ctx.transform(mtrx)
 <tr><td>Rotation to A radians with center in x,y</td><td>ctx.translate(x,y); ctx.rotate(A); ctx.translate(-x,-y)</td><td>mtrx = cairo.Matrix(C,S,-S,C,x-C*x+S*y,y-S*x-C*y)</td></tr>
 <tr><td>X-skew by A</td><td>--</td><td>mtrx = cairo.Matrix(1,0,T,1,0,0)</td></tr>
 <tr><td>Y-skew by A</td><td>--</td><td>mtrx = cairo.Matrix(1,T,0,1,0,0)</td></tr>
+<tr><td>Flip H/V with center in cx:cy</td><td>--</td><td>mtrx = cairo.Matrix(fx,0,0,fy,cx*(1-fx),cy*(fy-1))</td></tr>
+<tr><td>Flip H/V and rotation with center in cx:cy</td><td>--</td><td>mtrx = cairo.Matrix(fx*C,fx*S,-S*fy,C*fy,C*cx*(1-fx)-S*cy*(fy-1)+cx-C*cx+S*cy,S*cx*(1-fx)+C*cy*(fy-1)+cy-S*cx-C*cy)</td></tr>
 </table>
+(For flips fx/fy = 1 means 'no flip', fx/fy = -1 are used for horizontal/vertical flip).
 
 ---
 
@@ -24,4 +27,7 @@ The rule of matrix multiplication is illustrated with a picture here:
 
 <img src="http://www.gnome.ru/devel_notes/matrix_multiplication.png" width="911" height="117" border="0" alt="Matrix multiplication rule">
 
+In a cairo.matrix(1,2,3,4,5,6), 1 is a11, 2 is a21, 3 is a12, 4 is a22, 5 is a13 and 6 is a23.
+a31 and a32 are 0, a33 is 1. 
+
 Cairo provides matrix <a href="http://cairographics.org/manual/cairo-cairo-matrix-t.html#cairo-matrix-multiply">multiplication</a> and some other matrix <a href="http://cairographics.org/manual/cairo-cairo-matrix-t.html">functions</a>.
\ No newline at end of file


More information about the cairo-commit mailing list