/** * The cm operator. Concatenates the given matrix with the CTM. * * @param matrix the transformation matrix * @throws IOException If there is an error writing to the stream. */ public void transform(Matrix matrix) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: Modifying the current transformation matrix is not allowed within text objects."); } writeAffineTransform(matrix.createAffineTransform()); writeOperator("cm"); }
/** * The Tm operator. Sets the text matrix to the given values. * A current text matrix will be replaced with the new one. * * @param matrix the transformation matrix * @throws IOException If there is an error writing to the stream. * @throws IllegalStateException If the method was not allowed to be called at this time. */ public void setTextMatrix(Matrix matrix) throws IOException { if (!inTextMode) { throw new IllegalStateException("Error: must call beginText() before setTextMatrix"); } writeAffineTransform(matrix.createAffineTransform()); writeOperator("Tm"); }