Constructor and Description |
---|
Matrix()
Constructor.
|
Matrix(AffineTransform at)
Creates a matrix with the same elements as the given AffineTransform.
|
Matrix(COSArray array)
Creates a matrix from a 6-element (a b c d e f) COS array.
|
Matrix(float a,
float b,
float c,
float d,
float e,
float f)
Creates a transformation matrix with the given 6 elements.
|
Modifier and Type | Method and Description |
---|---|
Matrix |
clone()
Clones this object.
|
void |
concatenate(Matrix matrix)
Concatenates (premultiplies) the given matrix to this matrix.
|
static Matrix |
concatenate(Matrix a,
Matrix b)
Produces a copy of the first matrix, with the second matrix concatenated.
|
AffineTransform |
createAffineTransform()
Create an affine transform from this matrix's values.
|
boolean |
equals(Object obj) |
Matrix |
extractScaling()
Deprecated.
This method is due to be removed, please contact us if you make use of it.
|
Matrix |
extractTranslating()
Deprecated.
This method is due to be removed, please contact us if you make use of it.
|
static Matrix |
getRotateInstance(double theta,
float tx,
float ty)
Convenience method to create a rotated instance.
|
static Matrix |
getScaleInstance(float sx,
float sy)
Convenience method to create a scaled instance.
|
float |
getScaleX()
Returns the x-scaling element of this matrix.
|
float |
getScaleY()
Returns the y-scaling element of this matrix.
|
float |
getScalingFactorX()
Returns the x-scaling factor of this matrix.
|
float |
getScalingFactorY()
Returns the y-scaling factor of this matrix.
|
float |
getShearX()
Returns the x-shear element of this matrix.
|
float |
getShearY()
Returns the y-shear element of this matrix.
|
static Matrix |
getTranslateInstance(float tx,
float ty)
Convenience method to create a translating instance.
|
float |
getTranslateX()
Returns the x-translation element of this matrix.
|
float |
getTranslateY()
Returns the y-translation element of this matrix.
|
static Matrix |
getTranslatingInstance(float tx,
float ty)
Deprecated.
Use
getTranslateInstance(float, float) instead. |
float |
getValue(int row,
int column)
This will get a matrix value at some point.
|
float[][] |
getValues()
Return a single dimension array of all values in the matrix.
|
double[][] |
getValuesAsDouble()
Deprecated.
Use
getValues() instead. |
float |
getXPosition()
Deprecated.
Use
getTranslateX() instead |
float |
getYPosition()
Deprecated.
Use
getTranslateY() instead |
int |
hashCode() |
Matrix |
multiply(Matrix b)
This will take the current matrix and multiply it with a matrix that is passed in.
|
Matrix |
multiply(Matrix other,
Matrix result)
This method multiplies this Matrix with the specified other Matrix, storing the product in the specified
result Matrix.
|
void |
reset()
Deprecated.
This method will be removed.
|
void |
rotate(double theta)
Rotares this matrix by the given factors.
|
void |
scale(float sx,
float sy)
Scales this matrix by the given factors.
|
void |
setFromAffineTransform(AffineTransform af)
Deprecated.
Use the
Matrix(AffineTransform) constructor instead. |
void |
setValue(int row,
int column,
float value)
This will set a value at a position.
|
COSArray |
toCOSArray()
Returns a COS array which represents this matrix.
|
String |
toString() |
void |
transform(Point2D point)
Transforms the given point by this matrix.
|
Vector |
transform(Vector vector)
Transforms the given point by this matrix.
|
Point2D.Float |
transformPoint(float x,
float y)
Transforms the given point by this matrix.
|
void |
translate(float tx,
float ty)
Translates this matrix by the given ammount.
|
void |
translate(Vector vector)
Translates this matrix by the given vector.
|
public Matrix()
public Matrix(COSArray array)
array
- public Matrix(float a, float b, float c, float d, float e, float f)
a
- the X coordinate scaling element (m00) of the 3x3 matrixb
- the Y coordinate shearing element (m10) of the 3x3 matrixc
- the X coordinate shearing element (m01) of the 3x3 matrixd
- the Y coordinate scaling element (m11) of the 3x3 matrixe
- the X coordinate translation element (m02) of the 3x3 matrixf
- the Y coordinate translation element (m12) of the 3x3 matrixgetRotateInstance(double, float, float)
,
getScaleInstance(float, float)
,
getTranslateInstance(float, float)
public Matrix(AffineTransform at)
at
- @Deprecated public void reset()
public AffineTransform createAffineTransform()
@Deprecated public void setFromAffineTransform(AffineTransform af)
Matrix(AffineTransform)
constructor instead.af
- The transform to get the values from.public float getValue(int row, int column)
row
- The row to get the value from.column
- The column to get the value from.public void setValue(int row, int column, float value)
row
- The row to set the value at.column
- the column to set the value at.value
- The value to set at the position.public float[][] getValues()
@Deprecated public double[][] getValuesAsDouble()
getValues()
instead.public void concatenate(Matrix matrix)
matrix
- The matrix to concatenate.public void translate(Vector vector)
vector
- 2D vectorpublic void translate(float tx, float ty)
tx
- x-translationty
- y-translationpublic void scale(float sx, float sy)
sx
- x-scalesy
- y-scalepublic void rotate(double theta)
theta
- The angle of rotation measured in radianspublic Matrix multiply(Matrix b)
b
- The matrix to multiply by.public Matrix multiply(Matrix other, Matrix result)
It is allowed to have (other == this) or (result == this) or indeed (other == result) but if this is done, the backing float[] matrix values may be copied in order to ensure a correct product.
other
- the second operand Matrix in the multiplicationresult
- the Matrix instance into which the result should be stored. If result is null, a new Matrix
instance is created.public void transform(Point2D point)
point
- point to transformpublic Point2D.Float transformPoint(float x, float y)
x
- x-coordinatey
- y-coordinatepublic Vector transform(Vector vector)
vector
- 2D vector@Deprecated public Matrix extractScaling()
public static Matrix getScaleInstance(float sx, float sy)
sx
- The xscale operator.sy
- The yscale operator.@Deprecated public Matrix extractTranslating()
@Deprecated public static Matrix getTranslatingInstance(float tx, float ty)
getTranslateInstance(float, float)
instead.tx
- The x translating operator.ty
- The y translating operator.public static Matrix getTranslateInstance(float tx, float ty)
tx
- The x translating operator.ty
- The y translating operator.public static Matrix getRotateInstance(double theta, float tx, float ty)
theta
- The angle of rotation measured in radianstx
- The x translation.ty
- The y translation.public static Matrix concatenate(Matrix a, Matrix b)
a
- The matrix to copy.b
- The matrix to concatenate.public Matrix clone()
public float getScalingFactorX()
public float getScalingFactorY()
public float getScaleX()
getScalingFactorX()
public float getShearY()
public float getShearX()
public float getScaleY()
getScalingFactorY()
public float getTranslateX()
public float getTranslateY()
@Deprecated public float getXPosition()
getTranslateX()
instead@Deprecated public float getYPosition()
getTranslateY()
insteadpublic COSArray toCOSArray()
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.