diff --git a/forge-core/src/main/java/forge/card/CardEdition.java b/forge-core/src/main/java/forge/card/CardEdition.java index 66cb689feed..ce6289bb5f5 100644 --- a/forge-core/src/main/java/forge/card/CardEdition.java +++ b/forge-core/src/main/java/forge/card/CardEdition.java @@ -192,6 +192,7 @@ public final class CardEdition implements Comparable { // immutable public boolean getSmallSetOverride() { return smallSetOverride; } public String getBoosterMustContain() { return boosterMustContain; } public CardInSet[] getCards() { return cards; } + public boolean isModern() { return getDate().after(parseDate("2003-07-27")); } //8ED and above are modern except some promo cards and others public Map getTokens() { return tokenNormalized; } diff --git a/forge-gui-mobile/src/forge/card/CardImageRenderer.java b/forge-gui-mobile/src/forge/card/CardImageRenderer.java index b2094fbaa15..8bedd01ae42 100644 --- a/forge-gui-mobile/src/forge/card/CardImageRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardImageRenderer.java @@ -35,6 +35,9 @@ import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; +import static forge.card.CardRenderer.CROP_MULTIPLIER; +import static forge.card.CardRenderer.isModernFrame; + public class CardImageRenderer { private static final float BASE_IMAGE_WIDTH = 360; private static final float BASE_IMAGE_HEIGHT = 504; @@ -357,13 +360,19 @@ public class CardImageRenderer { float new_yRotate = (dispH - new_w) /2; boolean rotateSplit = FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_SPLIT_CARDS); boolean rotatePlane = FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_PLANE_OR_PHENOMENON); + float croppedArea = isModernFrame(card) ? CROP_MULTIPLIER : 0.97f; + float minusxy = isModernFrame(card) ? 0.0f : 0.13f*radius; + if (card.getCurrentState().getSetCode().equals("LEA")||card.getCurrentState().getSetCode().equals("LEB")) { + croppedArea = 0.975f; + minusxy = 0.135f*radius; + } if (rotatePlane && (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane())) { if (Forge.enableUIMask){ if (ImageCache.isExtendedArt(card)) g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90); else { g.drawRotatedImage(FSkin.getBorders().get(0), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90); - g.drawRotatedImage(ImageCache.croppedBorderImage(image, fullborder), new_x+radius/2, new_y+radius/2, new_w*0.96f, new_h*0.96f, (new_x+radius/2) + (new_w*0.96f) / 2, (new_y+radius/2) + (new_h*0.96f) / 2, -90); + g.drawRotatedImage(ImageCache.croppedBorderImage(image, fullborder), new_x+radius/2-minusxy, new_y+radius/2-minusxy, new_w*croppedArea, new_h*croppedArea, (new_x+radius/2-minusxy) + (new_w*croppedArea) / 2, (new_y+radius/2-minusxy) + (new_h*croppedArea) / 2, -90); } } else g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90); @@ -374,7 +383,7 @@ public class CardImageRenderer { g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90); else { g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90); - g.drawRotatedImage(ImageCache.croppedBorderImage(image, fullborder), new_x + radius / 2, new_y + radius / 2, new_w * 0.96f, new_h * 0.96f, (new_x + radius / 2) + (new_w * 0.96f) / 2, (new_y + radius / 2) + (new_h * 0.96f) / 2, isAftermath ? 90 : -90); + g.drawRotatedImage(ImageCache.croppedBorderImage(image, fullborder), new_x + radius / 2-minusxy, new_y + radius / 2-minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2-minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2-minusxy) + (new_h * croppedArea) / 2, isAftermath ? 90 : -90); } } else g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90); @@ -384,7 +393,7 @@ public class CardImageRenderer { g.drawImage(image, x, y, w, h); else { g.drawImage(ImageCache.getBorderImage(card, canshow), x, y, w, h); - g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f, y + radius / 2, w * 0.96f, h * 0.96f); + g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea); } } else { if (canshow && !ImageKeys.getTokenKey(ImageKeys.MORPH_IMAGE).equals(card.getState(altState).getImageKey())) diff --git a/forge-gui-mobile/src/forge/card/CardRenderer.java b/forge-gui-mobile/src/forge/card/CardRenderer.java index 6dee11cb8cc..6dcc0c48681 100644 --- a/forge-gui-mobile/src/forge/card/CardRenderer.java +++ b/forge-gui-mobile/src/forge/card/CardRenderer.java @@ -105,6 +105,7 @@ public class CardRenderer { private static final float NAME_COST_THRESHOLD = Utils.scale(200); private static final float BORDER_THICKNESS = Utils.scale(1); public static final float PADDING_MULTIPLIER = 0.021f; + public static final float CROP_MULTIPLIER = 0.96f; private static Map counterFonts = new HashMap<>(); private static final Color counterBackgroundColor = new Color(0f, 0f, 0f, 0.9f); @@ -142,6 +143,49 @@ public class CardRenderer { } } + public static boolean isModernFrame(IPaperCard c) { + if (c == null) + return false; + + CardEdition ed = FModel.getMagicDb().getEditions().get(c.getEdition()); + if (ed != null) { + switch (ed.getCode()) { + case "MED": + case "ME2": + case "ME3": + case "ME4": + case "TSB": + return false; + default: + return ed.isModern(); + } + } + + return false; + } + + public static boolean isModernFrame(CardView c) { + if (c == null) + return false; + + CardView.CardStateView state = c.getCurrentState(); + CardEdition ed = FModel.getMagicDb().getEditions().get(state.getSetCode()); + if (ed != null) { + switch (ed.getCode()) { + case "MED": + case "ME2": + case "ME3": + case "ME4": + case "TSB": + return false; + default: + return ed.isModern(); + } + } + + return false; + } + public static float getCardListItemHeight(boolean compactMode) { if (compactMode) { return MANA_SYMBOL_SIZE + 2 * FList.PADDING; @@ -402,7 +446,12 @@ public class CardRenderer { public static void drawCard(Graphics g, IPaperCard pc, float x, float y, float w, float h, CardStackPosition pos) { Texture image = new RendererCachedCardImage(pc, false).getImage(); float radius = (h - w)/8; - + float croppedArea = isModernFrame(pc) ? CROP_MULTIPLIER : 0.97f; + float minusxy = isModernFrame(pc) ? 0.0f : 0.13f*radius; + if (pc.getEdition().equals("LEA")||pc.getEdition().equals("LEB")) { + croppedArea = 0.975f; + minusxy = 0.135f*radius; + } if (image != null) { if (image == ImageCache.defaultImage) { CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos); @@ -413,7 +462,7 @@ public class CardRenderer { g.drawImage(image, x, y, w, h); else { g.drawImage(ImageCache.getBorderImage(pc), x, y, w, h); - g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f, y + radius / 2, w * 0.96f, h * 0.96f); + g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea); } } else g.drawImage(image, x, y, w, h); @@ -437,7 +486,12 @@ public class CardRenderer { Texture image = new RendererCachedCardImage(card, false).getImage(); FImage sleeves = MatchController.getPlayerSleeve(card.getOwner()); float radius = (h - w)/8; - + float croppedArea = isModernFrame(card) ? CROP_MULTIPLIER : 0.97f; + float minusxy = isModernFrame(card) ? 0.0f : 0.13f*radius; + if (card.getCurrentState().getSetCode().equals("LEA")||card.getCurrentState().getSetCode().equals("LEB")) { + croppedArea = 0.975f; + minusxy = 0.135f*radius; + } if (image != null) { if (image == ImageCache.defaultImage) { CardImageRenderer.drawCardImage(g, card, false, x, y, w, h, pos); @@ -450,7 +504,7 @@ public class CardRenderer { g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90); else { g.drawRotatedImage(FSkin.getBorders().get(0), x, y, w, h, x + w / 2, y + h / 2, -90); - g.drawRotatedImage(ImageCache.croppedBorderImage(image, fullborder), x+radius/2.3f, y+radius/2, w*0.96f, h*0.96f, (x+radius/2.3f) + (w*0.96f) / 2, (y+radius/2) + (h*0.96f) / 2, -90); + g.drawRotatedImage(ImageCache.croppedBorderImage(image, fullborder), x+radius/2.3f-minusxy, y+radius/2-minusxy, w*croppedArea, h*croppedArea, (x+radius/2.3f-minusxy) + (w*croppedArea) / 2, (y+radius/2-minusxy) + (h*croppedArea) / 2, -90); } } else g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90); @@ -461,7 +515,7 @@ public class CardRenderer { else { boolean t = (card.getCurrentState().getOriginalColors() != card.getCurrentState().getColors()) || card.getCurrentState().hasChangeColors(); g.drawBorderImage(ImageCache.getBorderImage(card, canshow), ImageCache.getTint(card), x, y, w, h, t); //tint check for changed colors - g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f, y + radius / 2, w * 0.96f, h * 0.96f); + g.drawImage(ImageCache.croppedBorderImage(image, fullborder), x + radius / 2.4f-minusxy, y + radius / 2-minusxy, w * croppedArea, h * croppedArea); } } else { if (canshow) @@ -1119,8 +1173,14 @@ public class CardRenderer { public static void drawFoilEffect(Graphics g, CardView card, float x, float y, float w, float h, boolean inZoomer) { float new_x = x; float new_y = y; float new_w = w; float new_h = h; float radius = (h - w)/8; + float croppedArea = isModernFrame(card) ? CROP_MULTIPLIER : 0.97f; + float minusxy = isModernFrame(card) ? 0.0f : 0.13f*radius; + if (card.getCurrentState().getSetCode().equals("LEA")||card.getCurrentState().getSetCode().equals("LEB")) { + croppedArea = 0.975f; + minusxy = 0.135f*radius; + } if (Forge.enableUIMask) { - new_x += radius/2.4f; new_y += radius/2; new_w = w * 0.96f; new_h = h * 0.96f; + new_x += radius/2.4f-minusxy; new_y += radius/2-minusxy; new_w = w * croppedArea; new_h = h * croppedArea; } if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT) && MatchController.instance.mayView(card)) { boolean rotateSplit = isPreferenceEnabled(FPref.UI_ROTATE_SPLIT_CARDS) && card.isSplitCard() && inZoomer; diff --git a/forge-gui-mobile/src/forge/card/CardZoom.java b/forge-gui-mobile/src/forge/card/CardZoom.java index 8608cbbc82f..72d7d7c978f 100644 --- a/forge-gui-mobile/src/forge/card/CardZoom.java +++ b/forge-gui-mobile/src/forge/card/CardZoom.java @@ -219,7 +219,22 @@ public class CardZoom extends FOverlay { float w = getWidth(); float h = getHeight(); float messageHeight = FDialog.MSG_HEIGHT; - float maxCardHeight = h - 2 * messageHeight; + float AspectRatioMultiplier = 2; + switch (Forge.extrawide) { + case "default": + AspectRatioMultiplier = 3; //good for tablets with 16:10 or similar + break; + case "wide": + AspectRatioMultiplier = 2.5f; + break; + case "extrawide": + AspectRatioMultiplier = 2; //good for tall phones with 21:9 or similar + break; + default: + AspectRatioMultiplier = 3; + break; + } + float maxCardHeight = h - AspectRatioMultiplier * messageHeight; //maxheight of currently zoomed card float cardWidth, cardHeight, y;