- Added a preference to support enabling/disabling foil overlay display in GUI.

- Tied the card panel foil display to the user preference setting.
This commit is contained in:
Agetian
2014-02-08 19:35:36 +00:00
parent 58600fbfad
commit 5fe65ad74b
3 changed files with 16 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbSingletons(), FPref.DECKGEN_SINGLETONS));
lstControls.add(Pair.of(view.getCbUploadDraft(), FPref.UI_UPLOAD_DRAFT));
lstControls.add(Pair.of(view.getCbEnableAICheats(), FPref.UI_ENABLE_AI_CHEATS));
lstControls.add(Pair.of(view.getCbDisplayFoil(), FPref.UI_OVERLAY_FOIL_EFFECT));
lstControls.add(Pair.of(view.getCbRandomFoil(), FPref.UI_RANDOM_FOIL));
lstControls.add(Pair.of(view.getCbEnableSounds(), FPref.UI_ENABLE_SOUNDS));
lstControls.add(Pair.of(view.getCbAltSoundSystem(), FPref.UI_ALT_SOUND_SYSTEM));

View File

@@ -76,6 +76,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
private final JCheckBox cbCloneImgSource = new OptionsCheckBox("Clones Use Original Card Art");
private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
private final JCheckBox cbDisplayFoil = new OptionsCheckBox("Display Foil Overlay");
private final JCheckBox cbRandomFoil = new OptionsCheckBox("Random Foil");
private final JCheckBox cbRandomArtInPools = new OptionsCheckBox("Randomize Card Art in Generated Card Pools");
private final JCheckBox cbEnableSounds = new OptionsCheckBox("Enable Sounds");
@@ -185,6 +186,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
// Graphic Options
pnlPrefs.add(new SectionLabel("Graphic Options"), sectionConstraints + ", gaptop 2%");
pnlPrefs.add(cbDisplayFoil, regularConstraints);
pnlPrefs.add(new NoteLabel("Displays foil cards with the visual foil overlay effect."), regularConstraints);
pnlPrefs.add(cbRandomFoil, regularConstraints);
pnlPrefs.add(new NoteLabel("Adds foiled effects to random cards."), regularConstraints);
@@ -421,6 +425,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbEnableAICheats;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbDisplayFoil() {
return cbDisplayFoil;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbRandomFoil() {
return cbRandomFoil;

View File

@@ -22,9 +22,11 @@ import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import forge.ImageCache;
import forge.Singletons;
import forge.card.CardCharacteristicName;
import forge.game.card.Card;
import forge.gui.toolbox.CardFaceSymbols;
import forge.properties.ForgePreferences;
/**
* Common image-related routines specific to Forge images.
@@ -65,6 +67,10 @@ public final class FImageUtil {
* Applies a foil effect to a card image.
*/
private static BufferedImage getImageWithFoilEffect(BufferedImage plainImage, int foilIndex) {
if (!Singletons.getModel().getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_OVERLAY_FOIL_EFFECT)) {
return plainImage;
}
ColorModel cm = plainImage.getColorModel();
BufferedImage foilImage = new BufferedImage(cm, plainImage.copyData(null), cm.isAlphaPremultiplied(), null);
final String fl = String.format("foil%02d", foilIndex);