public class Matrix extends Object
Constructor and Description |
---|
Matrix()
Creates an identity matrix.
|
Matrix(Matrix source)
Creates a matrix that is a deep copy of the given matrix.
|
Modifier and Type | Method and Description |
---|---|
float[] |
getSNIContext()
Returns the SNI context data of this matrix.
|
void |
postConcat(Matrix other)
Postconcats the matrix with the specified matrix.
|
void |
postRotate(float degrees)
Postconcats the matrix with the specified rotation.
|
void |
postScale(float sx,
float sy)
Postconcats the matrix with the specified scale.
|
void |
postTranslate(float dx,
float dy)
Postconcats the matrix with the specified translation.
|
void |
preConcat(Matrix other)
Preconcats the matrix with the specified matrix.
|
void |
preRotate(float degrees)
Preconcats the matrix with the specified rotation.
|
void |
preScale(float sx,
float sy)
Preconcats the matrix with the specified scale.
|
void |
preTranslate(float dx,
float dy)
Preconcats the matrix with the specified translation.
|
void |
reset()
Resets the matrix to identity.
|
void |
set(Matrix source)
Deep copies the given matrix into this matrix.
|
void |
setConcat(Matrix a,
Matrix b)
Sets the matrix to the concatenation of the two specified matrices.
|
void |
setRotate(float degrees)
Sets the matrix to rotate about (0,0) by the specified number of degrees.
|
void |
setScale(float sx,
float sy)
Sets the matrix to scale by (sx, sy).
|
void |
setTranslate(float dx,
float dy)
Sets the matrix to translate by (dx, dy).
|
public Matrix()
public Matrix(Matrix source)
source
- the matrix to copy frompublic float[] getSNIContext()
The SNI context can be used to call a native method with SNI. This allows to identify and to use an matrix in the native world in order to perform operations with this matrix.
The data format is implementation specific.
public void postConcat(Matrix other)
other
- the matrix to concat withpublic void postRotate(float degrees)
degrees
- the degrees to rotatepublic void postScale(float sx, float sy)
sx
- the scale on xsy
- the scale on ypublic void postTranslate(float dx, float dy)
dx
- the translation on xdy
- the translation on ypublic void preConcat(Matrix other)
other
- the matrix to concat withpublic void preRotate(float degrees)
degrees
- the degrees to rotatepublic void preScale(float sx, float sy)
sx
- the scale on xsy
- the scale on ypublic void preTranslate(float dx, float dy)
dx
- the translation on xdy
- the translation on ypublic void reset()
public void set(Matrix source)
source
- the matrix to copy frompublic void setConcat(Matrix a, Matrix b)
Either of the two matrices may also be the target matrix, that is
matrixA.setConcat(matrixA, matrixB);
is valid.
a
- the first matrixb
- the second matrixpublic void setRotate(float degrees)
degrees
- the degrees to rotatepublic void setScale(float sx, float sy)
sx
- the scale on xsy
- the scale on ypublic void setTranslate(float dx, float dy)
dx
- the translation on xdy
- the translation on y