Android - Rotate image around center point?
How can I rotate a bitmap (not a view or canvas) around its center point when the user t开发者_开发百科ouches it and drags it?
I have tried loads of examples on stack overflow and none appear to work.
So far I have:
double r = Math.atan2(posX - dial.getWidth() / 2, dial.getHeight() / 2 - posY);
rotation = (int) Math.toDegrees(r);
Create Matrix
then set rotate via setRotate(degrees)
. Then use this matrix when creating new Bitmap: Bitmap.createBitmap(..)
精彩评论