Package com.itextpdf.kernel.geom
Class AffineTransform
java.lang.Object
com.itextpdf.kernel.geom.AffineTransform
- All Implemented Interfaces:
-
Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation.static final intThe type of affine transformation. -
Constructor Summary
ConstructorsConstructorDescriptionAffineTransform(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.voidvoiddeltaTransform(double[] src, int srcOff, double[] dst, int dstOff, int length) deltaTransform(Point src, Point dst) booleandoublevoidgetMatrix(double[] matrix) voidgetMatrix(float[] matrix) static AffineTransformgetRotateInstance(double angle) Get an affine transformation representing a counter-clockwise rotation over the passed anglestatic AffineTransformgetRotateInstance(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 AffineTransformgetScaleInstance(double scx, double scY) doubledoublestatic AffineTransformgetShearInstance(double shx, double shy) doubledoublestatic AffineTransformgetTranslateInstance(double mx, double my) doubledoubleintgetType()Method returns type of affine transformation.inthashCode()voidinverseTransform(double[] src, int srcOff, double[] dst, int dstOff, int length) voidinverseTransform(float[] src, int srcOff, float[] dst, int dstOff, int length) inverseTransform(Point src, Point dst) booleanvoidvoidrotate(double angle) Add a counter-clockwise rotation to this transformationvoidrotate(double angle, double px, double py) Add a counter-clockwise rotation to this transformation, using the passed point as the center of rotationvoidscale(double scx, double scy) voidvoidsetToRotation(double angle) Set this affine transformation to represent a rotation over the passed anglevoidsetToRotation(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 rotationvoidsetToScale(double scx, double scy) voidsetToShear(double shx, double shy) voidsetToTranslation(double mx, double my) voidsetTransform(double m00, double m10, double m01, double m11, double m02, double m12) voidsetTransform(float m00, float m10, float m01, float m11, float m02, float m12) voidvoidshear(double shx, double shy) voidtransform(double[] src, int srcOff, double[] dst, int dstOff, int length) voidtransform(double[] src, int srcOff, float[] dst, int dstOff, int length) voidtransform(float[] src, int srcOff, double[] dst, int dstOff, int length) voidtransform(float[] src, int srcOff, float[] dst, int dstOff, int length) voidvoidtranslate(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:
-
AffineTransformrepresenting 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:
-
AffineTransformrepresenting 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:
-
clonein classObject - Returns:
- the copied AffineTransform.
- Throws:
-
CloneNotSupportedException
-
equals
-
hashCode
public int hashCode()
-