Class Matrix

java.lang.Object
com.adobe.fontengine.font.Matrix

public final class Matrix extends Object
A 2x3 "Postscript style" coordinate matrix (a 2D transformation and shift).

Synchronization

These objects are immutable.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
     
    final double
     
    final double
     
    final double
     
    static final Matrix
    a constant Matrix representing the identity transformation
    final double
     
    final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Matrix(double[] matrix)
    Creates a matrix from either a 4 or 6 element array representing a matrix.
    Matrix(double a, double b, double c, double d, double tx, double ty)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    computes p * this and returns the result in p
    double
    applyToXYGetX(double x, double y)
    computes [x y] * this and returns the resulting x value
    double
    applyToXYGetY(double x, double y)
    computes [x y] * this and returns the resulting y value
    boolean
    Returns true iff this is very close to representing the identity transformation.
    boolean
    isInverse(Matrix inverse)
    Checks whether 'inverse' is the inverse of this matrix.
    multiply(double multiplier)
    Computes this * multiplier and returns the resulting matrix.
    multiply(Matrix multiplier)
    Computes this * multiplier and returns the resulting matrix.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • IDENTITY_MATRIX

      public static final Matrix IDENTITY_MATRIX
      a constant Matrix representing the identity transformation
    • a

      public final double a
    • b

      public final double b
    • c

      public final double c
    • d

      public final double d
    • tx

      public final double tx
    • ty

      public final double ty
  • Constructor Details

    • Matrix

      public Matrix(double[] matrix)
      Creates a matrix from either a 4 or 6 element array representing a matrix. If there are 4 elements, tx and ty are set to 0.
      Parameters:
      matrix - contains the matrix elements in the following order: a, b, c, d, tx, ty
    • Matrix

      public Matrix(double a, double b, double c, double d, double tx, double ty)
  • Method Details

    • isIdentity

      public boolean isIdentity()
      Returns true iff this is very close to representing the identity transformation.
    • isInverse

      public boolean isInverse(Matrix inverse)
      Checks whether 'inverse' is the inverse of this matrix.
      Parameters:
      inverse - the matrix to be compared
      Returns:
      true iff this * inverse ~= IDENTITY_MATRIX
    • multiply

      public Matrix multiply(Matrix multiplier)
      Computes this * multiplier and returns the resulting matrix.
    • multiply

      public Matrix multiply(double multiplier)
      Computes this * multiplier and returns the resulting matrix.
    • applyToPoint

      public void applyToPoint(Point p)
      computes p * this and returns the result in p
    • applyToXYGetX

      public double applyToXYGetX(double x, double y)
      computes [x y] * this and returns the resulting x value
    • applyToXYGetY

      public double applyToXYGetY(double x, double y)
      computes [x y] * this and returns the resulting y value