dharmendra
dharmendra

Reputation: 7881

Rotate image along with touch to fix point in android

I am trying to rotate image in image view coresponding with touch to fix pivote pint of image . i have seen many of example but i dont clear with all of it .somebody have idea ..how can do it this this ?

Upvotes: 5

Views: 1681

Answers (1)

Ron
Ron

Reputation: 24235

Since there is no code or details provided about where the bitmap is drawn i assume its at the center of the screen. You can rotate the canvas on center point like this

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

canvas.rotate(rotationAngleDegrees , centerX, centerY);

Upvotes: 1

Related Questions