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

Method load

forge-gui-desktop/src/main/java/forge/ImageLoader.java:16–39  ·  view source on GitHub ↗
(String key)

Source from the content-addressed store, hash-verified

14
15final class ImageLoader extends CacheLoader<String, BufferedImage> {
16 @Override
17 public BufferedImage load(String key) {
18 if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
19 return null;
20
21 File file = ImageKeys.getImageFile(key);
22 if (file != null) {
23 if (!file.exists()) {
24 return null;
25 }
26 if (file.isDirectory()) {
27 file.delete();
28 return null;
29 }
30 try {
31 //it seems twelvemonkeys plugin handles the cmyk and other non standard colorspace jpeg automaticaly :)
32 return ImageIO.read(file);
33 }
34 catch (IOException ex) {
35 BugReporter.reportException(ex, "Could not read image file " + file.getAbsolutePath() + " ");
36 }
37 }
38 return null;
39 }
40}

Callers

nothing calls this directly

Calls 6

getPreferencesMethod · 0.95
getImageFileMethod · 0.95
reportExceptionMethod · 0.95
getPrefBooleanMethod · 0.80
deleteMethod · 0.65
readMethod · 0.45

Tested by

no test coverage detected