@Override protected void paintComponent(Graphics g) { BufferedImage image = theImage.getImage(); if (image != null) { Graphics2D gg = (Graphics2D) g.create(); overlay.paint(gg, image, theImage.getImageTransform()); gg.dispose(); } }
public void paint(Graphics g) { if (backBufferWidth != getSize().width || backBufferHeight != getSize().height || backBufferImage == null || backBufferGraphics == null) resetBackBuffer(); final Rectangle src = getSrcRect(); synchronized (this) { super.paint(backBufferGraphics); for (Overlay overlay : overlays) overlay.paint(backBufferGraphics, src.x, src.y, magnification); final Roi roi = super.imp.getRoi(); if (roi != null) roi.draw(backBufferGraphics); } g.drawImage(backBufferImage, 0, 0, this); }