/** * Gets a given gui image. * * @param file The file the image is in. * @param seqnumber The image number. * @return The image. */ public SingleImage getGuiImage(int file, int seqnumber) { DatFileSet set = getFileSet(file); if (set != null) { return (SingleImage) set.getGuis().getImageSafe(seqnumber); } else { return NullImage.getInstance(); } }
/** * Gets a landscape texture. * * @param file The file number it is in. * @param seqnumber It's sequence number. * @return The image, or an empty image. */ private SingleImage getLandscapeImage(int file, int seqnumber) { DatFileSet set = getFileSet(file); if (set != null) { Sequence<LandscapeImage> landscapes = set.getLandscapes(); if (seqnumber < landscapes.length()) { return (SingleImage) landscapes.getImageSafe(seqnumber); } } return NullImage.getInstance(); }
/** * Gets the highest resolution image that fits the given size. * * @param link The link that describes the image * @param width The width the image should have (at least). * @param height The height the image should have (at least). * @return The image or a null image. */ public Image getImage(ImageLink link, float width, float height) { if (link == null) { return NullImage.getInstance(); } else if (link instanceof DirectImageLink) { return getDirectImage((DirectImageLink) link); } else { OriginalImageLink olink = (OriginalImageLink) link; if (olink.getType() == EImageLinkType.LANDSCAPE) { return getLandscapeImage(olink.getFile(), olink.getSequence()); } else { return getDetailedImage(olink, width, height); } } }