开发者

Android - Rotate image around center point?

开发者 https://www.devze.com 2023-04-06 01:27 出处:网络
How can I rotate a bitmap (not a view or canvas) around its center point when the user t开发者_开发百科ouches it and drags it?

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(..)

0

精彩评论

暂无评论...
验证码 换一张
取 消