List of usage examples for java.awt.geom AffineTransform getMatrix
public void getMatrix(double[] flatmatrix)
From source file:de.uniluebeck.itm.spyglass.SpyglassEnvironment.java
/** * Sets the object used for affine operation within the drawing area * //from w w w .ja v a 2s . c om * @param at * the object used for affine operation within the drawing area * @throws IOException * @see DrawingArea */ public static void setAffineTransformation(final AffineTransform at) throws IOException { final double[] flatmatrix = new double[6]; at.getMatrix(flatmatrix); final StringBuffer matrix = new StringBuffer(); for (final double d : flatmatrix) { matrix.append("," + d); } props.setProperty(PROPERTY_CONFIG_AFFINE_TRANSFORM_MATRIX, matrix.substring(1)); storeProps(props); }
From source file:SWTGraphics2D.java
/** * Internal method to convert a AWT transform object into * a SWT transform resource. If a corresponding SWT transform * instance is already in the pool, it will be used * instead of creating a new one. This is used in * {@link #setTransform()} for instance. * * @param awtTransform The AWT transform to convert. * @return A SWT transform instance.//from w ww . j a va 2 s . co m */ private Transform getSwtTransformFromPool(AffineTransform awtTransform) { Transform t = (Transform) this.transformsPool.get(awtTransform); if (t == null) { t = new Transform(this.gc.getDevice()); double[] matrix = new double[6]; awtTransform.getMatrix(matrix); t.setElements((float) matrix[0], (float) matrix[1], (float) matrix[2], (float) matrix[3], (float) matrix[4], (float) matrix[5]); addToResourcePool(t); this.transformsPool.put(awtTransform, t); } return t; }
From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java
private void appendMatrix(AffineTransform transform) throws IOException { double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { appendRawCommands(v);//from w w w. jav a2 s .c om appendRawCommands(SPACE); } }
From source file:DefaultGraphics2D.java
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); }/*from w w w. j av a2 s. c o m*/ }; }
From source file:DefaultGraphics2D.java
/** * Multiplies two 2x3 matrices of double precision values *//* ww w .ja v a 2 s . co m*/ 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; }
From source file:org.apache.fop.render.AbstractRenderer.java
/** * Converts a millipoint-based transformation matrix to points. * @param at a millipoint-based transformation matrix * @return a point-based transformation matrix *//*from ww w . j ava 2 s. c o m*/ protected AffineTransform mptToPt(AffineTransform at) { double[] matrix = new double[6]; at.getMatrix(matrix); //Convert to points matrix[4] = matrix[4] / 1000; matrix[5] = matrix[5] / 1000; return new AffineTransform(matrix); }
From source file:org.apache.fop.render.AbstractRenderer.java
/** * Converts a point-based transformation matrix to millipoints. * @param at a point-based transformation matrix * @return a millipoint-based transformation matrix *//*from ww w .j a va2 s. c om*/ protected AffineTransform ptToMpt(AffineTransform at) { double[] matrix = new double[6]; at.getMatrix(matrix); //Convert to millipoints //Math.round() because things like this can happen: 65.6 * 1000 = 65.599999999999999 //which is bad for testing matrix[4] = Math.round(matrix[4] * 1000); matrix[5] = Math.round(matrix[5] * 1000); return new AffineTransform(matrix); }
From source file:org.apache.fop.render.intermediate.AbstractIFPainter.java
/** * Converts a transformation matrix from millipoints to points. * @param transform the transformation matrix (in millipoints) * @return the converted transformation matrix (in points) *//* ww w . jav a2 s . c o m*/ public static AffineTransform toPoints(AffineTransform transform) { final double[] matrix = new double[6]; transform.getMatrix(matrix); //Convert from millipoints to points matrix[4] /= 1000; matrix[5] /= 1000; return new AffineTransform(matrix); }
From source file:org.apache.pdfbox.pdmodel.edit.PDPageContentStream.java
private void appendMatrix(AffineTransform transform) throws IOException { double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { appendRawCommands(formatDecimal.format(v)); appendRawCommands(SPACE);/* ww w .j a va 2 s . c om*/ } }
From source file:org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject.java
/** * Sets the optional Matrix entry for the form XObject. * @param transform the transformation matrix *///from ww w. j a v a 2 s. co m 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)); } getCOSStream().setItem(COSName.MATRIX, matrix); }