public final class Matrix extends Object implements com.aspose.ms.System.IDisposable
Encapsulates a 3-by-3 affine matrix that represents a geometric transform. This class cannot be inherited.
| Modifier and Type | Field and Description |
|---|---|
static Matrix |
IdentityTransform |
| Constructor and Description |
|---|
Matrix()
Initializes a new instance of the Matrix class as the identity matrix.
|
Matrix(float m11,
float m12,
float m21,
float m22,
float dx,
float dy)
Initializes a new instance of the Matrix class with the specified elements.
|
Matrix(RectangleF rect,
PointF[] plgpts)
Initializes a new instance of the
Matrix class to the geometric transform defined by the specified rectangle and array of points. |
Matrix(Rectangle rect,
Point[] plgpts)
Initializes a new instance of the
Matrix class to the geometric transform defined by the specified rectangle and array of points. |
| Modifier and Type | Method and Description |
|---|---|
Matrix |
deepClone()
Creates an exact copy of this Matrix.
|
void |
dispose()
Releases all resources used by this Matrix.
|
float[] |
getElements()
Gets an array of floating-point values that represents the elements of this Matrix.
|
float |
getOffsetX()
Gets the x translation value (the dx value, or the element in the third row and first column) of this Matrix.
|
float |
getOffsetY()
Gets the y translation value (the
dy value, or the element in the third row and second column) of this Matrix. |
void |
invert()
Inverts this Matrix, if it is invertible.
|
boolean |
isIdentity()
Gets a value indicating whether this Matrix is the identity matrix.
|
boolean |
isInvertible()
Gets a value indicating whether this Matrix is invertible.
|
void |
multiply(Matrix matrix)
|
void |
multiply(Matrix matrix,
int order)
Multiplies this
Matrix by the matrix specified in the matrix parameter,
and in the order specified in the order parameter. |
void |
reset()
Resets this
Matrix to have the elements of the identity matrix. |
void |
rotate(float angle)
Prepend to this
Matrix a clockwise rotation, around the origin and by the specified angle. |
void |
rotate(float angle,
int order)
Applies a clockwise rotation of an amount specified in the angle parameter, around the origin (zero x and y coordinates) for this
Matrix. |
void |
rotateAt(float angle,
PointF point)
Applies a clockwise rotation to this Matrix around the point specified in the point parameter, and by prepending the rotation.
|
void |
rotateAt(float angle,
PointF point,
int order)
Applies a clockwise rotation about the specified point to this Matrix in the specified order.
|
void |
scale(float scaleX,
float scaleY)
Applies the specified scale vector to this Matrix by prepending the scale vector.
|
void |
scale(float scaleX,
float scaleY,
int order)
Applies the specified scale vector (scaleX and scaleY) to this Matrix using the specified order.
|
void |
shear(float shearX,
float shearY)
Applies the specified shear vector to this Matrix by prepending the shear transformation.
|
void |
shear(float shearX,
float shearY,
int order)
Applies the specified shear vector to this Matrix in the specified order.
|
void |
transformPoints(Point[] pts)
Applies the geometric transform represented by this
Matrix to a specified array of points. |
void |
transformPoints(PointF[] pts)
Applies the geometric transform represented by this
Matrix to a specified array of points. |
void |
transformVectors(PointF[] pts)
Multiplies each vector in an array by the matrix.
|
void |
translate(float offsetX,
float offsetY)
Applies the specified translation vector (offsetX and offsetY) to this Matrix by prepending the translation vector.
|
void |
translate(float offsetX,
float offsetY,
int order)
Applies the specified translation vector to this Matrix in the specified order.
|
public static final Matrix IdentityTransform
public Matrix()
Initializes a new instance of the Matrix class as the identity matrix.
public Matrix(float m11,
float m12,
float m21,
float m22,
float dx,
float dy)
Initializes a new instance of the Matrix class with the specified elements.
m11 - The value in the first row and first column of the new Matrix.m12 - The value in the first row and second column of the new Matrix.m21 - The value in the second row and first column of the new Matrix.m22 - The value in the second row and second column of the new Matrix.dx - The value in the third row and first column of the new Matrix.dy - The value in the third row and second column of the new Matrix.public Matrix(Rectangle rect, Point[] plgpts)
Initializes a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points.
rect - A Rectangle structure that represents the rectangle to be transformed.plgpts - An array of three Point structures that represents the points of a parallelogram to which the upper-left, upper-right, and lower-left corners of the rectangle is to be transformed. The lower-right corner of the parallelogram is implied by the first three corners.public Matrix(RectangleF rect, PointF[] plgpts)
Initializes a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points.
rect - A RectangleF structure that represents the rectangle to be transformed.plgpts - An array of three PointF structures that represents the points of a parallelogram to which the upper-left, upper-right, and lower-left corners of the rectangle is to be transformed. The lower-right corner of the parallelogram is implied by the first three corners.public float[] getElements()
Gets an array of floating-point values that represents the elements of this Matrix.
public boolean isIdentity()
Gets a value indicating whether this Matrix is the identity matrix.
public boolean isInvertible()
Gets a value indicating whether this Matrix is invertible.
public float getOffsetX()
Gets the x translation value (the dx value, or the element in the third row and first column) of this Matrix.
public float getOffsetY()
Gets the y translation value (the dy value, or the element in the third row and second column) of this Matrix.
dy value, or the element in the third row and second column) of this Matrix.public void dispose()
Releases all resources used by this Matrix.
dispose in interface com.aspose.ms.System.IDisposablepublic Matrix deepClone()
Creates an exact copy of this Matrix.
public void invert()
Inverts this Matrix, if it is invertible.
public void translate(float offsetX,
float offsetY)
Applies the specified translation vector (offsetX and offsetY) to this Matrix by prepending the translation vector.
offsetX - The x value by which to translate this Matrix.offsetY - The y value by which to translate this Matrix.public void translate(float offsetX,
float offsetY,
int order)
Applies the specified translation vector to this Matrix in the specified order.
offsetX - The x value by which to translate this Matrix.offsetY - The y value by which to translate this Matrix.order - A MatrixOrder that specifies the order (append or prepend) in which
the translation is applied to this Matrix.public void transformVectors(PointF[] pts)
Multiplies each vector in an array by the matrix. The translation elements of this matrix (third row) are ignored.
pts - An array of PointF structures that represents the points to transform.public void scale(float scaleX,
float scaleY)
Applies the specified scale vector to this Matrix by prepending the scale vector.
scaleX - The value by which to scale this Matrix in the x-axis direction.scaleY - The value by which to scale this Matrix in the y-axis direction.public void scale(float scaleX,
float scaleY,
int order)
Applies the specified scale vector (scaleX and scaleY) to this Matrix using the specified order.
scaleX - The value by which to scale this Matrix in the x-axis direction.scaleY - The value by which to scale this Matrix in the y-axis direction.order - A MatrixOrder that specifies the order (append or prepend)
in which the scale vector is applied to this Matrix.public void shear(float shearX,
float shearY)
Applies the specified shear vector to this Matrix by prepending the shear transformation.
shearX - The horizontal shear factor.shearY - The vertical shear factor.public void shear(float shearX,
float shearY,
int order)
Applies the specified shear vector to this Matrix in the specified order.
shearX - The horizontal shear factor.shearY - The vertical shear factor.order - A MatrixOrder that specifies the order (append or prepend) in which the shear is applied.public void rotateAt(float angle,
PointF point)
Applies a clockwise rotation to this Matrix around the point specified in the point parameter, and by prepending the rotation.
angle - The angle (extent) of the rotation, in degrees.point - A PointF that represents the center of the rotation.public void rotateAt(float angle,
PointF point,
int order)
Applies a clockwise rotation about the specified point to this Matrix in the specified order.
angle - The angle of the rotation, in degrees.point - A PointF that represents the center of the rotation.order - A MatrixOrder that specifies the order (append or prepend) in which the rotation is applied.public void transformPoints(PointF[] pts)
Applies the geometric transform represented by this Matrix to a specified array of points.
pts - An array of PointF structures that represents the points to transform.public void transformPoints(Point[] pts)
Applies the geometric transform represented by this Matrix to a specified array of points.
pts - An array of Point structures that represents the points to transform.public void multiply(Matrix matrix)
public void multiply(Matrix matrix, int order)
Multiplies this Matrix by the matrix specified in the matrix parameter,
and in the order specified in the order parameter.
matrix - The Matrix by which this Matrix is to be multiplied.order - The MatrixOrder that represents the order of the multiplication.public void rotate(float angle)
Prepend to this Matrix a clockwise rotation, around the origin and by the specified angle.
angle - The angle of the rotation, in degrees.public void rotate(float angle,
int order)
Applies a clockwise rotation of an amount specified in the angle parameter, around the origin (zero x and y coordinates) for this Matrix.
angle - The angle of the rotation, in degrees.order - A MatrixOrder that specifies the order (append or prepend) in which the rotation is applied to this Matrix.public void reset()
Resets this Matrix to have the elements of the identity matrix.
Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.