Merge pull request #4562 from spjspj/master

Fix zendikar full art land drawings.  (Travis build failed but didn't seem to be related to Mage.Client)
This commit is contained in:
spjspj 2018-03-02 17:33:11 +10:00 committed by GitHub
commit 550b98509c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ package org.mage.card.arcane;
import java.awt.*; import java.awt.*;
import java.awt.font.*; import java.awt.font.*;
import java.awt.geom.Arc2D;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -541,15 +542,10 @@ public class ModernCardRenderer extends CardRenderer {
if (cardView.getFrameStyle() == FrameStyle.ZEN_FULL_ART_BASIC) { if (cardView.getFrameStyle() == FrameStyle.ZEN_FULL_ART_BASIC) {
// Draw curved lines (old Zendikar land style) - bigger (around 6%) inset on curve on bottom than inset (around 4.5%) on top... // Draw curved lines (old Zendikar land style) - bigger (around 6%) inset on curve on bottom than inset (around 4.5%) on top...
int x2 = x; int x2 = x + contentWidth;
int y2 = y; int y2 = y;
int topxdelta = 45 * contentWidth / 1000; int thisy = totalContentInset + boxHeight;
int botxdelta = 58 * contentWidth / 1000; drawZendikarCurvedFace(g, image, x, thisy, x2, y2,
int ctrlx = 0;
int ctrly = (totalContentInset + y2) / 2;
drawZendikarCurvedFace(g, image, x + topxdelta, totalContentInset + boxHeight, ctrlx, ctrly, x2 + botxdelta, y2,
x + contentWidth - topxdelta, totalContentInset + boxHeight, cardWidth, ctrly, x2 + contentWidth - botxdelta, y2,
boxColor, borderPaint); boxColor, borderPaint);
} else if (cardView.getFrameStyle() == FrameStyle.BFZ_FULL_ART_BASIC) { } else if (cardView.getFrameStyle() == FrameStyle.BFZ_FULL_ART_BASIC) {
// Draw curved lines (BFZ land style) // Draw curved lines (BFZ land style)
@ -574,8 +570,7 @@ public class ModernCardRenderer extends CardRenderer {
drawBottomRight(g, borderPaint, boxColor); drawBottomRight(g, borderPaint, boxColor);
} }
public void drawZendikarCurvedFace(Graphics2D g2, BufferedImage image, int x, int y, int ctrlx, int ctrly, int w, int h, public void drawZendikarCurvedFace(Graphics2D g2, BufferedImage image, int x, int y, int x2, int y2,
int x2, int y2, int ctrlx2, int ctrly2, int w2, int h2,
Color boxColor, Paint paint) { Color boxColor, Paint paint) {
BufferedImage artToUse = faceArtImage; BufferedImage artToUse = faceArtImage;
@ -600,33 +595,27 @@ public class ModernCardRenderer extends CardRenderer {
} }
Path2D.Double curve = new Path2D.Double(); Path2D.Double curve = new Path2D.Double();
curve.moveTo(x, y);
curve.quadTo(ctrlx, ctrly, w, h);
curve.lineTo(w2, h);
curve.quadTo(ctrlx2, ctrly2, x2, y);
curve.lineTo(x, y);
Path2D.Double innercurve = new Path2D.Double(); int ew = x2 - x;
innercurve.moveTo(x + 1, y + 1); int eh = 700 * (y2 - y) / 335;
innercurve.quadTo(ctrlx + 1, ctrly + 1, w + 1, h - 1); Arc2D arc = new Arc2D.Double(x, y - 197 * eh / 700, ew, eh, 0, 360, Arc2D.OPEN);
innercurve.lineTo(w2 - 1, h - 1); Arc2D innerarc = new Arc2D.Double(x + 1, y - 197 * eh / 700 + 1, ew - 2, eh - 2, 0, 360, Arc2D.OPEN);
innercurve.quadTo(ctrlx2 - 1, ctrly2 - 1, x2 - 1, y + 1);
innercurve.lineTo(x + 1, y + 1); curve.append(new Rectangle2D.Double(x, y, x2 - x, y2 - y), false);
g2.setClip(new Rectangle2D.Double(x, y, x2 - x, y2 - y));
g2.setClip(arc);
Rectangle2D r = curve.getBounds2D(); Rectangle2D r = curve.getBounds2D();
int minX = (int) r.getX(); g2.drawImage(artToUse, x, y, x2 - x, y2 - y, null);
g2.setClip(null);
g2.setClip(new Rectangle2D.Double(x, y, x2 - x, y2 - y));
g2.setClip(innercurve); g2.setColor(CardRendererUtils.abitdarker(boxColor));
g2.drawImage(artToUse, minX, y, (x2 - x) + (x - minX) * 2, h2 - y, null); g2.draw(arc);
g2.setColor(Color.black);
g2.draw(innerarc);
g2.setClip(null); g2.setClip(null);
g2.setColor(CardRendererUtils.abitdarker(boxColor));
g2.setPaint(paint);
g2.draw(curve);
g2.setColor(Color.black);
//curve.transform(AffineTransform.getTranslateInstance(-1,-1));
g2.draw(innercurve);
} }
public void drawBFZCurvedFace(Graphics2D g2, BufferedImage image, int x, int y, int x2, int y2, public void drawBFZCurvedFace(Graphics2D g2, BufferedImage image, int x, int y, int x2, int y2,
@ -967,8 +956,7 @@ public class ModernCardRenderer extends CardRenderer {
drawBasicManaTextbox(g, x, y, w, h, ((TextboxBasicManaRule) allRules.get(0)).getBasicManaSymbol()); drawBasicManaTextbox(g, x, y, w, h, ((TextboxBasicManaRule) allRules.get(0)).getBasicManaSymbol());
return; return;
} else // Big circle in the middle for Zendikar lands } else // Big circle in the middle for Zendikar lands
{ if (allRules.size() == 1) {
if (allRules.size() == 1) {
// Size of mana symbol = 9/4 * h, 3/4h above line // Size of mana symbol = 9/4 * h, 3/4h above line
drawBasicManaSymbol(g, x + w / 2 - 9 * h / 8 + 1, y - 3 * h / 4, 9 * h / 4, 9 * h / 4, ((TextboxBasicManaRule) allRules.get(0)).getBasicManaSymbol()); drawBasicManaSymbol(g, x + w / 2 - 9 * h / 8 + 1, y - 3 * h / 4, 9 * h / 4, 9 * h / 4, ((TextboxBasicManaRule) allRules.get(0)).getBasicManaSymbol());
return; return;
@ -978,7 +966,6 @@ public class ModernCardRenderer extends CardRenderer {
} }
return; return;
} }
}
} }
// Go through possible font sizes in descending order to find the best fit // Go through possible font sizes in descending order to find the best fit