org.freedesktop.cairo

Class Matrix

public class Matrix extends CairoObject

Deprecated: This class is part of the java-gnome 2.x family of libraries, which, due to their inefficiency and complexity, are no longer being maintained and have been abandoned by the java-gnome project. This class may exist in java-gnome 4.0; look out for org.freedesktop.cairo.Matrix. As this package was never correctly implemented in java-gnome 2.x, any new code written will likely have a considerably different public API.

TODO: error handling
Constructor Summary
Matrix()
Creates a new matrix initialized with a noop transform.
Method Summary
doublegetX0()
doublegetXX()
doublegetXY()
doublegetY0()
doublegetYX()
doublegetYY()
voidinit(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.
voidinitIdentity()
Modifies the matrix to be an identity transformation.
voidinitRotate(double radians)
Initialized the matrix to a transformation that rotates by
voidinitScale(double sx, double sy)
Initializes the matrix to a transformation that scales by sx and sy in the X and Y dimensions, respectively.
voidinitTranslate(double tx, double ty)
Initializes the matrix to a transformation that translates by tx and ty in the X and Y dimensions, respectively.
voidinvert()
Inverts this matrix.
static Matrixmultiply(Matrix a, Matrix b)
Multiplies 2 matrices and returns the result.
voidrotate(double radians)
Appends rotation transformation to this matrix.
voidscale(double sx, double sy)
Appends non-uniform scaling to this matrix.
voidsetX0(double x0)
voidsetXX(double xx)
voidsetXY(double xy)
voidsetY0(double y0)
voidsetYX(double yx)
voidsetYY(double yy)
PointtransformDistance(Point distance)
Transforms the given distance and returns transformed co-ordinates
PointtransformPoint(Point point)
Transforms the given point and returns transformed co-ordinates
voidtranslate(double tx, double ty)
Appends a transaltion transformation to this matrix.

Constructor Detail

Matrix

public Matrix()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Creates a new matrix initialized with a noop transform.

Method Detail

getX0

public double getX0()

getXX

public double getXX()

getXY

public double getXY()

getY0

public double getY0()

getYX

public double getYX()

getYY

public double getYY()

init

public void init(double xx, double yx, double xy, double yy, double x0, double y0)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

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()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Modifies the matrix to be an identity transformation.

initRotate

public void initRotate(double radians)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

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.

UNKNOWN:

initScale

public void initScale(double sx, double sy)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

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.

initTranslate

public void initTranslate(double tx, double ty)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

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.

invert

public void invert()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Inverts this matrix.

multiply

public static Matrix multiply(Matrix a, Matrix b)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Multiplies 2 matrices and returns the result.

Parameters: a first matrix b second matrix

Returns: The product

rotate

public void rotate(double radians)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Appends rotation transformation to this matrix.

Parameters: radians The rotation angle in radians.

scale

public void scale(double sx, double sy)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Appends non-uniform scaling to this matrix.

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

setX0

public void setX0(double x0)

setXX

public void setXX(double xx)

setXY

public void setXY(double xy)

setY0

public void setY0(double y0)

setYX

public void setYX(double yx)

setYY

public void setYY(double yy)

transformDistance

public Point transformDistance(Point distance)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Transforms the given distance and returns transformed co-ordinates

transformPoint

public Point transformPoint(Point point)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Transforms the given point and returns transformed co-ordinates

translate

public void translate(double tx, double ty)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Appends a transaltion transformation to this matrix.

Parameters: tx X axis translation ty Y axis translation