0

I have been trying to rotate an image on a certain degree, and still remain on the same position. I have tried g.rotate, but it just rotate around a center, and it does not keep the same position as before. Any example to understand how it works would be great!

user3342795
  • 105
  • 3
  • 6
  • Consider providing a [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve), this will involve less guess work and produce better response – MadProgrammer May 24 '14 at 00:53
  • Use [rotate(double theta, double x, double y)](http://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html#rotate-double-double-double-). – user1803551 May 24 '14 at 08:44

1 Answers1

0

When rotation occurs it happens relative to the origin of the screen (x=0, y=0). To make an image rotate relative to its center point you must first translate the image to the origin, perform the rotation, and then translate it back.

jrasm91
  • 394
  • 2
  • 10