Hello) I am struggling with the matrices in adroid. I used to work on opengl, everything is normal. What sequence did everything, and it will be ... And then ... some! post pre set ...
I need:
- First move the image to the center.
- Dump it to fit the screen
- Twirl
Code:
m.postTranslate(cxCompass - ((float)compass.getWidth()/2), cyCompass - ((float)compass.getHeight()/2)); if(getMeasuredWidth()<getMeasuredHeight()) m.preScale((float) getMeasuredWidth()/((float)compass.getWidth()),(float) getMeasuredWidth()/((float)compass.getWidth())); else m.preScale((float) getMeasuredHeight()/((float)compass.getHeight()),(float) getMeasuredHeight()/((float)compass.getHeight())); m.preRotate((float) ((-direction)), (float) compass.getWidth() / 2, (float) compass.getHeight() / 2);
If I only do postTranslate
everything is fine, but when I try to somehow scan, for example, what is now in the code. Everything is shifted slightly to the right and down. Why? How to properly and in what sequence to do to get what you want? And explain, please, prefixes to funk. matrices - post set pre
... Thank you!