FileDocCategorySizeDatePackage
AffineTransform.javaAPI DocAndroid 1.5 API43357Wed May 06 22:41:54 BST 2009java.awt.geom

AffineTransform

public class AffineTransform extends Object implements Serializable, Cloneable
The Class AffineTransform represents a linear transformation (rotation, scaling, or shear) followed by a translation that acts on a coordinate space. It preserves collinearity of points and ratios of distances between collinear points: so if A, B, and C are on a line, then after the space has been transformed via the affine transform, the images of the three points will still be on a line, and the ratio of the distance from A to B with the distance from B to C will be the same as the corresponding ratio in the image space.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
The Constant serialVersionUID.
public static final int
TYPE_IDENTITY
The Constant TYPE_IDENTITY.
public static final int
TYPE_TRANSLATION
The Constant TYPE_TRANSLATION.
public static final int
TYPE_UNIFORM_SCALE
The Constant TYPE_UNIFORM_SCALE.
public static final int
TYPE_GENERAL_SCALE
The Constant TYPE_GENERAL_SCALE.
public static final int
TYPE_QUADRANT_ROTATION
The Constant TYPE_QUADRANT_ROTATION.
public static final int
TYPE_GENERAL_ROTATION
The Constant TYPE_GENERAL_ROTATION.
public static final int
TYPE_GENERAL_TRANSFORM
The Constant TYPE_GENERAL_TRANSFORM.
public static final int
TYPE_FLIP
The Constant TYPE_FLIP.
public static final int
TYPE_MASK_SCALE
The Constant TYPE_MASK_SCALE.
public static final int
TYPE_MASK_ROTATION
The Constant TYPE_MASK_ROTATION.
static final int
TYPE_UNKNOWN
The TYPE_UNKNOWN is an initial type value.
static final double
ZERO
The min value equivalent to zero. If absolute value less then ZERO it considered as zero.
double
m00
The values of transformation matrix.
double
m10
The m10.
double
m01
The m01.
double
m11
The m11.
double
m02
The m02.
double
m12
The m12.
transient int
type
The transformation type.
Constructors Summary
public AffineTransform()
Instantiates a new affine transform of type TYPE_IDENTITY (which leaves coordinates unchanged).


                     
      
        type = TYPE_IDENTITY;
        m00 = m11 = 1.0;
        m10 = m01 = m02 = m12 = 0.0;
    
public AffineTransform(AffineTransform t)
Instantiates a new affine transform that has the same data as the given AffineTransform.

param
t the transform to copy.

        this.type = t.type;
        this.m00 = t.m00;
        this.m10 = t.m10;
        this.m01 = t.m01;
        this.m11 = t.m11;
        this.m02 = t.m02;
        this.m12 = t.m12;
    
public AffineTransform(float m00, float m10, float m01, float m11, float m02, float m12)
Instantiates a new affine transform by specifying the values of the 2x3 transformation matrix as floats. The type is set to the default type: TYPE_UNKNOWN

param
m00 the m00 entry in the transformation matrix.
param
m10 the m10 entry in the transformation matrix.
param
m01 the m01 entry in the transformation matrix.
param
m11 the m11 entry in the transformation matrix.
param
m02 the m02 entry in the transformation matrix.
param
m12 the m12 entry in the transformation matrix.

        this.type = TYPE_UNKNOWN;
        this.m00 = m00;
        this.m10 = m10;
        this.m01 = m01;
        this.m11 = m11;
        this.m02 = m02;
        this.m12 = m12;
    
public AffineTransform(double m00, double m10, double m01, double m11, double m02, double m12)
Instantiates a new affine transform by specifying the values of the 2x3 transformation matrix as doubles. The type is set to the default type: TYPE_UNKNOWN

param
m00 the m00 entry in the transformation matrix.
param
m10 the m10 entry in the transformation matrix.
param
m01 the m01 entry in the transformation matrix.
param
m11 the m11 entry in the transformation matrix.
param
m02 the m02 entry in the transformation matrix.
param
m12 the m12 entry in the transformation matrix.

        this.type = TYPE_UNKNOWN;
        this.m00 = m00;
        this.m10 = m10;
        this.m01 = m01;
        this.m11 = m11;
        this.m02 = m02;
        this.m12 = m12;
    
public AffineTransform(float[] matrix)
Instantiates a new affine transform by reading the values of the transformation matrix from an array of floats. The mapping from the array to the matrix starts with matrix[0] giving the top-left entry of the matrix and proceeds with the usual left-to-right and top-down ordering.

If the array has only four entries, then the two entries of the last row of the transformation matrix default to zero.

param
matrix the array of four or six floats giving the values of the matrix.
throws
ArrayIndexOutOfBoundsException if the size of the array is 0, 1, 2, 3, or 5.

        this.type = TYPE_UNKNOWN;
        m00 = matrix[0];
        m10 = matrix[1];
        m01 = matrix[2];
        m11 = matrix[3];
        if (matrix.length > 4) {
            m02 = matrix[4];
            m12 = matrix[5];
        }
    
public AffineTransform(double[] matrix)
Instantiates a new affine transform by reading the values of the transformation matrix from an array of doubles. The mapping from the array to the matrix starts with matrix[0] giving the top-left entry of the matrix and proceeds with the usual left-to-right and top-down ordering.

If the array has only four entries, then the two entries of the last row of the transformation matrix default to zero.

param
matrix the array of four or six doubles giving the values of the matrix.
throws
ArrayIndexOutOfBoundsException if the size of the array is 0, 1, 2, 3, or 5.

        this.type = TYPE_UNKNOWN;
        m00 = matrix[0];
        m10 = matrix[1];
        m01 = matrix[2];
        m11 = matrix[3];
        if (matrix.length > 4) {
            m02 = matrix[4];
            m12 = matrix[5];
        }
    
Methods Summary
public java.lang.Objectclone()

        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            throw new InternalError();
        }
    
public voidconcatenate(java.awt.geom.AffineTransform t)
Applies the given AffineTransform to this AffineTransform via matrix multiplication.

param
t the AffineTransform to apply to this AffineTransform.

        setTransform(multiply(t, this));
    
public java.awt.geom.AffineTransformcreateInverse()
Creates an AffineTransform that is the inverse of this transform.

return
the affine transform that is the inverse of this AffineTransform.
throws
NoninvertibleTransformException if this AffineTransform cannot be inverted (the determinant of the linear transformation part is zero).

        double det = getDeterminant();
        if (Math.abs(det) < ZERO) {
            // awt.204=Determinant is zero
            throw new NoninvertibleTransformException(Messages.getString("awt.204")); //$NON-NLS-1$
        }
        return new AffineTransform(m11 / det, // m00
                -m10 / det, // m10
                -m01 / det, // m01
                m00 / det, // m11
                (m01 * m12 - m11 * m02) / det, // m02
                (m10 * m02 - m00 * m12) / det // m12
        );
    
public java.awt.ShapecreateTransformedShape(java.awt.Shape src)
Creates a new shape whose data is given by applying this AffineTransform to the specified shape.

param
src the original shape whose data is to be transformed.
return
the new shape found by applying this AffineTransform to the original shape.

        if (src == null) {
            return null;
        }
        if (src instanceof GeneralPath) {
            return ((GeneralPath)src).createTransformedShape(this);
        }
        PathIterator path = src.getPathIterator(this);
        GeneralPath dst = new GeneralPath(path.getWindingRule());
        dst.append(path, false);
        return dst;
    
public java.awt.geom.Point2DdeltaTransform(java.awt.geom.Point2D src, java.awt.geom.Point2D dst)
Transforms the point according to the linear transformation part of this AffineTransformation (without applying the translation).

param
src the original point.
param
dst the point object where the result of the delta transform is written.
return
the result of applying the delta transform (linear part only) to the original point.

        if (dst == null) {
            if (dst instanceof Point2D.Double) {
                dst = new Point2D.Double();
            } else {
                dst = new Point2D.Float();
            }
        }

        double x = src.getX();
        double y = src.getY();

        dst.setLocation(x * m00 + y * m01, x * m10 + y * m11);
        return dst;
    
public voiddeltaTransform(double[] src, int srcOff, double[] dst, int dstOff, int length)
Applies the linear transformation part of this AffineTransform (ignoring the translation part) to a set of points given as an array of double values where every two values in the array give the coordinates of a point; the even-indexed values giving the x coordinates and the odd-indexed values giving the y coordinates.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the delta transformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length*2 > src.length or dstOff + length*2 > dst.length.

        while (--length >= 0) {
            double x = src[srcOff++];
            double y = src[srcOff++];
            dst[dstOff++] = x * m00 + y * m01;
            dst[dstOff++] = x * m10 + y * m11;
        }
    
public booleanequals(java.lang.Object obj)

        if (obj == this) {
            return true;
        }
        if (obj instanceof AffineTransform) {
            AffineTransform t = (AffineTransform)obj;
            return m00 == t.m00 && m01 == t.m01 && m02 == t.m02 && m10 == t.m10 && m11 == t.m11
                    && m12 == t.m12;
        }
        return false;
    
public doublegetDeterminant()
Gets the determinant of the linear transformation matrix.

return
the determinant of the linear transformation matrix.

        return m00 * m11 - m01 * m10;
    
public voidgetMatrix(double[] matrix)
Writes the values of the transformation matrix into the given array of doubles. If the array has length 4, only the linear transformation part will be written into it. If it has length greater than 4, the translation vector will be included as well.

param
matrix the array to fill with the values of the matrix.
throws
ArrayIndexOutOfBoundsException if the size of the array is 0, 1, 2, 3, or 5.

        matrix[0] = m00;
        matrix[1] = m10;
        matrix[2] = m01;
        matrix[3] = m11;
        if (matrix.length > 4) {
            matrix[4] = m02;
            matrix[5] = m12;
        }
    
public static java.awt.geom.AffineTransformgetRotateInstance(double angle)
Creates a new AffineTransformation that is a rotation alone. The new transformation's type is TYPE_IDENTITY if the AffineTransformation is the identity transformation, otherwise it's TYPE_UNKNOWN.

param
angle the angle of rotation in radians.
return
the new AffineTransformation.

        AffineTransform t = new AffineTransform();
        t.setToRotation(angle);
        return t;
    
public static java.awt.geom.AffineTransformgetRotateInstance(double angle, double x, double y)
Creates a new AffineTransformation that is a rotation followed by a translation. Sets the type to TYPE_UNKNOWN.

param
angle the angle of rotation in radians.
param
x the distance to translate in the x direction.
param
y the distance to translate in the y direction.
return
the new AffineTransformation.

        AffineTransform t = new AffineTransform();
        t.setToRotation(angle, x, y);
        return t;
    
public static java.awt.geom.AffineTransformgetScaleInstance(double scx, double scY)
Creates a new AffineTransformation that is a scale alone. The new transformation's type is TYPE_IDENTITY if the AffineTransformation is the identity transformation, otherwise it's TYPE_UNKNOWN.

param
scx the scaling factor in the x direction.
param
scY the scaling factor in the y direction.
return
the new AffineTransformation.

        AffineTransform t = new AffineTransform();
        t.setToScale(scx, scY);
        return t;
    
public doublegetScaleX()
Gets the scale x entry of the transformation matrix (the upper left matrix entry).

return
the scale x value.

        return m00;
    
public doublegetScaleY()
Gets the scale y entry of the transformation matrix (the lower right entry of the linear transformation).

return
the scale y value.

        return m11;
    
public static java.awt.geom.AffineTransformgetShearInstance(double shx, double shy)
Creates a new AffineTransformation that is a shear alone. The new transformation's type is TYPE_IDENTITY if the AffineTransformation is the identity transformation, otherwise it's TYPE_UNKNOWN.

param
shx the shearing factor in the x direction.
param
shy the shearing factor in the y direction.
return
the new AffineTransformation.

        AffineTransform m = new AffineTransform();
        m.setToShear(shx, shy);
        return m;
    
public doublegetShearX()
Gets the shear x entry of the transformation matrix (the upper right entry of the linear transformation).

return
the shear x value.

        return m01;
    
public doublegetShearY()
Gets the shear y entry of the transformation matrix (the lower left entry of the linear transformation).

return
the shear y value.

        return m10;
    
public static java.awt.geom.AffineTransformgetTranslateInstance(double mx, double my)
Creates a new AffineTransformation that is a translation alone with the translation vector given by the values sent as parameters. The new transformation's type is TYPE_IDENTITY if the AffineTransformation is the identity transformation, otherwise it's TYPE_TRANSLATION.

param
mx the distance to translate in the x direction.
param
my the distance to translate in the y direction.
return
the new AffineTransformation.

        AffineTransform t = new AffineTransform();
        t.setToTranslation(mx, my);
        return t;
    
public doublegetTranslateX()
Gets the x coordinate of the translation vector.

return
the x coordinate of the translation vector.

        return m02;
    
public doublegetTranslateY()
Gets the y coordinate of the translation vector.

return
the y coordinate of the translation vector.

        return m12;
    
public intgetType()
Returns type of the affine transformation.

The type is computed as follows: Label the entries of the transformation matrix as three rows (m00, m01), (m10, m11), and (m02, m12). Then if the original basis vectors are (1, 0) and (0, 1), the new basis vectors after transformation are given by (m00, m01) and (m10, m11), and the translation vector is (m02, m12).

The types are classified as follows:
TYPE_IDENTITY - no change
TYPE_TRANSLATION - The translation vector isn't zero
TYPE_UNIFORM_SCALE - The new basis vectors have equal length
TYPE_GENERAL_SCALE - The new basis vectors dont' have equal length
TYPE_FLIP - The new basis vector orientation differs from the original one
TYPE_QUADRANT_ROTATION - The new basis is a rotation of the original by 90, 180, 270, or 360 degrees
TYPE_GENERAL_ROTATION - The new basis is a rotation of the original by an arbitrary angle
TYPE_GENERAL_TRANSFORM - The transformation can't be inverted.

Note that multiple types are possible, thus the types can be combined using bitwise combinations.

return
the type of the Affine Transform.

        if (type != TYPE_UNKNOWN) {
            return type;
        }

        int type = 0;

        if (m00 * m01 + m10 * m11 != 0.0) {
            type |= TYPE_GENERAL_TRANSFORM;
            return type;
        }

        if (m02 != 0.0 || m12 != 0.0) {
            type |= TYPE_TRANSLATION;
        } else if (m00 == 1.0 && m11 == 1.0 && m01 == 0.0 && m10 == 0.0) {
            type = TYPE_IDENTITY;
            return type;
        }

        if (m00 * m11 - m01 * m10 < 0.0) {
            type |= TYPE_FLIP;
        }

        double dx = m00 * m00 + m10 * m10;
        double dy = m01 * m01 + m11 * m11;
        if (dx != dy) {
            type |= TYPE_GENERAL_SCALE;
        } else if (dx != 1.0) {
            type |= TYPE_UNIFORM_SCALE;
        }

        if ((m00 == 0.0 && m11 == 0.0) || (m10 == 0.0 && m01 == 0.0 && (m00 < 0.0 || m11 < 0.0))) {
            type |= TYPE_QUADRANT_ROTATION;
        } else if (m01 != 0.0 || m10 != 0.0) {
            type |= TYPE_GENERAL_ROTATION;
        }

        return type;
    
public inthashCode()

        HashCode hash = new HashCode();
        hash.append(m00);
        hash.append(m01);
        hash.append(m02);
        hash.append(m10);
        hash.append(m11);
        hash.append(m12);
        return hash.hashCode();
    
public java.awt.geom.Point2DinverseTransform(java.awt.geom.Point2D src, java.awt.geom.Point2D dst)
Transforms the point according to the inverse of this AffineTransformation.

param
src the original point.
param
dst the point object where the result of the inverse transform is written (may be null).
return
the result of applying the inverse transform. Inverse transform.
throws
NoninvertibleTransformException if this AffineTransform cannot be inverted (the determinant of the linear transformation part is zero).

        double det = getDeterminant();
        if (Math.abs(det) < ZERO) {
            // awt.204=Determinant is zero
            throw new NoninvertibleTransformException(Messages.getString("awt.204")); //$NON-NLS-1$
        }

        if (dst == null) {
            if (src instanceof Point2D.Double) {
                dst = new Point2D.Double();
            } else {
                dst = new Point2D.Float();
            }
        }

        double x = src.getX() - m02;
        double y = src.getY() - m12;

        dst.setLocation((x * m11 - y * m01) / det, (y * m00 - x * m10) / det);
        return dst;
    
public voidinverseTransform(double[] src, int srcOff, double[] dst, int dstOff, int length)
Applies the inverse of this AffineTransform to a set of points given as an array of double values where every two values in the array give the coordinates of a point; the even-indexed values giving the x coordinates and the odd-indexed values giving the y coordinates.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the inverse of the AffineTransformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length*2 > src.length or dstOff + length*2 > dst.length.
throws
NoninvertibleTransformException if this AffineTransform cannot be inverted (the determinant of the linear transformation part is zero).

        double det = getDeterminant();
        if (Math.abs(det) < ZERO) {
            // awt.204=Determinant is zero
            throw new NoninvertibleTransformException(Messages.getString("awt.204")); //$NON-NLS-1$
        }

        while (--length >= 0) {
            double x = src[srcOff++] - m02;
            double y = src[srcOff++] - m12;
            dst[dstOff++] = (x * m11 - y * m01) / det;
            dst[dstOff++] = (y * m00 - x * m10) / det;
        }
    
public booleanisIdentity()
Checks if the AffineTransformation is the identity.

return
true, if the AffineTransformation is the identity.

        return getType() == TYPE_IDENTITY;
    
java.awt.geom.AffineTransformmultiply(java.awt.geom.AffineTransform t1, java.awt.geom.AffineTransform t2)
Multiplies the matrix representations of two AffineTransform objects.

param
t1 - the AffineTransform object is a multiplicand
param
t2 - the AffineTransform object is a multiplier
return
an AffineTransform object that is the result of t1 multiplied by the matrix t2.

        return new AffineTransform(t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00
                t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01
                t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10
                t1.m01 * t2.m10 + t1.m11 * t2.m11, // m11
                t1.m02 * t2.m00 + t1.m12 * t2.m01 + t2.m02, // m02
                t1.m02 * t2.m10 + t1.m12 * t2.m11 + t2.m12);// m12
    
public voidpreConcatenate(java.awt.geom.AffineTransform t)
Changes the current AffineTransform the one obtained by taking the transform t and applying this AffineTransform to it.

param
t the AffineTransform that this AffineTransform is multiplied by.

        setTransform(multiply(this, t));
    
private voidreadObject(java.io.ObjectInputStream stream)
Read the AffineTransform object from the input stream.

param
stream - the input stream.
throws
IOException - if there are I/O errors while reading from the input stream.
throws
ClassNotFoundException - if class could not be found.

        stream.defaultReadObject();
        type = TYPE_UNKNOWN;
    
public voidrotate(double angle)
Applies a rotation transformation to this AffineTransformation.

param
angle the angle of rotation in radians.

        concatenate(AffineTransform.getRotateInstance(angle));
    
public voidrotate(double angle, double px, double py)
Applies a rotation and translation transformation to this AffineTransformation.

param
angle the angle of rotation in radians.
param
px the distance to translate in the x direction.
param
py the distance to translate in the y direction.

        concatenate(AffineTransform.getRotateInstance(angle, px, py));
    
public voidscale(double scx, double scy)
Applies a scaling transformation to this AffineTransformation.

param
scx the scaling factor in the x direction.
param
scy the scaling factor in the y direction.

        concatenate(AffineTransform.getScaleInstance(scx, scy));
    
public voidsetToIdentity()
Sets the transform to the identity transform.

        type = TYPE_IDENTITY;
        m00 = m11 = 1.0;
        m10 = m01 = m02 = m12 = 0.0;
    
public voidsetToRotation(double angle)
Sets the transformation to being a rotation alone, eliminating shearing, scaling, and translation elements. Sets the type to TYPE_IDENTITY if the resulting AffineTransformation is the identity transformation, otherwise sets it to TYPE_UNKNOWN.

param
angle the angle of rotation in radians.

        double sin = Math.sin(angle);
        double cos = Math.cos(angle);
        if (Math.abs(cos) < ZERO) {
            cos = 0.0;
            sin = sin > 0.0 ? 1.0 : -1.0;
        } else if (Math.abs(sin) < ZERO) {
            sin = 0.0;
            cos = cos > 0.0 ? 1.0 : -1.0;
        }
        m00 = m11 = cos;
        m01 = -sin;
        m10 = sin;
        m02 = m12 = 0.0;
        type = TYPE_UNKNOWN;
    
public voidsetToRotation(double angle, double px, double py)
Sets the transformation to being a rotation followed by a translation. Sets the type to TYPE_UNKNOWN.

param
angle the angle of rotation in radians.
param
px the distance to translate in the x direction.
param
py the distance to translate in the y direction.

        setToRotation(angle);
        m02 = px * (1.0 - m00) + py * m10;
        m12 = py * (1.0 - m00) - px * m10;
        type = TYPE_UNKNOWN;
    
public voidsetToScale(double scx, double scy)
Sets the transformation to being a scale alone, eliminating rotation, shear, and translation elements. Sets the type to TYPE_IDENTITY if the resulting AffineTransformation is the identity transformation, otherwise sets it to TYPE_UNKNOWN.

param
scx the scaling factor in the x direction.
param
scy the scaling factor in the y direction.

        m00 = scx;
        m11 = scy;
        m10 = m01 = m02 = m12 = 0.0;
        if (scx != 1.0 || scy != 1.0) {
            type = TYPE_UNKNOWN;
        } else {
            type = TYPE_IDENTITY;
        }
    
public voidsetToShear(double shx, double shy)
Sets the transformation to being a shear alone, eliminating rotation, scaling, and translation elements. Sets the type to TYPE_IDENTITY if the resulting AffineTransformation is the identity transformation, otherwise sets it to TYPE_UNKNOWN.

param
shx the shearing factor in the x direction.
param
shy the shearing factor in the y direction.

        m00 = m11 = 1.0;
        m02 = m12 = 0.0;
        m01 = shx;
        m10 = shy;
        if (shx != 0.0 || shy != 0.0) {
            type = TYPE_UNKNOWN;
        } else {
            type = TYPE_IDENTITY;
        }
    
public voidsetToTranslation(double mx, double my)
Sets the transformation to a translation alone. Sets the linear part of the transformation to identity and the translation vector to the values sent as parameters. Sets the type to TYPE_IDENTITY if the resulting AffineTransformation is the identity transformation, otherwise sets it to TYPE_TRANSLATION.

param
mx the distance to translate in the x direction.
param
my the distance to translate in the y direction.

        m00 = m11 = 1.0;
        m01 = m10 = 0.0;
        m02 = mx;
        m12 = my;
        if (mx == 0.0 && my == 0.0) {
            type = TYPE_IDENTITY;
        } else {
            type = TYPE_TRANSLATION;
        }
    
public voidsetTransform(double m00, double m10, double m01, double m11, double m02, double m12)
Sets the transform in terms of a list of double values.

param
m00 the m00 coordinate of the transformation matrix.
param
m10 the m10 coordinate of the transformation matrix.
param
m01 the m01 coordinate of the transformation matrix.
param
m11 the m11 coordinate of the transformation matrix.
param
m02 the m02 coordinate of the transformation matrix.
param
m12 the m12 coordinate of the transformation matrix.

        this.type = TYPE_UNKNOWN;
        this.m00 = m00;
        this.m10 = m10;
        this.m01 = m01;
        this.m11 = m11;
        this.m02 = m02;
        this.m12 = m12;
    
public voidsetTransform(java.awt.geom.AffineTransform t)
Sets the transform's data to match the data of the transform sent as a parameter.

param
t the transform that gives the new values.

        type = t.type;
        setTransform(t.m00, t.m10, t.m01, t.m11, t.m02, t.m12);
    
public voidshear(double shx, double shy)
Applies a shearing transformation to this AffineTransformation.

param
shx the shearing factor in the x direction.
param
shy the shearing factor in the y direction.

        concatenate(AffineTransform.getShearInstance(shx, shy));
    
public java.lang.StringtoString()

        return getClass().getName() + "[[" + m00 + ", " + m01 + ", " + m02 + "], [" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                + m10 + ", " + m11 + ", " + m12 + "]]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    
public java.awt.geom.Point2Dtransform(java.awt.geom.Point2D src, java.awt.geom.Point2D dst)
Apply the current AffineTransform to the point.

param
src the original point.
param
dst Point2D object to be filled with the destination coordinates (where the original point is sent by this AffineTransform). May be null.
return
the point in the AffineTransform's image space where the original point is sent.

        if (dst == null) {
            if (src instanceof Point2D.Double) {
                dst = new Point2D.Double();
            } else {
                dst = new Point2D.Float();
            }
        }

        double x = src.getX();
        double y = src.getY();

        dst.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12);
        return dst;
    
public voidtransform(java.awt.geom.Point2D[] src, int srcOff, java.awt.geom.Point2D[] dst, int dstOff, int length)
Applies this AffineTransform to an array of points.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the AffineTransformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length > src.length or dstOff + length > dst.length.

        while (--length >= 0) {
            Point2D srcPoint = src[srcOff++];
            double x = srcPoint.getX();
            double y = srcPoint.getY();
            Point2D dstPoint = dst[dstOff];
            if (dstPoint == null) {
                if (srcPoint instanceof Point2D.Double) {
                    dstPoint = new Point2D.Double();
                } else {
                    dstPoint = new Point2D.Float();
                }
            }
            dstPoint.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12);
            dst[dstOff++] = dstPoint;
        }
    
public voidtransform(double[] src, int srcOff, double[] dst, int dstOff, int length)
Applies this AffineTransform to a set of points given as an array of double values where every two values in the array give the coordinates of a point; the even-indexed values giving the x coordinates and the odd-indexed values giving the y coordinates.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the AffineTransformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length*2 > src.length or dstOff + length*2 > dst.length.

        int step = 2;
        if (src == dst && srcOff < dstOff && dstOff < srcOff + length * 2) {
            srcOff = srcOff + length * 2 - 2;
            dstOff = dstOff + length * 2 - 2;
            step = -2;
        }
        while (--length >= 0) {
            double x = src[srcOff + 0];
            double y = src[srcOff + 1];
            dst[dstOff + 0] = x * m00 + y * m01 + m02;
            dst[dstOff + 1] = x * m10 + y * m11 + m12;
            srcOff += step;
            dstOff += step;
        }
    
public voidtransform(float[] src, int srcOff, float[] dst, int dstOff, int length)
Applies this AffineTransform to a set of points given as an array of float values where every two values in the array give the coordinates of a point; the even-indexed values giving the x coordinates and the odd-indexed values giving the y coordinates.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the AffineTransformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length*2 > src.length or dstOff + length*2 > dst.length.

        int step = 2;
        if (src == dst && srcOff < dstOff && dstOff < srcOff + length * 2) {
            srcOff = srcOff + length * 2 - 2;
            dstOff = dstOff + length * 2 - 2;
            step = -2;
        }
        while (--length >= 0) {
            float x = src[srcOff + 0];
            float y = src[srcOff + 1];
            dst[dstOff + 0] = (float)(x * m00 + y * m01 + m02);
            dst[dstOff + 1] = (float)(x * m10 + y * m11 + m12);
            srcOff += step;
            dstOff += step;
        }
    
public voidtransform(float[] src, int srcOff, double[] dst, int dstOff, int length)
Applies this AffineTransform to a set of points given as an array of float values where every two values in the array give the coordinates of a point; the even-indexed values giving the x coordinates and the odd-indexed values giving the y coordinates. The destination coordinates are given as values of type double.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the AffineTransformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length*2 > src.length or dstOff + length*2 > dst.length.

        while (--length >= 0) {
            float x = src[srcOff++];
            float y = src[srcOff++];
            dst[dstOff++] = x * m00 + y * m01 + m02;
            dst[dstOff++] = x * m10 + y * m11 + m12;
        }
    
public voidtransform(double[] src, int srcOff, float[] dst, int dstOff, int length)
Applies this AffineTransform to a set of points given as an array of double values where every two values in the array give the coordinates of a point; the even-indexed values giving the x coordinates and the odd-indexed values giving the y coordinates. The destination coordinates are given as values of type float.

param
src the array of points to be transformed.
param
srcOff the offset in the source point array of the first point to be transformed.
param
dst the point array where the images of the points (after applying the AffineTransformation) should be placed.
param
dstOff the offset in the destination array where the new values should be written.
param
length the number of points to transform.
throws
ArrayIndexOutOfBoundsException if srcOff + length*2 > src.length or dstOff + length*2 > dst.length.

        while (--length >= 0) {
            double x = src[srcOff++];
            double y = src[srcOff++];
            dst[dstOff++] = (float)(x * m00 + y * m01 + m02);
            dst[dstOff++] = (float)(x * m10 + y * m11 + m12);
        }
    
public voidtranslate(double mx, double my)
Applies a translation to this AffineTransformation.

param
mx the distance to translate in the x direction.
param
my the distance to translate in the y direction.

        concatenate(AffineTransform.getTranslateInstance(mx, my));
    
private voidwriteObject(java.io.ObjectOutputStream stream)
Writes the AffineTrassform object to the output steam.

param
stream - the output stream.
throws
IOException - if there are I/O errors while writing to the output stream.

        stream.defaultWriteObject();