org.freedesktop.cairo
Class Matrix

java.lang.Object
  extended by org.gnu.glib.Struct
      extended by org.freedesktop.cairo.Matrix

public class Matrix
extends org.gnu.glib.Struct

TODO: error handling


Constructor Summary
Matrix()
          Creates a new matrix initialized with a noop transform.
 
Method Summary
 double getX0()
           
 double getXX()
           
 double getXY()
           
 double getY0()
           
 double getYX()
           
 double getYY()
           
 void init(double xx, double yx, double xy, double yy, double x0, double y0)
          Sets the matrix to be the affine transformation given by xx, yx, xy, yy, x0, y0.
 void initIdentity()
          Modifies the matrix to be an identity transformation.
 void initRotate(double radians)
          Initialized the matrix to a transformation that rotates by
 void initScale(double sx, double sy)
          Initializes the matrix to a transformation that scales by sx and sy in the X and Y dimensions, respectively.
 void initTranslate(double tx, double ty)
          Initializes the matrix to a transformation that translates by tx and ty in the X and Y dimensions, respectively.
 void invert()
          Inverts this matrix.
static Matrix multiply(Matrix a, Matrix b)
          Multiplies 2 matrices and returns the result.
 void rotate(double radians)
          Appends rotation transformation to this matrix.
 void scale(double sx, double sy)
          Appends non-uniform scaling to this matrix.
 void setX0(double x0)
           
 void setXX(double xx)
           
 void setXY(double xy)
           
 void setY0(double y0)
           
 void setYX(double yx)
           
 void setYY(double yy)
           
 Point transformDistance(Point distance)
          Transforms the given distance and returns transformed co-ordinates
 Point transformPoint(Point point)
          Transforms the given point and returns transformed co-ordinates
 void translate(double tx, double ty)
          Appends a transaltion transformation to this matrix.
 
Methods inherited from class org.gnu.glib.Struct
equals, getHandle, getNullHandle, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix()
Creates a new matrix initialized with a noop transform.

Method Detail

init

public void init(double xx,
                 double yx,
                 double xy,
                 double yy,
                 double x0,
                 double y0)
Sets the matrix to be the affine transformation given by xx, yx, xy, yy, x0, y0. The transformation is given by: x_new = xx * x + xy * y + x0; y_new = yx * x + yy * y + y0;


initIdentity

public void initIdentity()
Modifies the matrix to be an identity transformation.


initTranslate

public void initTranslate(double tx,
                          double ty)
Initializes the matrix to a transformation that translates by tx and ty in the X and Y dimensions, respectively.

Parameters:
tx - amount to translate in the X direction.
ty - amount to translate in the Y direction.

initScale

public void initScale(double sx,
                      double sy)
Initializes the matrix to a transformation that scales by sx and sy in the X and Y dimensions, respectively.

Parameters:
sx - scale factor in the X direction.
sy - scale factor in the Y direction.

initRotate

public void initRotate(double radians)
Initialized the matrix to a transformation that rotates by

Parameters:
radians - angle of rotation, in radians. The direction of rotation is defined such that positive angles rotate in the direction from the positive X axis toward the positive Y axis. With the default axis orientation of cairo, positive angles rotate in a clockwise direction.

translate

public void translate(double tx,
                      double ty)
Appends a transaltion transformation to this matrix.

Parameters:
tx - X axis translation
ty - Y axis translation

scale

public void scale(double sx,
                  double sy)
Appends non-uniform scaling to this matrix.

Parameters:
sx - X axis scaling factor
sy - Y axis scaling factor

rotate

public void rotate(double radians)
Appends rotation transformation to this matrix.

Parameters:
radians - The rotation angle in radians.

invert

public void invert()
Inverts this matrix.


multiply

public static Matrix multiply(Matrix a,
                              Matrix b)
Multiplies 2 matrices and returns the result.

Parameters:
a - first matrix
b - second matrix
Returns:
The product

transformDistance

public Point transformDistance(Point distance)
Transforms the given distance and returns transformed co-ordinates


transformPoint

public Point transformPoint(Point point)
Transforms the given point and returns transformed co-ordinates


getXX

public double getXX()

setXX

public void setXX(double xx)

getYX

public double getYX()

setYX

public void setYX(double yx)

getXY

public double getXY()

setXY

public void setXY(double xy)

getYY

public double getYY()

setYY

public void setYY(double yy)

getX0

public double getX0()

setX0

public void setX0(double x0)

getY0

public double getY0()

setY0

public void setY0(double y0)