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

Class CachedCardImage

forge-gui-mobile/src/forge/CachedCardImage.java:12–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10import forge.util.ImageFetcher;
11
12public abstract class CachedCardImage implements ImageFetcher.Callback {
13 protected final String key;
14 static final ImageFetcher fetcher = GuiBase.getInterface().getImageFetcher();
15
16 public CachedCardImage(final CardView card) {
17 key = card.getCurrentState().getImageKey(MatchController.instance.getLocalPlayers());
18 fetch();
19 }
20
21 public CachedCardImage(final InventoryItem ii) {
22 key = ii.getImageKey(false);
23 fetch();
24 }
25
26 public CachedCardImage(String key) {
27 this.key = key;
28 fetch();
29 }
30
31 public void fetch() {
32 if (!ImageCache.getInstance().imageKeyFileExists(key)) {
33 fetcher.fetchImage(key, this);
34 }
35 }
36
37 public Texture getImage() {
38 return ImageCache.getInstance().getImage(key, true);
39 }
40
41 public Texture getImage(String mykey) {
42 return ImageCache.getInstance().getImage(mykey, true);
43 }
44
45 public abstract void onImageFetched();
46}

Callers

nothing calls this directly

Calls 2

getInterfaceMethod · 0.95
getImageFetcherMethod · 0.65

Tested by

no test coverage detected