Hi,
I'll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon.
Searching on Google, I found how to do it by using many AWT libraries.
Is there a way to do it with Swing ? If not, I'm still having troubles with the AWT method :
The ImageIcon I want to mirror is a animated gif (with contain a transparent color) and the AWT method returns a non-transparent (the transparent color is changed to opaque black) and non-animated gif.
Any ideas how to keep the animation and the transparent color?
Here is the AWT code I found (rangerStand being the original ImageIcon) :
Image reversed = rangerStand.getImage();
BufferedImage bufferedImage = new BufferedImage(reversed.getWidth(null), reversed.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics gb = bufferedImage.getGraphics();
gb.drawImage(reversed, 0, 0, null);
gb.dispose();
AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
tx.translate(-reversed.getWidth(null), 0);
AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
bufferedImage = op.filter(bufferedImage, null);
ImageIcon lol = new ImageIcon(bufferedImage);
this.sprite.setIcon(lol);
Thanks for reading.