replaced Image with BufferedImage

master
melvin 2011-07-29 10:36:27 +08:00
parent f349e9bea9
commit da11365068
1 changed files with 2 additions and 3 deletions

View File

@ -3,7 +3,6 @@ package magic.ui.viewer;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -37,7 +36,7 @@ public class ImageViewer extends JPanel implements DelayedViewer {
private static final List<Integer> imageIndices;
private final BufferedImage image;
private Image scaledImage=null;
private BufferedImage scaledImage=null;
private boolean showScaled=false;
private boolean scaled=false;
private int imageWidth;
@ -173,7 +172,7 @@ public class ImageViewer extends JPanel implements DelayedViewer {
g.drawImage(image,0,0,VIEWER_WIDTH,viewerHeight,sx1,sy1,sx2,sy2,this);
} else {
if (scaledImage==null) {
scaledImage=image.getScaledInstance(VIEWER_WIDTH,viewerHeight,Image.SCALE_SMOOTH);
scaledImage=magic.GraphicsUtilities.createCompatibleImage(image,VIEWER_WIDTH,viewerHeight);
}
g.drawImage(scaledImage,0,0,this);
}