mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Adding in way to render BFZ style full art lands (BFZ and HOU full art lands)
Things still to do: 1) Get everyone to download the full art Face images ... 2) Add in the collector number to the Face images (<ImageDirector>/FACE/ZEN/Island.<numberneeded>.jpg for example) 4) Maybe even add in an UST (Unstable) way of rendering lands (with the swoosh of opaque full art down the bottom).
This commit is contained in:
parent
a28e273dcc
commit
596ca5be86
1 changed files with 95 additions and 25 deletions
|
@ -313,7 +313,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
Rectangle2D rect;
|
||||
if (useInventionFrame()) {
|
||||
rect = new Rectangle2D.Float(0, 0, 1, 1);
|
||||
} else if (cardView.getFrameStyle() == FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
} else if (isZendikarFullArtLand()) {
|
||||
rect = new Rectangle2D.Float(.079f, .11f, .84f, .84f);
|
||||
} else if (cardView.getFrameStyle().isFullArt() || (cardView.isToken())) {
|
||||
rect = new Rectangle2D.Float(.079f, .11f, .84f, .63f);
|
||||
|
@ -332,6 +332,10 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
return TYPE_LINE_Y_FRAC;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isZendikarFullArtLand() {
|
||||
return cardView.getFrameStyle() == FrameStyle.BFZ_FULL_ART_BASIC || cardView.getFrameStyle() == FrameStyle.ZEN_FULL_ART_BASIC;
|
||||
}
|
||||
|
||||
protected boolean isSourceArtFullArt() {
|
||||
int color = artImage.getRGB(0, artImage.getHeight() / 2);
|
||||
|
@ -355,7 +359,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
if (artImage != null && !cardView.isFaceDown()) {
|
||||
|
||||
boolean useFaceArt = false;
|
||||
if (faceArtImage != null && cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (faceArtImage != null && !isZendikarFullArtLand()) {
|
||||
useFaceArt = true;
|
||||
}
|
||||
|
||||
|
@ -398,16 +402,11 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
totalContentInset + 1, totalContentInset + boxHeight,
|
||||
contentWidth - 2, typeLineY - totalContentInset - boxHeight,
|
||||
sourceRect, shouldPreserveAspect);
|
||||
} else if (cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
} else if (!isZendikarFullArtLand()) {
|
||||
drawArtIntoRect(g,
|
||||
totalContentInset + 1, totalContentInset + boxHeight,
|
||||
contentWidth - 2, typeLineY - totalContentInset - boxHeight,
|
||||
sourceRect, shouldPreserveAspect);
|
||||
} else {
|
||||
/* drawArtIntoRect(g,
|
||||
totalContentInset + 1, totalContentInset + boxHeight,
|
||||
contentWidth - 2, typeLineY,
|
||||
sourceRect, shouldPreserveAspect);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +434,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
g.drawRect(
|
||||
totalContentInset, typeLineY,
|
||||
contentWidth - 1, cardHeight - borderWidth * 3 - typeLineY - 1);
|
||||
} else if (cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
} else if (!isZendikarFullArtLand()) {
|
||||
g.drawRect(
|
||||
totalContentInset, totalContentInset,
|
||||
contentWidth - 1, cardHeight - borderWidth * 3 - totalContentInset - 1);
|
||||
|
@ -448,7 +447,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
g.setPaint(textboxPaint);
|
||||
}
|
||||
|
||||
if (cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (!isZendikarFullArtLand()) {
|
||||
g.fillRect(
|
||||
totalContentInset + 1, typeLineY,
|
||||
contentWidth - 2, cardHeight - borderWidth * 3 - typeLineY - 1);
|
||||
|
@ -462,7 +461,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
cardWidth / 16, cardHeight - typeLineY - boxHeight - borderWidth * 3);
|
||||
}
|
||||
|
||||
if (cardView.getFrameStyle() != FrameStyle.KLD_INVENTION && cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (cardView.getFrameStyle() != FrameStyle.KLD_INVENTION && !isZendikarFullArtLand()) {
|
||||
// Draw a shadow highlight at the right edge of the content frame
|
||||
g.setColor(new Color(0, 0, 0, 100));
|
||||
g.fillRect(
|
||||
|
@ -482,7 +481,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
contentInset,
|
||||
borderPaint, boxColor);
|
||||
// Draw the type line box
|
||||
if (cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (!isZendikarFullArtLand()) {
|
||||
CardRendererUtils.drawRoundedBox(g,
|
||||
borderWidth, typeLineY,
|
||||
cardWidth - 2 * borderWidth, boxHeight,
|
||||
|
@ -519,7 +518,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
contentWidth - nameOffset, boxHeight);
|
||||
|
||||
// Draw the textbox rules
|
||||
if (cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (!isZendikarFullArtLand()) {
|
||||
drawRulesText(g, textboxKeywords, textboxRules,
|
||||
totalContentInset + 2, typeLineY + boxHeight + 2,
|
||||
contentWidth - 4, cardHeight - typeLineY - boxHeight - 4 - borderWidth * 3);
|
||||
|
@ -540,17 +539,31 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
totalContentInset + 4 * contentWidth / 7 + boxHeight, typeLineY + boxHeight + (cardHeight - typeLineY - boxHeight - 4 - borderWidth * 3) / 2 - contentInset,
|
||||
3 * contentWidth / 7 - boxHeight - contentInset, boxHeight - 4, true);
|
||||
|
||||
// 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 y2 = y;
|
||||
int topxdelta = 45 * contentWidth / 1000;
|
||||
int botxdelta = 58 * contentWidth / 1000;
|
||||
int ctrlx = 0;
|
||||
int ctrly = (totalContentInset + y2) / 2;
|
||||
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...
|
||||
int x2 = x;
|
||||
int y2 = y;
|
||||
int topxdelta = 45 * contentWidth / 1000;
|
||||
int botxdelta = 58 * contentWidth / 1000;
|
||||
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);
|
||||
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);
|
||||
} else if (cardView.getFrameStyle() == FrameStyle.BFZ_FULL_ART_BASIC) {
|
||||
// Draw curved lines (BFZ land style)
|
||||
int y2 = y;
|
||||
int yb = totalContentInset + boxHeight;
|
||||
int topxdelta = 45 * contentWidth / 1000;
|
||||
int endydelta = 60 * (totalContentInset + y2) / 265;
|
||||
int x2 = x + contentWidth;
|
||||
|
||||
// Curve ends at 60 out of 265
|
||||
drawBFZCurvedFace(g, image, x, yb, x2, y2,
|
||||
topxdelta, endydelta,
|
||||
boxColor, borderPaint);
|
||||
}
|
||||
|
||||
drawRulesText(g, textboxKeywords, textboxRules,
|
||||
x, y,
|
||||
|
@ -615,6 +628,63 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
//curve.transform(AffineTransform.getTranslateInstance(-1,-1));
|
||||
g2.draw(innercurve);
|
||||
}
|
||||
|
||||
public void drawBFZCurvedFace(Graphics2D g2, BufferedImage image, int x, int y, int x2, int y2,
|
||||
int topxdelta, int endydelta,
|
||||
Color boxColor, Paint paint) {
|
||||
BufferedImage artToUse = faceArtImage;
|
||||
boolean hadToUseFullArt = false;
|
||||
if (faceArtImage == null) {
|
||||
if (artImage == null) {
|
||||
return;
|
||||
}
|
||||
hadToUseFullArt = true;
|
||||
artToUse = artImage;
|
||||
}
|
||||
int srcW = artToUse.getWidth();
|
||||
int srcH = artToUse.getHeight();
|
||||
|
||||
if (hadToUseFullArt) {
|
||||
// Get a box based on the standard scan from gatherer.
|
||||
// Width = 185/223 pixels (centered)
|
||||
// Height = 220/310, 38 pixels from top
|
||||
int subx = 19 * srcW / 223;
|
||||
int suby = 38 * srcH / 310;
|
||||
artToUse = artImage.getSubimage(subx, suby, 185 * srcW / 223, 220 * srcH / 310);
|
||||
}
|
||||
|
||||
Path2D.Double curve = new Path2D.Double();
|
||||
curve.moveTo(x + topxdelta, y);
|
||||
curve.quadTo(x, y + endydelta / 2, x, y + endydelta);
|
||||
curve.lineTo(x, y2);
|
||||
curve.lineTo(x2, y2);
|
||||
curve.lineTo(x2, y + endydelta);
|
||||
curve.quadTo(x2, y + endydelta / 2, x2 - topxdelta, y);
|
||||
curve.lineTo(x + topxdelta, y);
|
||||
|
||||
Path2D.Double innercurve = new Path2D.Double();
|
||||
innercurve.moveTo(x + topxdelta, y+1);
|
||||
innercurve.quadTo(x+1, y + endydelta / 2, x+1, y + endydelta);
|
||||
innercurve.lineTo(x+1, y2-1);
|
||||
innercurve.lineTo(x2-1, y2-1);
|
||||
innercurve.lineTo(x2-1, y + endydelta);
|
||||
innercurve.quadTo(x2-1, y + endydelta / 2, x2 - topxdelta, y+1);
|
||||
innercurve.lineTo(x + topxdelta, y+1);
|
||||
|
||||
Rectangle2D r = curve.getBounds2D();
|
||||
int minX = (int) r.getX();
|
||||
|
||||
g2.setClip(curve);
|
||||
g2.drawImage(artToUse, minX, y, (x2 - x) + (x - minX) * 2, y2 - y, null);
|
||||
|
||||
g2.setClip(null);
|
||||
g2.setColor(CardRendererUtils.abitdarker(boxColor));
|
||||
g2.setPaint(paint);
|
||||
g2.draw(curve);
|
||||
|
||||
g2.setColor(Color.black);
|
||||
g2.draw(innercurve);
|
||||
}
|
||||
|
||||
// Draw the name line
|
||||
protected void drawNameLine(Graphics2D g, String baseName, String manaCost, int x, int y, int w, int h) {
|
||||
|
@ -892,8 +962,8 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
}
|
||||
|
||||
// Basic mana draw mana symbol in textbox (for basic lands)
|
||||
if (allRules.size() == 1 && (allRules.get(0) instanceof TextboxBasicManaRule) && cardView.isLand() || cardView.getFrameStyle() == FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (cardView.getFrameStyle() != FrameStyle.ZEN_FULL_ART_BASIC) {
|
||||
if (allRules.size() == 1 && (allRules.get(0) instanceof TextboxBasicManaRule) && cardView.isLand() || isZendikarFullArtLand()) {
|
||||
if (!isZendikarFullArtLand()) {
|
||||
drawBasicManaTextbox(g, x, y, w, h, ((TextboxBasicManaRule) allRules.get(0)).getBasicManaSymbol());
|
||||
return;
|
||||
} else // Big circle in the middle for Zendikar lands
|
||||
|
|
Loading…
Reference in a new issue