Class RMTransform

  • All Implemented Interfaces:
    RMArchiver.Archiving, java.lang.Cloneable

    public class RMTransform
    extends RMObject
    This class represents a simple 2D transform.
    • Constructor Summary

      Constructors 
      Constructor Description
      RMTransform()
      Creates a new identity transform.
      RMTransform​(float a, float b, float c, float d, float tx, float ty)
      Creates a transform initialized to given matrix components.
      RMTransform​(float dx, float dy, float angle, float sx, float sy, float skx, float sky)
      Create a transform with translation, rotation, and skew.
      RMTransform​(float dx, float dy, float anAngle, float porx, float pory, float sx, float sy, float skx, float sky)
      Creates a transform with translation and given rotation/skew about a point.
      RMTransform​(RMTransform aTransform)
      Creates a new transform from a given transform.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float a()
      Returns the first component of the transform matrix.
      java.awt.geom.AffineTransform awt()
      Returns AWT version of transform for use with Java2D (caching it if needed).
      float b()
      Returns the second component of the transform matrix.
      float c()
      Returns the third component of the transform matrix.
      float d()
      Returns the fourth component of the transform matrix.
      boolean equals​(java.lang.Object anObj)
      Standard equals implementation.
      RMTransform invert()
      Inverts this transform (and returns this for convenience).
      boolean isIdentity()
      Returns whether this transform is identity.
      RMTransform multiply​(float a, float b, float c, float d, float tx, float ty)
      Multiplies this transform by the given transform components (return this for convenience).
      RMTransform multiply​(RMTransform aTransform)
      Multiplies this transform by the given transform.
      RMTransform rotate​(float anAngle)
      Rotates this transform by given angle in degrees (returns this for convenience).
      RMTransform scale​(float sx, float sy)
      Scales this transform by given scale x and scale y (returns this for convenience).
      RMTransform skew​(float aSkewX, float aSkewY)
      Skews this transform by given skew x and skew y angles in degrees (returns this for convenience).
      java.lang.String toString()
      Returns a string representation of the transform.
      RMPoint transform​(RMPoint aPoint)
      Transforms the given point.
      RMRect transform​(RMRect aRect)
      Transforms the given rect.
      RMSize transform​(RMSize aSize)
      Transforms the given size.
      RMSize transformVector​(RMSize aSize)
      Transforms the given size as a vector (preserves negative values).
      RMTransform translate​(float dx, float dy)
      Translates this transform by given x & y (returns this for convenience).
      float tx()
      Returns the x translation component of the transform matrix.
      float ty()
      Returns the y translation component of the transform matrix.
      • Methods inherited from class java.lang.Object

        finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • _a

        public float _a
      • _b

        public float _b
      • _c

        public float _c
      • _d

        public float _d
      • _tx

        public float _tx
      • _ty

        public float _ty
    • Constructor Detail

      • RMTransform

        public RMTransform()
        Creates a new identity transform.
      • RMTransform

        public RMTransform​(RMTransform aTransform)
        Creates a new transform from a given transform.
      • RMTransform

        public RMTransform​(float a,
                           float b,
                           float c,
                           float d,
                           float tx,
                           float ty)
        Creates a transform initialized to given matrix components.
      • RMTransform

        public RMTransform​(float dx,
                           float dy,
                           float angle,
                           float sx,
                           float sy,
                           float skx,
                           float sky)
        Create a transform with translation, rotation, and skew.
      • RMTransform

        public RMTransform​(float dx,
                           float dy,
                           float anAngle,
                           float porx,
                           float pory,
                           float sx,
                           float sy,
                           float skx,
                           float sky)
        Creates a transform with translation and given rotation/skew about a point.
    • Method Detail

      • a

        public float a()
        Returns the first component of the transform matrix.
      • b

        public float b()
        Returns the second component of the transform matrix.
      • c

        public float c()
        Returns the third component of the transform matrix.
      • d

        public float d()
        Returns the fourth component of the transform matrix.
      • tx

        public float tx()
        Returns the x translation component of the transform matrix.
      • ty

        public float ty()
        Returns the y translation component of the transform matrix.
      • isIdentity

        public boolean isIdentity()
        Returns whether this transform is identity.
      • translate

        public RMTransform translate​(float dx,
                                     float dy)
        Translates this transform by given x & y (returns this for convenience).
      • rotate

        public RMTransform rotate​(float anAngle)
        Rotates this transform by given angle in degrees (returns this for convenience).
      • scale

        public RMTransform scale​(float sx,
                                 float sy)
        Scales this transform by given scale x and scale y (returns this for convenience).
      • skew

        public RMTransform skew​(float aSkewX,
                                float aSkewY)
        Skews this transform by given skew x and skew y angles in degrees (returns this for convenience).
      • multiply

        public RMTransform multiply​(RMTransform aTransform)
        Multiplies this transform by the given transform.
      • multiply

        public RMTransform multiply​(float a,
                                    float b,
                                    float c,
                                    float d,
                                    float tx,
                                    float ty)
        Multiplies this transform by the given transform components (return this for convenience).
      • invert

        public RMTransform invert()
        Inverts this transform (and returns this for convenience).
      • transform

        public RMPoint transform​(RMPoint aPoint)
        Transforms the given point.
      • transform

        public RMSize transform​(RMSize aSize)
        Transforms the given size.
      • transform

        public RMRect transform​(RMRect aRect)
        Transforms the given rect.
      • transformVector

        public RMSize transformVector​(RMSize aSize)
        Transforms the given size as a vector (preserves negative values).
      • equals

        public boolean equals​(java.lang.Object anObj)
        Standard equals implementation.
        Overrides:
        equals in class java.lang.Object
      • awt

        public java.awt.geom.AffineTransform awt()
        Returns AWT version of transform for use with Java2D (caching it if needed).
      • toString

        public java.lang.String toString()
        Returns a string representation of the transform.
        Overrides:
        toString in class java.lang.Object