@Override void execute() { if (graphics instanceof DelayedBackbufferGraphic) { ((DelayedBackbufferGraphic) graphics).init(); } final BufferedImage image = ((DelayedBackbufferGraphic) compositingGroup.graphics).image; // we may have not found anything to paint, in that case the delegate // has not been initialized if (image != null) { compositingGroup.graphics.dispose(); Composite composite = compositingGroup.composite; if (composite == null) { graphics.setComposite(AlphaComposite.SrcOver); } else { graphics.setComposite(composite); } graphics.drawImage(image, 0, 0, null); } } }
private static void addToCompositingMapContents( Graphics2D graphics, Rectangle screenSize, List<CompositingGroup> compositingContents, List<Layer> layers, Composite composite) { Graphics2D cmcGraphic; if (compositingContents.size() == 0 && !hasAlphaCompositing(layers)) { cmcGraphic = graphics; } else { cmcGraphic = new DelayedBackbufferGraphic(graphics, screenSize); } MapContent current = new MapContent(); current.addLayers(layers); CompositingGroup cmc = new CompositingGroup(cmcGraphic, current, composite); compositingContents.add(cmc); layers.clear(); }
new LiteFeatureTypeStyle( layer, new DelayedBackbufferGraphic(graphics, screenSize), ruleList, elseRuleList,
@Override void execute() { if (graphic instanceof DelayedBackbufferGraphic) { ((DelayedBackbufferGraphic) graphic).init(); } try { painter.paint(graphic, shape, style, scale, labelObstacle); } catch (Throwable t) { fireErrorEvent(t); } } }
elseRuleList, fts.getTransformation()); } else { lfts = new LiteFeatureTypeStyle(new DelayedBackbufferGraphic(graphics, screenSize), ruleList, elseRuleList, fts.getTransformation());
@Override void execute() { if (graphics instanceof DelayedBackbufferGraphic) { ((DelayedBackbufferGraphic) graphics).init(); } for (LiteFeatureTypeStyle currentLayer : lfts) { // first fts won't have an image, it's using the user provided graphics // straight, so we don't need to compose it back in. final Graphics2D ftsGraphics = currentLayer.graphics; if (ftsGraphics instanceof DelayedBackbufferGraphic && !(ftsGraphics == graphics)) { final BufferedImage image = ((DelayedBackbufferGraphic) ftsGraphics).image; // we may have not found anything to paint, in that case the delegate // has not been initialized if (image != null) { if (currentLayer.composite == null) { graphics.setComposite(AlphaComposite.SrcOver); } else { graphics.setComposite(currentLayer.composite); } graphics.drawImage(image, 0, 0, null); ftsGraphics.dispose(); } } } } }
lfts = new LiteFeatureTypeStyle(graphics, ruleList, elseRuleList, fts.getTransformation()); } else { lfts = new LiteFeatureTypeStyle(new DelayedBackbufferGraphic(graphics, screenSize), ruleList, elseRuleList, fts.getTransformation());
@Override void execute() { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Rendering DirectLayer: " + layer); } if (graphics instanceof DelayedBackbufferGraphic) { ((DelayedBackbufferGraphic) graphics).init(); } try { layer.draw(graphics, mapContent, mapContent.getViewport()); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Layer rendered"); } } catch (Exception e) { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); fireErrorEvent(e); } } }
/** Call this method before starting to use the graphic for good */ public void init() { if (delegate == null) { if (master instanceof DelayedBackbufferGraphic) { ((DelayedBackbufferGraphic) master).init(); } image = master.getDeviceConfiguration() .createCompatibleImage( screenSize.width, screenSize.height, Transparency.TRANSLUCENT); delegate = image.createGraphics(); delegate.setRenderingHints(master.getRenderingHints()); } }
((DelayedBackbufferGraphic) graphics).init();
((DelayedBackbufferGraphic) graphics).init();
@Override void execute() { if(graphic instanceof DelayedBackbufferGraphic) { ((DelayedBackbufferGraphic) graphic).init(); } try { painter.paint(graphic, shape, style, scale, labelObstacle); } catch(Throwable t) { fireErrorEvent(t); } } }