java.awt.geometry - Rotating an Image with AffineTransform
Hi,
I'm rotating an image with AffineTransform the code basicly looks like:
Java Code:
Code:
AffineTransform aff = new AffineTransform();
g2d.drawImage(MyImage, aff, this);
// get width and height / 2 to rotate from center of image
aff.rotate(.01, MyImage.getWidth() / 2, MyImage.getHeight() / 2);
MyImage is about 50px, 100px, and their is a point at 25px, 0px, which rotates with the rest of the image. What I'm asking is: is their anyway to keep track of that point while my image is rotating? It's a spaceship image that has a gun on it and I need to know where the gun is so I can make shooting animation.
Let me know if you need more information.
Thank you for reading,
Nathan
Re: java.awt.geometry - Rotating an Image with AffineTransform
AffineTransform has a transform() method that will apply the transform to a given point.
Re: java.awt.geometry - Rotating an Image with AffineTransform