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 m = new Matrix();
|
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);
|
Matrix(double a,
double b,
double c,
double d,
double e,
double f)
Initializes transformation matrix with specified coefficients.
|
Matrix(Matrix matrix)
Constructor
accepts a matrix to create a copy
|
Modifier and Type | Method and Description |
---|---|
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 angle = Matrix.GetAngle(Rotation.on90);
Matrix m = Matrix.Rotation(angle);
|
double |
getB()
Get B member of the transformation matrix.
|
double |
getC()
Get C member of the transformation matrix.
|
double |
getD()
Set 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.
|
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)
Get 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.
|
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
- public Matrix(Matrix matrix)
Constructor accepts a matrix to create a copy
matrix
- 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
- Ab
- Bc
- Cd
- De
- Ef
- Fpublic double getA()
Get A member of the transformation matrix.
public void setA(double value)
Set A member of the transformation matrix.
public double getB()
Get B member of the transformation matrix.
public void setB(double value)
Set B member of the transformation matrix.
public double getC()
Get C member of the transformation matrix.
public void setC(double value)
Set C member of the transformation matrix.
public double getD()
Set D member of the transformation matrix.
public void setD(double value)
Get D member of the transformation matrix.
public double getE()
Get E member of the transformation matrix.
public void setE(double value)
Set E member of the transformation matrix.
public double getF()
Get F member of the transformation matrix.
public void setF(double value)
Set F member of the transformation matrix.
public 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 double getAngle(int rotation)
Transaltes rotation into angle (degrees)
double angle = Matrix.GetAngle(Rotation.on90); Matrix m = Matrix.Rotation(angle);
rotation
- 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 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 © 2017 Aspose. All Rights Reserved.