return generateCoverIcon(lib, GuiReaderBookInfo.fromMeta(meta));
}
+ /**
+ * The width of a cover image.
+ *
+ * @return the width
+ */
+ static public int getCoverWidth() {
+ return SPINE_WIDTH + COVER_WIDTH;
+ }
+
+ /**
+ * The height of a cover image.
+ *
+ * @return the height
+ */
+ static public int getCoverHeight() {
+ return COVER_HEIGHT + HOFFSET;
+ }
+
/**
* Generate a cover icon based upon the given {@link GuiReaderBookInfo}.
*
BufferedImage resizedImage = null;
String id = getIconId(info);
- InputStream in = Instance.getCache().getFromCache(id);
+ InputStream in = Instance.getInstance().getCache().getFromCache(id);
if (in != null) {
try {
resizedImage = ImageUtilsAwt.fromImage(new Image(in));
in.close();
in = null;
} catch (IOException e) {
- Instance.getTraceHandler().error(e);
+ Instance.getInstance().getTraceHandler().error(e);
}
}
if (resizedImage == null) {
try {
Image cover = info.getBaseImage(lib);
- resizedImage = new BufferedImage(SPINE_WIDTH + COVER_WIDTH,
- SPINE_HEIGHT + COVER_HEIGHT + HOFFSET,
- BufferedImage.TYPE_4BYTE_ABGR);
+ resizedImage = new BufferedImage(getCoverWidth(),
+ getCoverHeight(), BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g = resizedImage.createGraphics();
try {
ImageIO.write(resizedImage, "png", out);
byte[] imageBytes = out.toByteArray();
in = new ByteArrayInputStream(imageBytes);
- Instance.getCache().addToCache(in, id);
+ Instance.getInstance().getCache().addToCache(in, id);
in.close();
in = null;
}
} catch (MalformedURLException e) {
- Instance.getTraceHandler().error(e);
+ Instance.getInstance().getTraceHandler().error(e);
} catch (IOException e) {
- Instance.getTraceHandler().error(e);
+ Instance.getInstance().getTraceHandler().error(e);
}
}
*/
static public void clearIcon(GuiReaderBookInfo info) {
String id = getIconId(info);
- Instance.getCache().removeFromCache(id);
+ Instance.getInstance().getCache().removeFromCache(id);
}
/**