update CardRenderer.java

This commit is contained in:
Anthony Calosa
2022-02-15 15:52:31 +08:00
parent ea6aaa1efb
commit cb4adbde64

View File

@@ -619,13 +619,12 @@ public class CardRenderer {
croppedArea = 0.975f; croppedArea = 0.975f;
minusxy = 0.135f*radius; minusxy = 0.135f*radius;
} }
float oldAlpha = g.getfloatAlphaComposite();
if (card.isPhasedOut() && !magnify)
g.setAlphaComposite(0.2f);
if (image != null) { if (image != null) {
if (image == ImageCache.defaultImage || Forge.enableUIMask.equals("Art")) { if (image == ImageCache.defaultImage || Forge.enableUIMask.equals("Art")) {
float oldAlpha = g.getfloatAlphaComposite();
if (card.isPhasedOut())
g.setAlphaComposite(0.2f);
CardImageRenderer.drawCardImage(g, card, showAltState, x, y, w, h, pos, true, false, isChoiceList, !showCardIdOverlay(card)); CardImageRenderer.drawCardImage(g, card, showAltState, x, y, w, h, pos, true, false, isChoiceList, !showCardIdOverlay(card));
g.setAlphaComposite(oldAlpha);
} else if (showsleeves) { } else if (showsleeves) {
if (!card.isForeTold()) if (!card.isForeTold())
g.drawCardImage(sleeves, crack_overlay, x, y, w, h, card.wasDestroyed(), magnify ? false : card.getDamage() > 0); g.drawCardImage(sleeves, crack_overlay, x, y, w, h, card.wasDestroyed(), magnify ? false : card.getDamage() > 0);
@@ -667,12 +666,9 @@ public class CardRenderer {
drawFoilEffect(g, card, x, y, w, h, false); drawFoilEffect(g, card, x, y, w, h, false);
} else { } else {
//if card has invalid or no texture due to sudden changes in ImageCache, draw CardImageRenderer instead and wait for it to refresh automatically //if card has invalid or no texture due to sudden changes in ImageCache, draw CardImageRenderer instead and wait for it to refresh automatically
float oldAlpha = g.getfloatAlphaComposite();
if (card.isPhasedOut())
g.setAlphaComposite(0.2f);
CardImageRenderer.drawCardImage(g, card, showAltState, x, y, w, h, pos, Forge.enableUIMask.equals("Art"), false, isChoiceList, !showCardIdOverlay(card)); CardImageRenderer.drawCardImage(g, card, showAltState, x, y, w, h, pos, Forge.enableUIMask.equals("Art"), false, isChoiceList, !showCardIdOverlay(card));
g.setAlphaComposite(oldAlpha);
} }
g.setAlphaComposite(oldAlpha);
} }
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) { public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) {
@@ -1226,6 +1222,7 @@ public class CardRenderer {
int markerCounter = markers.size() - 1; int markerCounter = markers.size() - 1;
for (String marker : markers) { for (String marker : markers) {
if(font != null && !marker.isEmpty()) {
layout.setText(font, marker); layout.setText(font, marker);
final float markerBoxRealWidth = markerBoxBaseWidth + layout.width + 4; final float markerBoxRealWidth = markerBoxBaseWidth + layout.width + 4;
@@ -1238,6 +1235,7 @@ public class CardRenderer {
drawText(g, marker, font, markerColor, x + 2 + additionalXOffset, markerYOffset, markerBoxRealWidth, markerBoxHeight, Align.left); drawText(g, marker, font, markerColor, x + 2 + additionalXOffset, markerYOffset, markerBoxRealWidth, markerBoxHeight, Align.left);
} }
} }
}
private static void drawPtBox(Graphics g, CardView card, CardStateView details, Color color, float x, float y, float w, float h) { private static void drawPtBox(Graphics g, CardView card, CardStateView details, Color color, float x, float y, float w, float h) {
//use array of strings to render separately with a tiny amount of space in between //use array of strings to render separately with a tiny amount of space in between