- Added a way to zoom to a XLHQ card picture if available (optional), documented it in CHANGES.txt.

- Fixed the planes and phenomena not being rotated 90 degrees when zooming in on them.
This commit is contained in:
Agetian
2015-01-13 16:54:12 +00:00
parent 3a45df9217
commit 027f0038e7
2 changed files with 48 additions and 3 deletions

View File

@@ -18,6 +18,7 @@
package forge.toolbox.special;
import forge.ImageKeys;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@@ -42,6 +43,12 @@ import forge.toolbox.FSkin.SkinnedLabel;
import forge.toolbox.imaging.FImagePanel;
import forge.toolbox.imaging.FImagePanel.AutoSizeImageMode;
import forge.toolbox.imaging.FImageUtil;
import forge.util.ImageUtil;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import javax.imageio.ImageIO;
/**
* Displays card image at its original size and correct orientation.
@@ -212,15 +219,51 @@ public enum CardZoomer {
*/
private void setImage() {
imagePanel = new FImagePanel();
imagePanel.setImage(FImageUtil.getImage(getState()), getInitialRotation(), AutoSizeImageMode.SOURCE);
BufferedImage xlhqImage = getImageXlhq();
imagePanel.setImage(xlhqImage == null ? FImageUtil.getImage(getState()) : xlhqImage, getInitialRotation(), AutoSizeImageMode.SOURCE);
pnlMain.removeAll();
pnlMain.add(imagePanel, "w 80%!, h 80%!");
pnlMain.validate();
setFlipIndicator();
}
private BufferedImage getImageXlhq() {
String key = MatchUtil.getCardImageKey(getState());
if (key.indexOf(ImageKeys.CARD_PREFIX) != 0) {
return null;
}
boolean altState = key.endsWith(ImageKeys.BACKFACE_POSTFIX);
String imageKey = ImageUtil.getImageKey(ImageUtil.getPaperCardFromImageKey(key.substring(2)), altState, true);
if(altState) {
imageKey = imageKey.substring(0, imageKey.length() - ImageKeys.BACKFACE_POSTFIX.length());
imageKey += "full.jpg";
}
File file = ImageKeys.getImageFile(imageKey);
if (file != null) {
Path path = file.toPath();
String modPath = path.getRoot().toString() + path.subpath(0, path.getNameCount()-2).toString() + File.separator + "XLHQ" + File.separator + path.subpath(path.getNameCount()-2, path.getNameCount());
File xlhqFile = new File(modPath.replace(".full.jpg", ".xlhq.jpg"));
if (xlhqFile != null && xlhqFile.exists()) {
try {
return ImageIO.read(xlhqFile);
} catch (IOException ex) {
System.err.println("IO exception caught when trying to open a XLHQ image: " + xlhqFile.getName());
}
}
}
return null;
}
private int getInitialRotation() {
return (thisCard.isSplitCard() ? 90 : 0);
return (thisCard.isSplitCard() || thisCard.getCurrentState().getType().isPlane() || thisCard.getCurrentState().getType().isPhenomenon() ? 90 : 0);
}
private void setLayout() {

View File

@@ -8,6 +8,9 @@ Forge Beta: 1-#-2015 ver 1.5.33
Release Notes
-------------
- Zoom to a XLHQ card picture -
Forge now supports showing XLHQ (extra large high quality) card pictures when zooming in on a card if these pictures are available. Forge will look for XLHQ card art in the "XLHQ" subfolder of the "pics/cards" folder in Forge cache. XLHQ pictures should have the ".xlhq.jpg" extension instead of the ".full.jpg" one (CCGHQ XLHQ releases comply with this naming scheme). For example, while the regular 10th edition Blaze will be looked up as "cards/pics/10E/Blaze.full.jpg", the XLHQ version will be looked up as "cards/pics/XLHQ/10E/Blaze.xlhq.jpg". If the XLHQ picture is not available Forge will show you the regular card picture in the zoomed view, as usual. Please note that XLHQ versions of cards are *only* showed in the zoom view, regular card pictures are still used (LQ/HQ, depending on what you're using) on the battlefield and elsewhere in the game because XLHQ art is significantly more taxing in memory consumption even when compared to standard high quality (HQ) releases (and in addition to that, XLHQ card borders are not cropped the way Forge expects them in order to show them properly on the battlefield anyway). Note: as of right now, only XLHQ versions of ordinary cards are supported (for instance, tokens are not supported yet).
- New Fate Reforged cards -
We have added a branch to our SVN for the new cards that are currently being scripted. These cards are not yet available in this build of forge. Please be patient and they will soon become available.
@@ -29,7 +32,6 @@ Daghatar the Adamant
Dragonscale General
Dromoka, the Eternal
Goblin Heelcutter
Goblin Heelcutter
Gurmag Angler
Honor's Reward
Jeskai Infiltrator