@Override public void render(Graphics gr) { Graphics2D image = (Graphics2D) gr; image.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); super.render(image); }
public void paint(Graphics g) { if (layer == null) { logger.warning("NULL layer, skipping..."); return; } OMGraphicList list = layer.getList(); Projection proj = layer.getProjection(); Graphics2D g2 = (Graphics2D) g; if (layer.isProjectionOK(proj)) { if (getBuffer() == null) { // Not sure how we get here, but it's here just in case so that // the list might get painted if it exists and the buffered // image wasn't created. logger.fine("creating image buffer in paint"); if (list != null) { setBuffer(createAndPaintImageBuffer(list)); } } BufferedImage bufferedImage = getBuffer(); setCompositeOnGraphics(g2); if (bufferedImage != null) { AffineTransform af = new AffineTransform(); af.translate(offset.getX(), offset.getY()); g2.drawRenderedImage((BufferedImage) bufferedImage, af); if (logger.isLoggable(Level.FINE)) { logger.fine("RenderingPolicy:" + layer.getName() + ": rendering buffer"); } } else if (list != null) { super.setRenderingHints(g); list.render(g); if (logger.isLoggable(Level.FINE)) { logger.fine(layer.getName() + ": rendering list directly"); } } } else if (logger.isLoggable(Level.FINE)) { logger.fine( layer.getName() + ".paint(): " + (list == null ? "NULL list, skipping..." : " skipping due to projection.")); } }
protected BufferedImage createAndPaintImageBuffer(OMGraphicList list) { BufferedImage bufferedImage = null; if (list != null && layer != null) { int w = layer.getProjection().getWidth(); int h = layer.getProjection().getHeight(); bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics(); super.setRenderingHints(g2d); list.render(g2d); if (logger.isLoggable(Level.FINE)) { logger.fine(layer.getName() + ": rendering list into buffer"); } } return bufferedImage; }
/** Turn on anti-aliasing */ @Override public void render(Graphics g) { Graphics2D image = (Graphics2D) g; image.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); super.render(image); }