public class Matrix
extends java.lang.Object
A Matrix can be filled with multiple transformation operations. These operations can be identified by eiher
Constructor and Description |
---|
Matrix()
Create an empty Matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
copy(Matrix srcMatrix)
Init matrix with an other matrix operations.
|
int |
getHandle()
Get an handle to the matrix object.
|
void |
identity()
Clear all operations and initialize the matrix as an identity matrix.
|
static void |
perspective(float px,
float py,
Matrix matrix)
Apply a perspective operation to a matrix.
|
void |
rotate(float degrees)
Add a rotate operation to the list of operations.
|
void |
scale(float scale_x,
float scale_y)
Add a scale operation to the list of operations.
|
void |
transform(java.awt.geom.GeneralPath p)
Transform the matrix with a GeneralPath object.
|
void |
transform(java.awt.Graphics2D g2d)
Apply all operations of the matrix to a Graphics2d object.
|
void |
transform(java.awt.geom.Point2D source,
java.awt.geom.Point2D destination)
Transform the matrix with 2 Point2D objects.
|
java.awt.Shape |
transform(java.awt.Shape shape)
Transform the matrix with a Shape object.
|
void |
translate(float x,
float y)
Add a translate operation to the list of operations.
|
public int getHandle()
public void transform(java.awt.Graphics2D g2d)
g2d
- Graphics2d object used to transform the matrix.public void transform(java.awt.geom.GeneralPath p)
p
- GeneralPath object used to transform the matrix.public void transform(java.awt.geom.Point2D source, java.awt.geom.Point2D destination)
source
- source point used to transform the matrix.destination
- destination point used to transform the matrix.public java.awt.Shape transform(java.awt.Shape shape)
shape
- Shape object used to transform the matrix.public void identity()
public void translate(float x, float y)
x
- translation horizontal offset.y
- translation vertical offset.public void scale(float scale_x, float scale_y)
scale_x
- horizontal scaling factor.scale_y
- vertical scaling factor.public void rotate(float degrees)
degrees
- rotation angle in degrees.public static void perspective(float px, float py, Matrix matrix)
px
- w0 of perspective transformation matrix.py
- w1 of perspective transformation matrix.matrix
- matrix to apply the operation on.public void copy(Matrix srcMatrix)
srcMatrix
- Source matrix