MCPcopy Create free account
hub / github.com/Card-Forge/forge / drawCard

Method drawCard

forge-gui-mobile/src/forge/card/CardRenderer.java:618–656  ·  view source on GitHub ↗
(Graphics g, IPaperCard pc, float x, float y, float w, float h, CardStackPosition pos)

Source from the content-addressed store, hash-verified

616 }
617
618 public static void drawCard(Graphics g, IPaperCard pc, float x, float y, float w, float h, CardStackPosition pos) {
619 Texture image = new RendererCachedCardImage(pc, false).getImage();
620 final CardView card = CardView.getCardForUi(pc);
621 float radius = (h - w) / 8;
622 float croppedArea = isModernFrame(pc) ? CROP_MULTIPLIER : 0.97f;
623 float minusxy = isModernFrame(pc) ? 0.0f : 0.13f * radius;
624 if (pc.getEdition().equals("LEA") || pc.getEdition().equals("LEB")) {
625 croppedArea = 0.975f;
626 minusxy = 0.135f * radius;
627 }
628 if (pc.isFoil()) { //draw foil effect if needed
629 if (card.getCurrentState().getFoilIndex() == 0) { //if foil finish not yet established, assign a random one
630 card.getCurrentState().setFoilIndexOverride(-1);
631 }
632 }
633 if (image != null) {
634 if (image == ImageCache.getInstance().getDefaultImage() || Forge.enableUIMask.equals("Art")) {
635 CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos, true, true);
636 } else {
637 if (Forge.enableUIMask.equals("Full")) {
638 if (ImageCache.getInstance().isFullBorder(image))
639 g.drawCardRoundRect(image, null, x, y, w, h, false, false, CardRendererUtils.drawFoil(card));
640 else {
641 //tint the border
642 g.drawImage(ImageCache.getInstance().getBorderImage(image.toString()), ImageCache.getInstance().borderColor(image), x, y, w, h);
643 g.drawImage(ImageCache.getInstance().croppedBorderImage(image), x + radius / 2.4f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea);
644 if (CardRendererUtils.drawFoil(card))
645 g.drawFoil(x, y, w, h, radius);
646 }
647 } else if (Forge.enableUIMask.equals("Crop")) {
648 g.drawImage(ImageCache.getInstance().croppedBorderImage(image), x, y, w, h, CardRendererUtils.drawFoil(card));
649 } else
650 g.drawImage(image, x, y, w, h, CardRendererUtils.drawFoil(card));
651 }
652 } else {
653 //if card has invalid or no texture due to sudden changes in ImageCache, draw CardImageRenderer instead and wait for it to refresh automatically
654 CardImageRenderer.drawCardImage(g, card, false, x, y, w, h, pos, true, true);
655 }
656 }
657
658 public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean rotate) {
659 drawCard(g, card, x, y, w, h, pos, rotate, false, false, false);

Callers 9

drawMethod · 0.95
drawOverlayMethod · 0.95
drawMethod · 0.95
drawCardMethod · 0.95
drawValueMethod · 0.95
drawMethod · 0.95
drawCardWithOverlaysMethod · 0.95
drawMethod · 0.95
drawMethod · 0.95

Calls 15

getCardForUiMethod · 0.95
isModernFrameMethod · 0.95
getCurrentStateMethod · 0.95
getInstanceMethod · 0.95
drawCardImageMethod · 0.95
drawFoilMethod · 0.95
getCracksMethod · 0.95
getPlayerSleeveMethod · 0.95
needsRotationMethod · 0.95
showCardIdOverlayMethod · 0.95
drawGrayMethod · 0.95
drawCracksMethod · 0.95

Tested by

no test coverage detected