X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Fui%2FGuiReaderCoverImager.java;h=f46ec1bb8c2d9279b58666d015b4ab9e7c7ad48b;hb=1feb447473d8176c3a218cc209c681fb41d468d1;hp=0f6d0b6a8b485c13bee71cad785df2b9f79094f6;hpb=79a9950614d3bea63b0daafb7b7365f6ae3cbeb9;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderCoverImager.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderCoverImager.java index 0f6d0b6..f46ec1b 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderCoverImager.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderCoverImager.java @@ -120,11 +120,43 @@ class GuiReaderCoverImager { * * @param lib * the library the meta comes from - * @param info + * @param meta * the {@link MetaData} * * @return the icon */ + static public ImageIcon generateCoverIcon(BasicLibrary lib, MetaData meta) { + 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}. + * + * @param lib + * the library the meta comes from + * @param info + * the {@link GuiReaderBookInfo} + * + * @return the icon + */ static public ImageIcon generateCoverIcon(BasicLibrary lib, GuiReaderBookInfo info) { BufferedImage resizedImage = null; @@ -144,9 +176,8 @@ class GuiReaderCoverImager { 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 {