private static BufferedImage downSizeFast(BufferedImage src, int thumbWidth, int thumbHeight, CheckerboardPainter painter) { BufferedImage thumb = createSysCompatibleImage(thumbWidth, thumbHeight); Graphics2D g = thumb.createGraphics(); if (painter != null) { painter.paint(g, null, thumbWidth, thumbHeight); } g.setRenderingHint(KEY_INTERPOLATION, VALUE_INTERPOLATION_NEAREST_NEIGHBOR); g.drawImage(src, 0, 0, thumbWidth, thumbHeight, null); g.dispose(); return thumb; }
@Override protected void paintComponent(Graphics g) { if (view == null) { return; } Graphics2D g2 = (Graphics2D) g; checkerBoardPainter.paint(g2, null, thumbWidth, thumbHeight); AffineTransform origTX = g2.getTransform(); g2.scale(imgScalingRatio, imgScalingRatio); g2.drawImage(view.getComp().getCompositeImage(), 0, 0, null); g2.setTransform(origTX); g2.setStroke(VIEW_BOX_STROKE); g2.setColor(viewBoxColor); g2.draw(viewBoxRect); }
@Override protected void paintComponent(Graphics g) { // otherwise strange artifacts happen when the panel is larger than the image g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); if (image == null) { return; } try { if (drawCheckerBoard) { Graphics2D g2 = (Graphics2D) g; checkerboardPainter.paint(g2, null, image.getWidth(), image.getHeight()); } g.drawImage(image, 0, 0, null); } catch (OutOfMemoryError e) { Dialogs.showOutOfMemoryDialog(e); } } }
checkerBoardPainter.paint(g2, this, canvasCoWidth, canvasCoHeight);