My paint procedure is fairly simple (below). With smaller loaded images there appears to be no such degradation. All loaded files are PNG loaded into a BufferedImage.
Has anyone see this sort of effect before? Does anyone have any ideas on what I may try or investigate to get to the bottom of this?
Cheers, Eric
public void paint(Graphics _g) {
Graphics2D g = (Graphics2D)_g;
// First check width and height changes to avoid recomputing
// the scale, and repacking the frame. Waste not, want not.
int gWidth = getWidth();
int gHeight = getHeight();
boolean repack = false;
if (width != gWidth || height != gHeight) {
scale = scale(image, getWidth(), getHeight());
if (scale > 1.0)
scale = 1.0;
width = (int)(image.getWidth() * scale);
height = (int)(image.getHeight() * scale);
size = new Dimension(width, height);
setPreferredSize(size);
transform = new AffineTransform();
transform.scale(scale, scale);
repack = true;
}
g.drawImage(image, transform, null);
if (repack && jFrame != null)
jFrame.actionPerformed(actionEvent);
}