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

Method draw

forge-gui-mobile/src/forge/GuiMobile.java:144–163  ·  view source on GitHub ↗
(final Graphics g, final float w, final float h)

Source from the content-addressed store, hash-verified

142 public ISkinImage createLayeredImage(final PaperCard paperCard, final FSkinProp background, final String overlayFilename, final float opacity) {
143 return new FBufferedImage(background.getWidth(), background.getHeight(), opacity) {
144 @Override
145 protected void draw(final Graphics g, final float w, final float h) {
146 g.drawImage(FSkin.getImages().get(background), 0, 0, background.getWidth(), background.getHeight());
147 final float cardImageWidth = 90f;
148 final float cardImageHeight = 128f;
149
150 if (FileUtil.doesFileExist(overlayFilename)) {
151 try {
152 final Texture overlay = Forge.getAssets().getTexture(Gdx.files.absolute(overlayFilename));
153 g.drawImage(overlay, (background.getWidth() - overlay.getWidth()) / 2f, (background.getHeight() - overlay.getHeight()) / 2f, overlay.getWidth(), overlay.getHeight());
154 } catch (Exception ignored) {
155 }
156 } else if (paperCard != null) {
157 Texture cardImage = ImageCache.getInstance().getImage(paperCard.getCardImageKey(), false);
158 if (cardImage != null)
159 g.drawCardRoundRect(cardImage, null, (background.getWidth() - cardImageWidth) / 2, (background.getHeight() - cardImageHeight) / 3.8f, cardImageWidth, cardImageHeight, false, false, paperCard.isFoil());
160 }
161
162 Gdx.graphics.requestRendering(); //ensure image appears right away
163 }
164 };
165 }
166

Callers

nothing calls this directly

Calls 13

getImagesMethod · 0.95
doesFileExistMethod · 0.95
getAssetsMethod · 0.95
getInstanceMethod · 0.95
drawCardRoundRectMethod · 0.80
getMethod · 0.65
getWidthMethod · 0.65
getHeightMethod · 0.65
getCardImageKeyMethod · 0.65
isFoilMethod · 0.65
drawImageMethod · 0.45
getTextureMethod · 0.45

Tested by

no test coverage detected