-4

How can I rotate a bitmap (not a view or canvas) around its center point when the user touches 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);
JeffLemon
  • 281
  • 3
  • 6
  • 14
  • Link to those answer? Current code you have? You need to give us some kind of starting point. – Austyn Mahoney Sep 20 '11 at 20:52
  • 3
    Your question is not very clear, you don't have useful code samples like how and where your bitmap should be rotated, and you don't have any patience. – nhaarman Sep 20 '11 at 21:25
  • 5
    Stop asking the same question over and over, it will only earn you a ban, not a good answer. See http://stackoverflow.com/faq#bounty. Flagging for moderator attention. – Austyn Mahoney Sep 20 '11 at 21:27

1 Answers1

1

Create Matrix then set rotate via setRotate(degrees). Then use this matrix when creating new Bitmap: Bitmap.createBitmap(..)

Peter Knego
  • 79,991
  • 11
  • 123
  • 154