I'm having a problem with the rotation of images
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
AffineTransform at = new AffineTransform();
at.setToIdentity();
at.translate(x, y);
at.rotate(Math.toRadians(angle));
g2.transform(at);
image.paintIcon(c, g2);
I use this code to rotate the picture before painting it (image is a class I created to help me handle loading of picture.
Unfortunately, I'm having a problem with the edges of the image that become really bad (cf Picture)
any ideas how I can improve the quality of the draw ?
jason
What about trying antialiased edges and bilinear transform? You can see an example here. Also check your type of image, the example uses a BufferedImage
.
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);