Package com.itextpdf.kernel.geom
Class AffineTransform
java.lang.Object
com.itextpdf.kernel.geom.AffineTransform
- All Implemented Interfaces:
-
Cloneable
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation.static final int
The type of affine transformation. -
Constructor Summary
ConstructorDescriptionAffineTransform
(double[] matrix) AffineTransform
(double m00, double m10, double m01, double m11, double m02, double m12) AffineTransform
(float[] matrix) -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a "deep copy" of this AffineTransform, meaning the object returned by this method will be independent of the object being cloned.void
void
deltaTransform
(double[] src, int srcOff, double[] dst, int dstOff, int length) deltaTransform
(Point src, Point dst) boolean
double
void
getMatrix
(double[] matrix) void
getMatrix
(float[] matrix) static AffineTransform
getRotateInstance
(double angle) Get an affine transformation representing a counter-clockwise rotation over the passed anglestatic AffineTransform
getRotateInstance
(double angle, double x, double y) Get an affine transformation representing a counter-clockwise rotation over the passed angle, using the passed point as the center of rotationstatic AffineTransform
getScaleInstance
(double scx, double scY) double
double
static AffineTransform
getShearInstance
(double shx, double shy) double
double
static AffineTransform
getTranslateInstance
(double mx, double my) double
double
int
getType()
Method returns type of affine transformation.int
hashCode()
void
inverseTransform
(double[] src, int srcOff, double[] dst, int dstOff, int length) void
inverseTransform
(float[] src, int srcOff, float[] dst, int dstOff, int length) inverseTransform
(Point src, Point dst) boolean
void
void
rotate
(double angle) Add a counter-clockwise rotation to this transformationvoid
rotate
(double angle, double px, double py) Add a counter-clockwise rotation to this transformation, using the passed point as the center of rotationvoid
scale
(double scx, double scy) void
void
setToRotation
(double angle) Set this affine transformation to represent a rotation over the passed anglevoid
setToRotation
(double angle, double px, double py) Set this affine transformation to represent a rotation over the passed angle, using the passed point as the center of rotationvoid
setToScale
(double scx, double scy) void
setToShear
(double shx, double shy) void
setToTranslation
(double mx, double my) void
setTransform
(double m00, double m10, double m01, double m11, double m02, double m12) void
setTransform
(float m00, float m10, float m01, float m11, float m02, float m12) void
void
shear
(double shx, double shy) void
transform
(double[] src, int srcOff, double[] dst, int dstOff, int length) void
transform
(double[] src, int srcOff, float[] dst, int dstOff, int length) void
transform
(float[] src, int srcOff, double[] dst, int dstOff, int length) void
transform
(float[] src, int srcOff, float[] dst, int dstOff, int length) void
void
translate
(double mx, double my)
-
Field Details
-
TYPE_IDENTITY
public static final int TYPE_IDENTITYThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_TRANSLATION
public static final int TYPE_TRANSLATIONThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_UNIFORM_SCALE
public static final int TYPE_UNIFORM_SCALEThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_GENERAL_SCALE
public static final int TYPE_GENERAL_SCALEThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_QUADRANT_ROTATION
public static final int TYPE_QUADRANT_ROTATIONThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_GENERAL_ROTATION
public static final int TYPE_GENERAL_ROTATIONThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_GENERAL_TRANSFORM
public static final int TYPE_GENERAL_TRANSFORMThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_FLIP
public static final int TYPE_FLIPThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_MASK_SCALE
public static final int TYPE_MASK_SCALEThe type of affine transformation. SeegetType()
.- See Also:
-
TYPE_MASK_ROTATION
public static final int TYPE_MASK_ROTATIONThe type of affine transformation. SeegetType()
.- See Also:
-
-
Constructor Details
-
AffineTransform
public AffineTransform() -
AffineTransform
-
AffineTransform
public AffineTransform(double m00, double m10, double m01, double m11, double m02, double m12) -
AffineTransform
public AffineTransform(float[] matrix) -
AffineTransform
public AffineTransform(double[] matrix)
-
-
Method Details
-
getType
public int getType()Method returns type of affine transformation.Transform matrix is m00 m01 m02 m10 m11 m12
According analytic geometry new basis vectors are (m00, m01) and (m10, m11), translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1). Type transformations classification:
TYPE_IDENTITY
- new basis equals original one and zero translationTYPE_TRANSLATION
- translation vector isn't zeroTYPE_UNIFORM_SCALE
- vectors length of new basis equalsTYPE_GENERAL_SCALE
- vectors length of new basis doesn't equalTYPE_FLIP
- new basis vector orientation differ from original oneTYPE_QUADRANT_ROTATION
- new basis is rotated by 90, 180, 270, or 360 degreesTYPE_GENERAL_ROTATION
- new basis is rotated by arbitrary angleTYPE_GENERAL_TRANSFORM
- transformation can't be inversed
- Returns:
- the type of this AffineTransform
-
getScaleX
public double getScaleX() -
getScaleY
public double getScaleY() -
getShearX
public double getShearX() -
getShearY
public double getShearY() -
getTranslateX
public double getTranslateX() -
getTranslateY
public double getTranslateY() -
isIdentity
public boolean isIdentity() -
getMatrix
public void getMatrix(float[] matrix) -
getMatrix
public void getMatrix(double[] matrix) -
getDeterminant
public double getDeterminant() -
setTransform
public void setTransform(float m00, float m10, float m01, float m11, float m02, float m12) -
setTransform
public void setTransform(double m00, double m10, double m01, double m11, double m02, double m12) -
setTransform
-
setToIdentity
public void setToIdentity() -
setToTranslation
public void setToTranslation(double mx, double my) -
setToScale
public void setToScale(double scx, double scy) -
setToShear
public void setToShear(double shx, double shy) -
setToRotation
public void setToRotation(double angle) Set this affine transformation to represent a rotation over the passed angle- Parameters:
-
angle
- angle to rotate over in radians
-
setToRotation
public void setToRotation(double angle, double px, double py) Set this affine transformation to represent a rotation over the passed angle, using the passed point as the center of rotation- Parameters:
-
angle
- angle to rotate over in radians -
px
- x-coordinate of center of rotation -
py
- y-coordinate of center of rotation
-
getTranslateInstance
-
getScaleInstance
-
getShearInstance
-
getRotateInstance
Get an affine transformation representing a counter-clockwise rotation over the passed angle- Parameters:
-
angle
- angle in radians to rotate over - Returns:
-
AffineTransform
representing the rotation
-
getRotateInstance
Get an affine transformation representing a counter-clockwise rotation over the passed angle, using the passed point as the center of rotation- Parameters:
-
angle
- angle in radians to rotate over -
x
- x-coordinate of center of rotation -
y
- y-coordinate of center of rotation - Returns:
-
AffineTransform
representing the rotation
-
translate
public void translate(double mx, double my) -
scale
public void scale(double scx, double scy) -
shear
public void shear(double shx, double shy) -
rotate
public void rotate(double angle) Add a counter-clockwise rotation to this transformation- Parameters:
-
angle
- angle in radians to rotate over
-
rotate
public void rotate(double angle, double px, double py) Add a counter-clockwise rotation to this transformation, using the passed point as the center of rotation- Parameters:
-
angle
- angle in radians to rotate over -
px
- x-coordinate of center of rotation -
py
- y-coordinate of center of rotation
-
concatenate
-
preConcatenate
-
createInverse
- Throws:
-
NoninvertibleTransformException
-
transform
-
transform
-
transform
public void transform(double[] src, int srcOff, double[] dst, int dstOff, int length) -
transform
public void transform(float[] src, int srcOff, float[] dst, int dstOff, int length) -
transform
public void transform(float[] src, int srcOff, double[] dst, int dstOff, int length) -
transform
public void transform(double[] src, int srcOff, float[] dst, int dstOff, int length) -
deltaTransform
-
deltaTransform
public void deltaTransform(double[] src, int srcOff, double[] dst, int dstOff, int length) -
inverseTransform
- Throws:
-
NoninvertibleTransformException
-
inverseTransform
public void inverseTransform(double[] src, int srcOff, double[] dst, int dstOff, int length) throws NoninvertibleTransformException - Throws:
-
NoninvertibleTransformException
-
inverseTransform
public void inverseTransform(float[] src, int srcOff, float[] dst, int dstOff, int length) throws NoninvertibleTransformException - Throws:
-
NoninvertibleTransformException
-
clone
Creates a "deep copy" of this AffineTransform, meaning the object returned by this method will be independent of the object being cloned.- Overrides:
-
clone
in classObject
- Returns:
- the copied AffineTransform.
- Throws:
-
CloneNotSupportedException
-
equals
-
hashCode
public int hashCode()
-