变换图像不会影响您定位图像的能力,如图所示:
BufferedImage reversedImage = new BufferedImage(imageFromSprite.getWidth(),
imageFromSprite.getHeight(), imageFromSprite.getType());
AffineTransform transform = new AffineTransform();
transform.scale(-1, 1);
transform.translate(-imageFromSprite.getWidth(), 0);
Graphics2D reversedImageGraphic = reversedImage.createGraphics();
reversedImageGraphic.drawImage(imageFromSprite, transform, null);
// top left is drawn at (0,60)
g.drawImage(imageFromSprite, 0, 60, null);
如果你想做动画 a BufferedImage
,这些链接应该是有趣的:
http://web.mit.edu/1.124/LectureNotes/images.html
http://www.permadi.com/tutorial/javaImgObserverAndAnimGif/