/** * Returns BufferedImage for hwComponentType at path of size. If marked, the result image is * brighter by 50%. * * @param hwComponentType * @param path * @param width * @param marked * @return */ public BufferedImage getImage( HwTypeEnum hwComponentType, String path, Integer width, boolean marked) { BufferedImage image; image = imageBuffer.getBufferedImage(path, width, marked); if (image == null) { // load image from file image = createImage(hwComponentType, path, width, marked); // put image into buffer imageBuffer.putBufferedImage(path, width, image, marked); } return image; }
/** * Returns BufferedImage for packetType and packetImageType with width. * * @param packetType * @param packageImageType * @param width * @return */ public BufferedImage getPacketImage( PacketType packetType, PacketImageType packageImageType, int width) { BufferedImage image; String path = getImagePath(packetType, packageImageType); image = imageBuffer.getBufferedImage(path, width, false); if (image == null) { // load image from file image = getScaledBufferedImage(path, width); // put image into buffer imageBuffer.putBufferedImage(path, width, image, false); } return image; }
/** * Gets image with desired text with Font size fontSize and desired width and height. It is * buffered. * * @param text * @param fontSize * @param textWidth * @param textHeigh * @param ascent * @return */ public BufferedImage getImageWithText( String text, Font font, int textWidth, int textHeigh, int ascent) { BufferedImage image; image = imageBuffer.getBufferedImageWithText(text, font.getSize()); if (image == null) { // System.out.println("MISS"); // load image from file image = createImageWithText(text, font, textWidth, textHeigh, ascent); // put image into buffer imageBuffer.putBufferedImageWithText(text, font.getSize(), image); } else { // System.out.println("HIT"); } return image; }
/** Clears buffers with text labels. Call when project is closed. */ public void clearTextBuffers() { imageBuffer.clearTextBuffers(); }
/** Clears all image buffers. */ public void clearBuffer() { imageBuffer.clearBuffer(); }