Suppose I initialize an AffineTransform as below:
AffineTransform af = new AffineTransform(2, 3, 4, 5, 6, 7);
How would I create an equivalent Matrix using android's sdk?
Suppose I initialize an AffineTransform as below:
AffineTransform af = new AffineTransform(2, 3, 4, 5, 6, 7);
How would I create an equivalent Matrix using android's sdk?
This is a demo Java code:
public static float[] createMatrixValues(AffineTransform Tx) {
double[] at = new double[9];
Tx.getMatrix(at);
float[] f = new float[at.length];
f[0] = (float) at[0];
f[1] = (float) at[2];
f[2] = (float) at[4];
f[3] = (float) at[1];
f[4] = (float) at[3];
f[5] = (float) at[5];
f[6] = 0;
f[7] = 0;
f[8] = 1;
return f;
}
and to create the Matrix object:
public static Matrix createMatrixObj(AffineTransform Tx) {
Matrix m = new Matrix();
m.reset();
m.setValues(createMatrix(Tx));
return m;
}
I hope this helper methods solves your question.