I am trying to rotate an image in Java, but when I do the transparency in the png goes away. Is there any way i can rotate the image AND keep the transparency?
AffineTransform trans = new AffineTransform(); trans.setTransform(identity); trans.translate(100, 100); trans.rotate( Math.toRadians(45) ); gr.drawImage(image.getImage(), trans, this);
This makes the transparency in the png black, but
gr.drawImage(image.getImage(), 0, 200, null);
Has no problem with the transparency.
Try to set rendering hints on
Graphics2Dobject.Check reference for optimal settings.