public final class Matrix extends Object
Class represents transformation matrix.
| Constructor and Description |
|---|
Matrix()
Constructor creates stanrard 1 to 1 matrix: [ A B C D E F ] = [ 1, 0, 0, 1, 0, 0]
|
Matrix(double[] matrixArray)
Constructor accepts a matrix with following array representation: [ A B C D E F ]
|
Matrix(double a,
double b,
double c,
double d,
double e,
double f)
Initializes transformation matrix with specified coefficients.
|
Matrix(float[] matrixArray)
Constructor accepts a matrix with following array representation: [ A B C D E F ]
|
Matrix(Matrix matrix)
Constructor accepts a matrix to create a copy
|
| Modifier and Type | Method and Description |
|---|---|
Matrix |
add(Matrix other)
Adds matrix to other matrix.
|
boolean |
equals(Object obj)
Compares matrix agains other object.
|
double |
getA()
Get A member of the transformation matrix.
|
static double |
getAngle(int rotation)
Transaltes rotation into angle (degrees)
|
double |
getB()
Get B member of the transformation matrix.
|
double |
getC()
Get C member of the transformation matrix.
|
double |
getD()
Get D member of the transformation matrix.
|
double |
getE()
Get E member of the transformation matrix.
|
double |
getF()
Get F member of the transformation matrix.
|
com.aspose.pdf.engine.data.IPdfArray |
getMatrix(com.aspose.pdf.engine.data.ITrailerable trailer)
Translates matrix into PDF array obect.
|
int |
hashCode()
Hash-code for object.
|
Matrix |
multiply(Matrix other)
Multiplies the matrix by other matrix.
|
Matrix |
reverse()
Calculates reverse matrix.
|
static Matrix |
rotation(double alpha)
Creates matrix for given rotation angle.
|
static Matrix |
scale(double x,
double y)
Creates matrix for given scale.
|
void |
setA(double value)
Set A member of the transformation matrix.
|
void |
setB(double value)
Set B member of the transformation matrix.
|
void |
setC(double value)
Set C member of the transformation matrix.
|
void |
setD(double value)
Set D member of the transformation matrix.
|
void |
setE(double value)
Set E member of the transformation matrix.
|
void |
setF(double value)
Set F member of the transformation matrix.
|
static Matrix |
skew(double alpha,
double beta)
Creates matrix for given rotation angle.
|
String |
toString()
Returns text reporesentation of the matrix.
|
Point |
transform(Point p)
Transforms point using this matrix.
|
Rectangle |
transform(Rectangle rect)
Transformes rectangle.
|
public Matrix()
Constructor creates stanrard 1 to 1 matrix: [ A B C D E F ] = [ 1, 0, 0, 1, 0, 0]
Matrix m = new Matrix();
public Matrix(double[] matrixArray)
Constructor accepts a matrix with following array representation: [ A B C D E F ]
double[] c = new double[] { 1, 0, 0, 1, 10, 20 }; Matrix m = new Matrix(c);
matrixArray - Matrix data array.public Matrix(float[] matrixArray)
Constructor accepts a matrix with following array representation: [ A B C D E F ]
double[] c = new double[] { 1, 0, 0, 1, 10, 20 }; Matrix m = new Matrix(c);
matrixArray - Matrix data array.public Matrix(Matrix matrix)
Constructor accepts a matrix to create a copy
matrix - Matrix object.public Matrix(double a,
double b,
double c,
double d,
double e,
double f)
Initializes transformation matrix with specified coefficients.
Matrix m = new Matrix(1, 0, 0, 1, 3, 3);
a - A matrix value.b - B matrix value.c - C matrix value.d - D matrix value.e - E matrix value.f - F matrix value.public double getA()
Get A member of the transformation matrix.
public void setA(double value)
Set A member of the transformation matrix.
value - double valuepublic double getB()
Get B member of the transformation matrix.
public void setB(double value)
Set B member of the transformation matrix.
value - double valuepublic double getC()
Get C member of the transformation matrix.
public void setC(double value)
Set C member of the transformation matrix.
value - double valuepublic double getD()
Get D member of the transformation matrix.
public void setD(double value)
Set D member of the transformation matrix.
value - double valuepublic double getE()
Get E member of the transformation matrix.
public void setE(double value)
Set E member of the transformation matrix.
value - double valuepublic double getF()
Get F member of the transformation matrix.
public void setF(double value)
Set F member of the transformation matrix.
value - double valuepublic String toString()
Returns text reporesentation of the matrix.
public boolean equals(Object obj)
Compares matrix agains other object.
public com.aspose.pdf.engine.data.IPdfArray getMatrix(com.aspose.pdf.engine.data.ITrailerable trailer)
Translates matrix into PDF array obect.
trailer - Trailerable objectpublic static Matrix rotation(double alpha)
Creates matrix for given rotation angle.
Matrix m = Matrix.Rotation(Math.PI / 2);
alpha - Rotation angle in radians.public static Matrix skew(double alpha, double beta)
Matrix m = Matrix.skew(Math.PI / 2, Math.PI / 2); alpha - Skew x angle in radians.beta - Skew y angle in radians.public static Matrix scale(double x, double y)
Creates matrix for given scale.
Matrix m = Matrix.scale(x, y);
x - Scale x.y - Scale y.public static double getAngle(int rotation)
Transaltes rotation into angle (degrees)
double angle = Matrix.getAngle(Rotation.on90); Matrix m = Matrix.rotation(angle);
rotation - Rotation value.public Matrix multiply(Matrix other)
Multiplies the matrix by other matrix.
Matrix a = new Matrix(new double[] { 1, 0, 0, 1, 10, 20 }); Matrix b = new Matrix(new double[] { 0, -1, 1, 0, 0, 0 } ); Matrix c= a.multiply(b);
other - Multiplier matrix.public Matrix add(Matrix other)
Adds matrix to other matrix.
other - Matrix to be added.public Point transform(Point p)
Transforms point using this matrix.
Matrix m = new Matrix(new double[] { 1, 0, 0, 1, 10, 20 } ); Point p = new Point(5, 5); Point p1 = m.transform(p);
p - Point which will be transformed.public Rectangle transform(Rectangle rect)
Transformes rectangle. If angle is not 90 * N degrees then bounding rectangle is returned.
Matrix m = new Matrix(new double[] { 1, 0, 0, 1, 10, 20 } ); Rectangle r = new Rectangle(0, 0, 100, 100); Rectangle r1 = m.transform(r1);
rect - Rectangle to be transformed.public Matrix reverse()
Calculates reverse matrix.
Matrix m = Matrix.rotation(Math.PI / 2); Matrix m1 = m.reverse();
Copyright © 2016 Aspose. All Rights Reserved.