I'm trying to rotate a given bitmap using android Matrix object.
I want to send it to rotated to my server and I'm using Android API8.
Should i use Matrix.setRotate
or Matrix.postRotate
?
What is the difference between the two?
From the API Reference, setRotate
sets a particular absolute rotation (around either (0,0)
or some other user-supplied point), while postRotate
adds to the rotation of the matrix it is called on.
The question of which one should I use is best answered by trying each and seeing which one gives you the result that you want.
setRotate
will replace the matrix operations already performed with the rotation specified. postRotate
will use the current matrix values and transform them using the rotation specified.
If you want to translate, then rotate you would setTranslate
, then postRotate
. If you simply want to rotate and are starting with a new Matrix
then you technically can setRotate
or postRotate
, since your matrix will initially be the identity.
I've included the API reference to the Matrix object. I didn't consider it a universally accessible explanation though.
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