/** Returns this layer's current translation in the x direction. */ public float tx () { return transform.tx(); } /** Returns this layer's current translation in the y direction. */
/** Writes this layer's translation into {@code into}. * @return {@code into} for easy call chaining. */ public Point translation (Point into) { return into.set(transform.tx(), transform.ty()); } /** Writes this layer's translation into {@code into}.
/** Writes this layer's translation into {@code into}. * @return {@code into} for easy call chaining. */ public Vector translation (Vector into) { return into.set(transform.tx(), transform.ty()); }
/** * Returns the layer's current transformation matrix. If any changes have been made to the * layer's scale, rotation or translation, they will be applied to the transform matrix before it * is returned. * * <p><em>Note:</em> any direct modifications to this matrix <em>except</em> modifications to its * translation, will be overwritten if a call is subsequently made to {@link #setScale(float)}, * {@link #setScale(float,float)}, {@link #setScaleX}, {@link #setScaleY} or {@link #setRotation}. * If you intend to manipulate a layer's transform matrix directly, <em>do not</em> call those * other methods. Also do not expect {@link #scaleX}, {@link #scaleY}, or {@link #rotation} to * reflect the direct changes you've made to the transform matrix. They will not. </p> */ public AffineTransform transform() { if (isSet(Flag.XFDIRTY)) { float sina = FloatMath.sin(rotation), cosa = FloatMath.cos(rotation); float m00 = cosa * scaleX, m01 = sina * scaleX; float m10 = -sina * scaleY, m11 = cosa * scaleY; float tx = transform.tx(), ty = transform.ty(); transform.setTransform(m00, m01, m10, m11, tx, ty); setFlag(Flag.XFDIRTY, false); } return transform; }