Class RMTransform

  • All Implemented Interfaces:
    RMPropertyChanger, java.lang.Cloneable

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

      Fields 
      Modifier and Type Field Description
      double _a  
      double _b  
      double _c  
      double _d  
      double _tx  
      double _ty  
      static RMTransform identity  
    • Constructor Summary

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

      • _a

        public double _a
      • _b

        public double _b
      • _c

        public double _c
      • _d

        public double _d
      • _tx

        public double _tx
      • _ty

        public double _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​(double a,
                           double b,
                           double c,
                           double d,
                           double tx,
                           double ty)
        Creates a transform initialized to given matrix components.
      • RMTransform

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

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

      • a

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

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

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

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

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

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

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

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

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

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

        public RMTransform skew​(double aSkewX,
                                double 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​(double a,
                                    double b,
                                    double c,
                                    double d,
                                    double tx,
                                    double 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 RMObject