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

Method draw

forge-gui-mobile/src/forge/card/CardImage.java:35–64  ·  view source on GitHub ↗
(Graphics g, float x, float y, float w, float h)

Source from the content-addressed store, hash-verified

33 }
34
35 @Override
36 public void draw(Graphics g, float x, float y, float w, float h) {
37 CardView cv = CardView.getCardForUi(card);
38 if (image == null) { //attempt to retrieve card image if needed
39 image = ImageCache.getInstance().getImage(card);
40 if (image == null) {
41 if (!Forge.enableUIMask.equals("Off")) //render this if mask is still loading
42 CardImageRenderer.drawCardImage(g, cv, false, x, y, w, h, CardStackPosition.Top, Forge.enableUIMask.equals("Art"), true);
43
44 return; //can't draw anything if can't be loaded yet
45 }
46 }
47
48 if (image == ImageCache.getInstance().getDefaultImage() || Forge.enableUIMask.equals("Art")) {
49 CardImageRenderer.drawCardImage(g, cv, false, x, y, w, h, CardStackPosition.Top, true, true);
50 } else {
51 if (Forge.enableUIMask.equals("Full")) {
52 if (ImageCache.getInstance().isFullBorder(image))
53 g.drawCardRoundRect(image, null, x, y, w, h, false, false, false);
54 else {
55 float radius = (h - w) / 8;
56 g.drawborderImage(ImageCache.getInstance().borderColor(image), x, y, w, h);
57 g.drawImage(ImageCache.getInstance().croppedBorderImage(image), x + radius / 2.2f, y + radius / 2, w * 0.96f, h * 0.96f);
58 }
59 } else if (Forge.enableUIMask.equals("Crop")) {
60 g.drawImage(ImageCache.getInstance().croppedBorderImage(image), x, y, w, h);
61 } else
62 g.drawImage(image, x, y, w, h);
63 }
64 }
65}

Callers

nothing calls this directly

Calls 12

getCardForUiMethod · 0.95
getInstanceMethod · 0.95
drawCardImageMethod · 0.95
isFullBorderMethod · 0.80
drawCardRoundRectMethod · 0.80
drawborderImageMethod · 0.80
croppedBorderImageMethod · 0.80
getImageMethod · 0.45
equalsMethod · 0.45
getDefaultImageMethod · 0.45
borderColorMethod · 0.45
drawImageMethod · 0.45

Tested by

no test coverage detected