I am trying to understand how the 9 values in the android.graphics.Matrix class are used to render something (specifically a Bitmap).
I saw the defines for the 9 indices into the value array, however the naming convention did not seem to make much sense to me.
I have my own orientation system that I am using for all my objects in my engine. For me an orientation consists of a position, a forward vector, and a left vector.
I am trying to figure out how to take these 3 pieces of data (which are already mapped to screen space) and create an android.graphics.Matrix that will render my object's bitmap as I would expect.
Any help would be appreciated.
Thanks
The matrix supports a bunch of different transformations like translate , scale , rotate and skew . If those sound familiar it's because they're (mostly) the same as on a view, an animation or the canvas.
Matrix is the class that be used to process images in android. This article will show you examples of how to use android. graphics. Matrix to rotate, scale, skew and translate bitmap images in android.
I eventually figured out the documentation. For anyone who was confused about the wording like I was, here is another explanation:
[0,0 0,1 0,2]
[1,0 1,1 1,2]
[2,0 2,1 2,2]
=
[MSCALE_X MSKEW_X MTRANS_X]
[MSKEW_Y MSCALE_Y MTRANS_Y]
[MPERSP_0 MPERSP_1 MPERSP_2]
=
[scale.x diagonal.x pos.x]
[diagonal.y scale.y pos.y]
[0.0f 0.0f 1.0f]
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