public virtual void setTransformationMatrix(AsMatrix matrix) { mOrientationChanged = false; mTransformationMatrix.copyFrom(matrix); mX = matrix.tx; mY = matrix.ty; float a = matrix.a; float b = matrix.b; float c = matrix.c; float d = matrix.d; mScaleX = AsMath.sqrt(a * a + b * b); if (mScaleX != 0) { mRotation = AsMath.atan2(b, a); } else { mRotation = 0; } float cosTheta = AsMath.cos(mRotation); float sinTheta = AsMath.sin(mRotation); mScaleY = d * cosTheta - c * sinTheta; if (mScaleY != 0) { mSkewX = AsMath.atan2(d * sinTheta + c * cosTheta, mScaleY); } else { mSkewX = 0; } mSkewY = 0; mPivotX = 0; mPivotY = 0; }