should be more smooth now.

This commit is contained in:
magenoxx 2010-11-06 22:42:44 +00:00
parent c9296c49a5
commit beb37db93a
3 changed files with 25 additions and 22 deletions

View file

@ -131,6 +131,7 @@ public class MageFrame extends javax.swing.JFrame {
disableButtons();
//TODO:
if (Plugins.getInstance().isCardPluginLoaded()) {
Separator separator = new javax.swing.JToolBar.Separator();
mageToolbar.add(separator);
@ -146,6 +147,7 @@ public class MageFrame extends javax.swing.JFrame {
});
mageToolbar.add(btnDownload);
}
}
private void btnImagesActionPerformed(java.awt.event.ActionEvent evt) {
Set<Card> allCards = new LinkedHashSet<Card>();

View file

@ -11,7 +11,6 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -111,7 +110,7 @@ public class CardPanel extends MagePermanent {
overlayPanel.setScalingMultiPassType(MultipassType.none);
//TODO: Image sickness = ImageManager.getSicknessImage();
Image sickness = null;
BufferedImage sickness = null;
overlayPanel.setImage(sickness, sickness);
imagePanel = new ScaledImagePanel();
@ -129,6 +128,7 @@ public class CardPanel extends MagePermanent {
try {
tappedAngle = gameCard.isTapped() ? CardPanel.TAPPED_ANGLE : 0;
BufferedImage srcImage = ImageCache.getImageOriginal(gameCard);
srcImage = ImageCache.getNormalSizeImage(srcImage);
if (srcImage != null) {
hasImage = true;
setText(gameCard);
@ -510,7 +510,7 @@ public class CardPanel extends MagePermanent {
@Override
public Image getImage() {
return this.imagePanel.getSrcImage();
return ImageCache.getImageOriginal(gameCard);
}
}

View file

@ -12,6 +12,7 @@ import javax.imageio.ImageIO;
import mage.view.CardView;
import org.apache.log4j.Logger;
import org.mage.plugins.card.constants.Constants;
import org.mage.plugins.card.utils.CardImageUtils;
import com.google.common.base.Function;
@ -142,12 +143,12 @@ public class ImageCache {
/**
* Returns an image scaled to the size given
*/
/*private static BufferedImage getNormalSizeImage(BufferedImage original) {
public static BufferedImage getNormalSizeImage(BufferedImage original) {
int srcWidth = original.getWidth();
int srcHeight = original.getHeight();
int tgtWidth = SettingsManager.getManager().getCardSize().width;
int tgtHeight = SettingsManager.getManager().getCardSize().height;
int tgtWidth = Constants.CARD_SIZE_FULL.width;
int tgtHeight = Constants.CARD_SIZE_FULL.height;
if (srcWidth == tgtWidth && srcHeight == tgtHeight)
return original;
@ -155,7 +156,7 @@ public class ImageCache {
ResampleOp resampleOp = new ResampleOp(tgtWidth, tgtHeight);
BufferedImage image = resampleOp.filter(original, null);
return image;
}*/
}
/**
* Returns an image scaled to the size appropriate for the card picture
@ -173,7 +174,7 @@ public class ImageCache {
* Returns an image scaled to the size appropriate for the card picture
* panel
*/
private static BufferedImage getResizedImage(BufferedImage original, Rectangle sizeNeed) {
public static BufferedImage getResizedImage(BufferedImage original, Rectangle sizeNeed) {
ResampleOp resampleOp = new ResampleOp(sizeNeed.width, sizeNeed.height);
BufferedImage image = resampleOp.filter(original, null);
return image;