Rotate the image with a touch to fix the point in android

I am trying to rotate the image as an image corresponding to the touch in order to fix the beery pint of the image. I have seen many examples, but I do not understand with all this. Someone has an idea .. can this do it?

+5
source share
1 answer

Since there is no code or details provided about where the bitmap is drawn, I assume it is in the center of the screen. You can rotate the canvas at a central point, like this

double rotationAngleRadians = Math.atan2(currentX - centerX, centerY - currentY);
rotationAngleDegrees = (int) Math.toDegrees(rotationAngleRadians );

canvas.rotate(rotationAngleDegrees , centerX, centerY);
+1
source

All Articles