com.aspose.font

Interfaces

Classes

Enums

Exceptions

com.aspose.font

Class TransformationMatrix



  • public class TransformationMatrix
    extends Object

    Represents 3x3 matrix | A B 0 | | C D 0 | | TX TY 1 |. Transforms coordinates in the following way: x1 = A*x + C*y + TX y1 = B*x + D*y + TY.

    • Constructor Summary

      Constructors 
      Constructor and Description
      TransformationMatrix()
      Creates standard 1 to 1 matrix: [ A B C D TX TY ] = [ 1, 0, 0, 1, 0, 0]
      TransformationMatrix(double[] matrixArray)
      Accepts a transformation matrix with following array representation: [ A B C D TX TY ]
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double get(int index)
      Provides access to underlying array.
      double getA()
      Gets A transformation matrix value.
      double getB()
      Gets B transformation matrix value.
      double getC()
      Gets C transformation matrix value.
      double getD()
      Gets D transformation matrix value.
      double getTX()
      Gets TX transformation matrix value.
      double getTY()
      Gets TY transformation matrix value.
      TransformationMatrix multiply(TransformationMatrix matrix)
      Multiplies with another transformation matrix.
      void scale(double x, double y, double[] x1, double[] y1)
      Scales x and y with the transformation matrix: x1 = A*x + C*y; y1 = B*x + D*y.
      void setA(double value)
      Sets A transformation matrix value.
      void setB(double value)
      Sets B transformation matrix value.
      void setC(double value)
      Sets C transformation matrix value.
      void setD(double value)
      Sets D transformation matrix value.
      void setTX(double value)
      Sets TX transformation matrix value.
      void setTY(double value)
      Sets TY transformation matrix value.
      double[] toArray()
      Allocates new array, copies the transformation matrix and returns it.
      void transform(double x, double y, double[] x1, double[] y1)
      Transforms x and y with the transformation matrix: x1 = A*x + C*y + TX; y1 = B*x + D*y + TY.
      void unScale(double x1, double y1, double[] x, double[] y)
      Scales back x1 and y1 and returns x and y before the transformation matrix.
      void unTransform(double x1, double y1, double[] x, double[] y)
      Transforms back x1 and y1 and returns x and y before the transformation matrix.
    • Constructor Detail

      • TransformationMatrix

        public TransformationMatrix()

        Creates standard 1 to 1 matrix: [ A B C D TX TY ] = [ 1, 0, 0, 1, 0, 0]

      • TransformationMatrix

        public TransformationMatrix(double[] matrixArray)

        Accepts a transformation matrix with following array representation: [ A B C D TX TY ]

        Parameters:
        matrixArray - Array with transformation matrix values, must have 6 elements.
    • Method Detail

      • getA

        public double getA()

        Gets A transformation matrix value.

        Returns:
        A transformation matrix value.
      • setA

        public void setA(double value)

        Sets A transformation matrix value.

        Parameters:
        value - A transformation matrix value.
      • getB

        public double getB()

        Gets B transformation matrix value.

        Returns:
        B transformation matrix value.
      • setB

        public void setB(double value)

        Sets B transformation matrix value.

        Parameters:
        value - B transformation matrix value.
      • getC

        public double getC()

        Gets C transformation matrix value.

        Returns:
        C transformation matrix value.
      • setC

        public void setC(double value)

        Sets C transformation matrix value.

        Parameters:
        value - C transformation matrix value.
      • getD

        public double getD()

        Gets D transformation matrix value.

        Returns:
        D transformation matrix value.
      • setD

        public void setD(double value)

        Sets D transformation matrix value.

        Parameters:
        value - D transformation matrix value.
      • getTX

        public double getTX()

        Gets TX transformation matrix value.

        Returns:
        TX transformation matrix value.
      • setTX

        public void setTX(double value)

        Sets TX transformation matrix value.

        Parameters:
        value - TX transformation matrix value.
      • getTY

        public double getTY()

        Gets TY transformation matrix value.

        Returns:
        TY transformation matrix value.
      • setTY

        public void setTY(double value)

        Sets TY transformation matrix value.

        Parameters:
        value - TY transformation matrix value.
      • transform

        public void transform(double x,
                              double y,
                              double[] x1,
                              double[] y1)

        Transforms x and y with the transformation matrix: x1 = A*x + C*y + TX; y1 = B*x + D*y + TY.

        Parameters:
        x - Original x coordinate.
        y - Original y coordinate.
        x1 - Transformed x coordinate.
        y1 - Transformed y coordinate.
      • unTransform

        public void unTransform(double x1,
                                double y1,
                                double[] x,
                                double[] y)

        Transforms back x1 and y1 and returns x and y before the transformation matrix.

        Parameters:
        x1 - Coordinate x1.
        y1 - Coordinate y1.
        x - Coordinate x transformed back.
        y - Coordinate y transformed back.
      • unScale

        public void unScale(double x1,
                            double y1,
                            double[] x,
                            double[] y)

        Scales back x1 and y1 and returns x and y before the transformation matrix.

        Parameters:
        x1 - Coordinate x1
        y1 - Coordinate y1
        x - Coordinate x scaled back.
        y - Coordinate y scaled back.
      • scale

        public void scale(double x,
                          double y,
                          double[] x1,
                          double[] y1)

        Scales x and y with the transformation matrix: x1 = A*x + C*y; y1 = B*x + D*y.

        Parameters:
        x - Original x coordinate
        y - Original y coordinate.
        x1 - Coordinate x scaled.
        y1 - Coordinate y scaled.
      • multiply

        public TransformationMatrix multiply(TransformationMatrix matrix)

        Multiplies with another transformation matrix. Doesn't change original transformation matrix, returns a new TransformationMatrix object.

        Parameters:
        matrix - Transformation matrix to multiply with.
        Returns:
        New TransformationMatrix object.
      • toArray

        public double[] toArray()

        Allocates new array, copies the transformation matrix and returns it.

        Returns:
        TransformationMatrix in array form.
      • get

        public double get(int index)

        Provides access to underlying array.

        Parameters:
        index - Index in transformation matrix array.
        Returns:
        The element of underlying array by index.