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?
From AffineTransform's javadoc:
[ x'] [ m00 m01 m02 ] [ x ] [ m00x + m01y + m02 ]
[ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
[ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
Not sure, but perhaps
Matrix m = new Matrix();
m.setValues(new float[]{2,3,4,5,6,7,0,0,1});
EDIT: Commenter points out that the order should be
m.setValues(new float[]{2,4,6,3,5,7,0,0,1});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With