## Class ASMatrix

• ```public class ASMatrix
extends ASObject```
ASMatrix encapsulates an immutable PDF coordinate transfomation matrix, or CTM.
• ### Constructor Summary

Constructors
Constructor Description
`ASMatrix​(double[] array)`
Constructs a new matrix of 2 columns, 3 rows from an array of doubles with the ordering ( a, b, c, d, x, y ) where x gives in x and y gives translation in y.
```ASMatrix​(double a, double b, double c, double d, double x, double y)```
Constructs a new matrix of 2 columns, 3 rows (a, b, c, d, x, y).
`ASMatrix​(ASMatrix B)`
Constructs a new matrix from another matrix (like clone)
• ### Method Summary

All Methods
Modifier and Type Method Description
`ASMatrix` `concat​(ASMatrix A)`
(left) multiply new transform with this (computes X * A, where X is the current transform)
`static ASMatrix` `createIdentityMatrix()`
Returns an identity matrix.
`boolean` `equals​(ASMatrix t)`
Test for equality
`double` `geta()`
`double` `getb()`
`double` `getc()`
`double` `getd()`
`ASMatrix` `getInverse()`
Find the matrix, B, that has the property: B * X = identity.
`ASMatrix` `getUnitRotationMatrix()`
`double[]` `getValues()`
`double` `getx()`
`double` `gety()`
`boolean` `isIdentity()`
Test for Identity of the 4x4 matrix Exclusive of translation
`boolean` `isIdentity6x6()`
Test for Identity of the 6x6 matrix Inclusive of translation
`boolean` `isInvertable()`
Test for invertability
`void` ```mult​(double px, double py, double[] output)```
Multiply a vector by our matrix.
`double` ```multGetX​(double px, double py)```
`double` ```multGetY​(double px, double py)```
`ASMatrix` ```preMultiply​(double h, double v)```
Premultiply the current transform with a translation
`ASMatrix` `preScale​(double x)`
`ASMatrix` ```preScale​(double sx, double sy)```
Premultiply the current transform with a scale
`ASMatrix` `rotate​(double angle)`
Concatentate the current transform with a rotate
`ASMatrix` `scale​(double x)`
`ASMatrix` ```scale​(double sx, double sy)```
Concatentate the current transform with a scale
`ASMatrix` `setItalicDegrees​(double angle)`
Set an italic angle
`ASMatrix` ```setTranslate​(double h, double v)```
Set an absolute translation
`java.lang.String` `toString()`
Converts this object to a String representation.
`ASMatrix` ```translate​(double h, double v)```
Concatenate the current transform with a translate
`void` `write​(OutputByteStream outputByteStream)`
Writes the ASHexString in to the given OutputStream in the format expected by the PDF Spec.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### ASMatrix

```public ASMatrix​(double a,
double b,
double c,
double d,
double x,
double y)```
Constructs a new matrix of 2 columns, 3 rows (a, b, c, d, x, y).
Parameters:
`x` - Translation in x
`y` - Translation in y
• #### ASMatrix

`public ASMatrix​(double[] array)`
Constructs a new matrix of 2 columns, 3 rows from an array of doubles with the ordering ( a, b, c, d, x, y ) where x gives in x and y gives translation in y.
• #### ASMatrix

`public ASMatrix​(ASMatrix B)`
Constructs a new matrix from another matrix (like clone)
Parameters:
`B` - PDFAffineTransform
• ### Method Detail

• #### createIdentityMatrix

`public static ASMatrix createIdentityMatrix()`
Returns an identity matrix.
• #### geta

`public double geta()`
• #### getb

`public double getb()`
• #### getc

`public double getc()`
• #### getd

`public double getd()`
• #### getx

`public double getx()`
• #### gety

`public double gety()`
• #### getValues

`public double[] getValues()`
• #### equals

`public boolean equals​(ASMatrix t)`
Test for equality
• #### isIdentity

`public boolean isIdentity()`
Test for Identity of the 4x4 matrix Exclusive of translation
• #### isIdentity6x6

`public boolean isIdentity6x6()`
Test for Identity of the 6x6 matrix Inclusive of translation
• #### isInvertable

`public boolean isInvertable()`
Test for invertability
• #### rotate

`public ASMatrix rotate​(double angle)`
Concatentate the current transform with a rotate
Parameters:
`angle` - Amount of rotation in radians.
• #### scale

```public ASMatrix scale​(double sx,
double sy)```
Concatentate the current transform with a scale
• #### scale

`public ASMatrix scale​(double x)`
• #### preScale

```public ASMatrix preScale​(double sx,
double sy)```
Premultiply the current transform with a scale
• #### preScale

`public ASMatrix preScale​(double x)`
• #### translate

```public ASMatrix translate​(double h,
double v)```
Concatenate the current transform with a translate
• #### preMultiply

```public ASMatrix preMultiply​(double h,
double v)```
Premultiply the current transform with a translation
• #### setTranslate

```public ASMatrix setTranslate​(double h,
double v)```
Set an absolute translation
• #### setItalicDegrees

`public ASMatrix setItalicDegrees​(double angle)`
Set an italic angle
• #### mult

```public void mult​(double px,
double py,
double[] output)```
Multiply a vector by our matrix.
Parameters:
`px` - Along with py: input vector
`py` - Along with px: input vector
`output` - output vector -- must be at least size 2 (x is index 0, y is index 1)
• #### multGetX

```public double multGetX​(double px,
double py)```
• #### multGetY

```public double multGetY​(double px,
double py)```
• #### concat

`public ASMatrix concat​(ASMatrix A)`
(left) multiply new transform with this (computes X * A, where X is the current transform)
Parameters:
`A` - new transform.
• #### getInverse

```public ASMatrix getInverse()
throws PDFInvalidParameterException```
Find the matrix, B, that has the property: B * X = identity.
Throws:
`PDFInvalidParameterException` - If the matrix does not have an inverse.
• #### toString

`public java.lang.String toString()`
Converts this object to a String representation.
Overrides:
`toString` in class `java.lang.Object`
• #### write

```public void write​(OutputByteStream outputByteStream)
throws PDFIOException```
Writes the ASHexString in to the given OutputStream in the format expected by the PDF Spec.
Specified by:
`write` in class `ASObject`
Parameters:
`outputByteStream` - OutputStream to write to.
Throws:
`PDFIOException`
`ASString`
`public ASMatrix getUnitRotationMatrix()`