public static AffineTransform getRotateInstance(double angle, double x, double y) { AffineTransform t = new AffineTransform(); t.setToRotation(angle, x, y); return t; }
public void rotate(double angle, double px, double py) { concatenate(AffineTransform.getRotateInstance(angle, px, py)); }
public void scale(double scx, double scy) { concatenate(AffineTransform.getScaleInstance(scx, scy)); }
public static AffineTransform getTranslateInstance(double mx, double my) { AffineTransform t = new AffineTransform(); t.setToTranslation(mx, my); return t; }
public static AffineTransform getShearInstance(double shx, double shy) { AffineTransform m = new AffineTransform(); m.setToShear(shx, shy); return m; }
AffineTransform transform = new AffineTransform(a, b, c, d, e, f); Point2D[] src = new Point2D.Float[] {new Point2D.Float(0, 0), new Point2D.Float(1, 0), new Point2D.Float(1, 1), new Point2D.Float(0, 1)}; Point2D[] dst = new Point2D.Float[4]; transform.transform(src, 0, dst, 0, 4); float left = Float.MAX_VALUE; float right = -Float.MAX_VALUE; content.append("q "); if (!transform.isIdentity()) { content.append(a).append(' '); content.append(b).append(' ');
/** * Multiply matrix of two AffineTransform objects * @param t1 - the AffineTransform object is a multiplicand * @param t2 - the AffineTransform object is a multiplier * @return an AffineTransform object that is a result of t1 multiplied by matrix t2. */ AffineTransform multiply(AffineTransform t1, AffineTransform t2) { return new AffineTransform( t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00 t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01 t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10 t1.m01 * t2.m10 + t1.m11 * t2.m11, // m11 t1.m02 * t2.m00 + t1.m12 * t2.m01 + t2.m02, // m02 t1.m02 * t2.m10 + t1.m12 * t2.m11 + t2.m12);// m12 }
/** * Changes the text matrix. * <P> * @param transform overwrite the current text matrix with this one */ public void setTextMatrix(final AffineTransform transform) { double matrix[] = new double[6]; transform.getMatrix(matrix); setTextMatrix((float) matrix[0], (float) matrix[1], (float) matrix[2], (float) matrix[3], (float) matrix[4], (float) matrix[5]); }
public static AffineTransform getScaleInstance(double scx, double scY) { AffineTransform t = new AffineTransform(); t.setToScale(scx, scY); return t; }
public void translate(double mx, double my) { concatenate(AffineTransform.getTranslateInstance(mx, my)); }
public void shear(double shx, double shy) { concatenate(AffineTransform.getShearInstance(shx, shy)); }
/** Concatenates a transformation to the current transformation * matrix. * @param af the transformation */ public void transform(final AffineTransform af) { if (inText && isTagged()) { endText(); } double matrix[] = new double[6]; af.getMatrix(matrix); state.CTM.concatenate(af); content.append(matrix[0]).append(' ').append(matrix[1]).append(' ').append(matrix[2]).append(' '); content.append(matrix[3]).append(' ').append(matrix[4]).append(' ').append(matrix[5]).append(" cm").append_i(separator); }
public AffineTransform createInverse() throws NoninvertibleTransformException { double det = getDeterminant(); if (Math.abs(det) < ZERO) { // awt.204=Determinant is zero throw new NoninvertibleTransformException(Messages.getString("awt.204")); //$NON-NLS-1$ } return new AffineTransform( m11 / det, // m00 -m10 / det, // m10 -m01 / det, // m01 m00 / det, // m11 (m01 * m12 - m11 * m02) / det, // m02 (m10 * m02 - m00 * m12) / det // m12 ); }
endText(); state.CTM.concatenate(new AffineTransform(a, b, c, d, e, f)); content.append(a).append(' ').append(b).append(' ').append(c).append(' '); content.append(d).append(' ').append(e).append(' ').append(f).append(" cm").append_i(separator);
private AffineTransform calculateTemplateTransformationMatrix(AffineTransform currentMatrix, double fieldRotation, Rectangle box) { AffineTransform templateTransform = new AffineTransform(currentMatrix); //Move to new origin double x = box.getLeft(); double y = box.getBottom(); if (fieldRotation % (Math.PI / 2) == 0 && fieldRotation % (3 * Math.PI / 2) != 0 && fieldRotation != 0) { x += box.getWidth(); } if((fieldRotation%(3*Math.PI/2)==0 || fieldRotation%(Math.PI)==0) && fieldRotation != 0){ y+=box.getHeight(); } templateTransform.translate(x,y); //Apply fieldrotation templateTransform.rotate(fieldRotation); return templateTransform; }
public void inverseTransform(float[] src, int srcOff, float[] dst, int dstOff, int length) throws NoninvertibleTransformException { float det = (float)getDeterminant(); if (Math.abs(det) < ZERO) { // awt.204=Determinant is zero throw new NoninvertibleTransformException(Messages.getString("awt.204")); //$NON-NLS-1$ } while (--length >= 0) { float x = src[srcOff++] - (float)m02; float y = src[srcOff++] - (float)m12; dst[dstOff++] = (x * (float)m11 - y * (float)m01) / det; dst[dstOff++] = (y * (float)m00 - x * (float)m10) / det; } }
public boolean isIdentity() { return getType() == TYPE_IDENTITY; }
AffineTransform transform = new AffineTransform(a, b, c, d, e, f); Point2D[] src = new Point2D.Float[] {new Point2D.Float(0, 0), new Point2D.Float(1, 0), new Point2D.Float(1, 1), new Point2D.Float(0, 1)}; Point2D[] dst = new Point2D.Float[4]; transform.transform(src, 0, dst, 0, 4); float left = Float.MAX_VALUE; float right = -Float.MAX_VALUE; content.append("q "); if (!transform.isIdentity()) { content.append(a).append(' '); content.append(b).append(' ');
/** * Multiply matrix of two AffineTransform objects * @param t1 - the AffineTransform object is a multiplicand * @param t2 - the AffineTransform object is a multiplier * @return an AffineTransform object that is a result of t1 multiplied by matrix t2. */ AffineTransform multiply(AffineTransform t1, AffineTransform t2) { return new AffineTransform( t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00 t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01 t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10 t1.m01 * t2.m10 + t1.m11 * t2.m11, // m11 t1.m02 * t2.m00 + t1.m12 * t2.m01 + t2.m02, // m02 t1.m02 * t2.m10 + t1.m12 * t2.m11 + t2.m12);// m12 }
public static AffineTransform getTranslateInstance(double mx, double my) { AffineTransform t = new AffineTransform(); t.setToTranslation(mx, my); return t; }