/** * Creates a blank image with the given message painted on top (e.g., * a loading or error message), matching the size of the active reader's * thumbnails. */ private BufferedImage makeImage(String message) { int w = reader.getThumbSizeX(), h = reader.getThumbSizeY(); if (w < 128) w = 128; if (h < 32) h = 32; BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); Rectangle2D.Float r = (Rectangle2D.Float) g.getFont().getStringBounds(message, g.getFontRenderContext()); g.drawString(message, (w - r.width) / 2, (h - r.height) / 2 + r.height); g.dispose(); return image; }
/** * Creates a blank image with the given message painted on top (e.g., * a loading or error message), matching the size of the active reader's * thumbnails. */ private BufferedImage makeImage(String message) { int w = reader.getThumbSizeX(), h = reader.getThumbSizeY(); if (w < 128) w = 128; if (h < 32) h = 32; BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); Rectangle2D.Float r = (Rectangle2D.Float) g.getFont().getStringBounds(message, g.getFontRenderContext()); g.drawString(message, (w - r.width) / 2, (h - r.height) / 2 + r.height); g.dispose(); return image; }
/** Obtains a thumbnail for the specified image from the current file. */ public BufferedImage openThumbImage(int no) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { BufferedImage img = AWTImageTools.makeUnsigned(openImage(no)); return AWTImageTools.scale(img, getThumbSizeX(), getThumbSizeY(), false); } byte[] thumbBytes = openThumbBytes(no); return AWTImageTools.openImage(thumbBytes, this, getThumbSizeX(), getThumbSizeY()); }
/** Obtains a thumbnail for the specified image from the current file. */ public BufferedImage openThumbImage(int no) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { BufferedImage img = AWTImageTools.makeUnsigned(openImage(no)); return AWTImageTools.scale(img, getThumbSizeX(), getThumbSizeY(), false); } byte[] thumbBytes = openThumbBytes(no); return AWTImageTools.openImage(thumbBytes, this, getThumbSizeX(), getThumbSizeY()); }
@Test(groups = {"all", "fast", "automated"}) public void testThumbSizeY() { if (config == null) throw new SkipException("No config tree"); String testName = "ThumbSizeY"; if (!initFile()) result(testName, false, "initFile"); for (int i=0; i<reader.getSeriesCount(); i++) { reader.setSeries(i); config.setSeries(i); if (reader.getThumbSizeY() != config.getThumbSizeY()) { result(testName, false, "Series " + i + " (expected " + config.getThumbSizeY() + ", actual " + reader.getThumbSizeY() + ")"); } } result(testName, true); }
int y = reader.getThumbSizeY(); int c = reader.getRGBChannelCount(); int type = reader.getPixelType();
reader.setSeries(i); int x = reader.getThumbSizeX(); int y = reader.getThumbSizeY(); int c = reader.getRGBChannelCount(); int type = reader.getPixelType();
thumbReader.setSeries(i); int sx = thumbReader.getThumbSizeX() + 10; // a little extra padding int sy = thumbReader.getThumbSizeY(); p[i] = new Panel(); p[i].add(Box.createRigidArea(new Dimension(sx, sy)));
thumbReader.setSeries(i); int sx = thumbReader.getThumbSizeX() + 10; // a little extra padding int sy = thumbReader.getThumbSizeY(); p[i] = new Panel(); p[i].add(Box.createRigidArea(new Dimension(sx, sy)));