public PMatrix2D(float m00, float m01, float m02, float m10, float m11, float m12) { set(m00, m01, m02, m10, m11, m12); }
public PMatrix2D(float m00, float m01, float m02, float m10, float m11, float m12) { set(m00, m01, m02, m10, m11, m12); }
public void reset() { set(1, 0, 0, 0, 1, 0); }
public void reset() { set(1, 0, 0, 0, 1, 0); }
public PMatrix2D(PMatrix matrix) { set(matrix); }
public PMatrix2D(PMatrix matrix) { set(matrix); }
public void set(PMatrix matrix) { if (matrix instanceof PMatrix2D) { PMatrix2D src = (PMatrix2D) matrix; set(src.m00, src.m01, src.m02, src.m10, src.m11, src.m12); } else { throw new IllegalArgumentException("PMatrix2D.set() only accepts PMatrix2D objects."); } }
/** * If matrix is a PMatrix2D, sets this matrix to be a copy of it. * @throws IllegalArgumentException If <tt>matrix</tt> is not 2D. */ public void set(PMatrix matrix) { if (matrix instanceof PMatrix2D) { PMatrix2D src = (PMatrix2D) matrix; set(src.m00, src.m01, src.m02, src.m10, src.m11, src.m12); } else { throw new IllegalArgumentException("PMatrix2D.set() only accepts PMatrix2D objects."); } }
/** * Returns a copy of this PMatrix. */ public PMatrix2D get() { PMatrix2D outgoing = new PMatrix2D(); outgoing.set(this); return outgoing; }
/** * Returns a copy of this PMatrix. */ public PMatrix2D get() { PMatrix2D outgoing = new PMatrix2D(); outgoing.set(this); return outgoing; }
@Override public PMatrix2D getMatrix(PMatrix2D target) { if (target == null) { target = new PMatrix2D(); } g2.getTransform().getMatrix(transform); target.set((float) transform[0], (float) transform[2], (float) transform[4], (float) transform[1], (float) transform[3], (float) transform[5]); return target; }
@Override public PMatrix2D getMatrix(PMatrix2D target) { if (target == null) { target = new PMatrix2D(); } // canvas.getTransform().getMatrix(transform); Matrix m = new Matrix(); canvas.getMatrix(m); m.getValues(transform); // target.set((float) transform[0], (float) transform[2], (float) transform[4], // (float) transform[1], (float) transform[3], (float) transform[5]); target.set((float) transform[0], (float) transform[1], (float) transform[2], (float) transform[3], (float) transform[4], (float) transform[5]); return target; }
@Override public PMatrix2D getMatrix(PMatrix2D target) { if (target == null) { target = new PMatrix2D(); } //double[] transform = new double[6]; // TODO This is not tested; apparently Affine is a full 3x4 Affine t = context.getTransform(); //.getMatrix(transform); // target.set((float) transform[0], (float) transform[2], (float) transform[4], // (float) transform[1], (float) transform[3], (float) transform[5]); target.set((float) t.getMxx(), (float) t.getMxy(), (float) t.getTx(), (float) t.getMyx(), (float) t.getMyy(), (float) t.getTy()); return target; }