/** Get a {@link org.apache.commons.math3.geometry.partitioning.Transform * Transform} embedding an affine transform. * @param transform affine transform to embed (must be inversible * otherwise the {@link * org.apache.commons.math3.geometry.partitioning.Transform#apply(Hyperplane) * apply(Hyperplane)} method would work only for some lines, and * fail for other ones) * @return a new transform that can be applied to either {@link * Vector2D Vector2D}, {@link Line Line} or {@link * org.apache.commons.math3.geometry.partitioning.SubHyperplane * SubHyperplane} instances * @exception MathIllegalArgumentException if the transform is non invertible * @deprecated as of 3.6, replaced with {@link #getTransform(double, double, double, double, double, double)} */ @Deprecated public static Transform<Euclidean2D, Euclidean1D> getTransform(final AffineTransform transform) throws MathIllegalArgumentException { final double[] m = new double[6]; transform.getMatrix(m); return new LineTransform(m[0], m[1], m[2], m[3], m[4], m[5]); }
/** * Writes an AffineTransform to the content stream as an array. */ private void writeAffineTransform(AffineTransform transform) throws IOException { double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { writeOperand((float) v); } }
private COSStream createOverlayStream(PDPage page, LayoutPage layoutPage, COSName xObjectId) throws IOException { // create a new content stream that executes the XObject content StringBuilder overlayStream = new StringBuilder(); overlayStream.append("q\nq\n"); AffineTransform at = calculateAffineTransform(page, layoutPage.overlayMediaBox); double[] flatmatrix = new double[6]; at.getMatrix(flatmatrix); for (double v : flatmatrix) { overlayStream.append(float2String((float) v)); overlayStream.append(" "); } overlayStream.append(" cm\n/"); overlayStream.append(xObjectId.getName()); overlayStream.append(" Do Q\nQ\n"); return createStream(overlayStream.toString()); }
/** * Sets the optional Matrix entry for the Pattern. * @param transform the transformation matrix */ public void setMatrix(AffineTransform transform) { COSArray matrix = new COSArray(); double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { matrix.add(new COSFloat((float)v)); } getCOSObject().setItem(COSName.MATRIX, matrix); }
/** * Sets the optional Matrix entry for the form XObject. * @param transform the transformation matrix */ public void setMatrix(AffineTransform transform) { COSArray matrix = new COSArray(); double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { matrix.add(new COSFloat((float) v)); } getCOSObject().setItem(COSName.MATRIX, matrix); }
/** * Sets the optional Matrix entry for the function based shading. * * @param transform the transformation matrix */ public void setMatrix(AffineTransform transform) { COSArray matrix = new COSArray(); double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { matrix.add(new COSFloat((float) v)); } getCOSObject().setItem(COSName.MATRIX, matrix); }
public static TransformStackElement createGeneralTransformElement( AffineTransform txf) { double[] matrix = new double[6]; txf.getMatrix(matrix); return new TransformStackElement(TransformType.GENERAL, matrix) { boolean isIdentity(double[] m) { return (m[0] == 1 && m[2] == 0 && m[4] == 0 && m[1] == 0 && m[3] == 1 && m[5] == 0); } }; }
private AffineTransform normalizeTransform(AffineTransform transform) { double[] mx = new double[6]; transform.getMatrix(mx); mx[4] /= _dotsPerPoint; mx[5] /= _dotsPerPoint; return new AffineTransform(mx); }
private AffineTransform normalizeTransform(AffineTransform transform) { double[] mx = new double[6]; transform.getMatrix(mx); mx[4] /= _dotsPerPoint; mx[5] /= _dotsPerPoint; return new AffineTransform(mx); }
protected AffineTransform normalizeMatrix() { double[] mx = new double[6]; AffineTransform result = AffineTransform.getTranslateInstance(0,0); result.getMatrix(mx); mx[3]=-1; mx[5]=height; result = new AffineTransform(mx); result.concatenate(transform); return result; }
/** * Multiplies two 2x3 matrices of double precision values */ private double[] matrixMultiply(double[] matrix1, double[] matrix2) { double[] product = new double[6]; AffineTransform transform1 = new AffineTransform(matrix1); transform1.concatenate(new AffineTransform(matrix2)); transform1.getMatrix(product); return product; }
private AffineTransform normalizeMatrix() { double[] mx = new double[6]; AffineTransform result = AffineTransform.getTranslateInstance(0,0); result.getMatrix(mx); mx[3]=-1; mx[5]=height; result = new AffineTransform(mx); result.concatenate(transform); return result; }
/** * Multiplies two 2x3 matrices of double precision values */ private double[] matrixMultiply(double[] matrix1, double[] matrix2) { double[] product = new double[6]; AffineTransform transform1 = new AffineTransform(matrix1); transform1.concatenate(new AffineTransform(matrix2)); transform1.getMatrix(product); return product; }
/** * Writes an AffineTransform to the content stream as an array. */ private void writeAffineTransform(AffineTransform transform) throws IOException { double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { writeOperand((float) v); } }
@Override public boolean getValue(StyleAttribute attrib, double curTime) throws SVGException { AffineTransform retVal = new AffineTransform(); retVal = getValue(retVal, curTime); // AffineTransform val = getValue(curTime); // if (val == null) return false; double[] mat = new double[6]; retVal.getMatrix(mat); attrib.setStringValue("matrix(" + mat[0] + " " + mat[1] + " " + mat[2] + " " + mat[3] + " " + mat[4] + " " + mat[5] + ")"); return true; }
/** * adds an image with the given matrix. * @param image image to add * @param transform transform to apply to the template prior to adding it. * @since 5.0.1 * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter */ public void addImage(final Image image, final java.awt.geom.AffineTransform transform) throws DocumentException { double matrix[] = new double[6]; transform.getMatrix(matrix); addImage(image, new AffineTransform(matrix)); }
/** Concatenates a transformation to the current transformation * matrix. * @param af the transformation * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter */ public void transform(final java.awt.geom.AffineTransform af) { double matrix[] = new double[6]; af.getMatrix(matrix); transform(new AffineTransform(matrix)); } }
/** * Concatenate a matrix to the current transformation matrix. * @param transform added to the Current Transformation Matrix * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter */ public void concatCTM(final java.awt.geom.AffineTransform transform) { double matrix[] = new double[6]; transform.getMatrix(matrix); concatCTM(new AffineTransform(matrix)); }
private void put(AffineTransform tx) { if (tx == null) { put((byte) 0); } else { double[] m = new double[6]; tx.getMatrix(m); put((byte) 1); put(m); put(tx.getType()); } }
/** Concatenates a transformation to the current transformation * matrix. * @param af the transformation */ public void transform(AffineTransform af) { double arr[] = new double[6]; af.getMatrix(arr); content.append(arr[0]).append(' ').append(arr[1]).append(' ').append(arr[2]).append(' '); content.append(arr[3]).append(' ').append(arr[4]).append(' ').append(arr[5]).append(" cm").append_i(separator); }