continue;
}
}
final MapLayer layer = layers[i];
MapContext map = this.mapContext;
map.clearLayerList();
map.addLayer(layer);
final int width = this.mapContext.getMapWidth();
final int height = this.mapContext.getMapHeight();
LOGGER.fine(new StringBuffer("setting up ").append(width).append("x").append(height)
.append(" image").toString());
// simone: ARGB should be much better
BufferedImage curImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
// simboss: this should help out with coverages
final Graphics2D graphic = GraphicsJAI.createGraphicsJAI(curImage.createGraphics(), null);
LOGGER.fine("setting to transparent");
int type = AlphaComposite.SRC;
graphic.setComposite(AlphaComposite.getInstance(type));
Color c = new Color(this.mapContext.getBgColor().getRed(),
this.mapContext.getBgColor().getGreen(),
this.mapContext.getBgColor().getBlue(), 0);
//LOGGER.info("****** bg color: "+c.getRed()+","+c.getGreen()+","+c.getBlue()+","+c.getAlpha()+", trans: "+c.getTransparency());
graphic.setBackground(this.mapContext.getBgColor());
graphic.setColor(c);
graphic.fillRect(0, 0, width, height);
type = AlphaComposite.SRC_OVER;
graphic.setComposite(AlphaComposite.getInstance(type));
Rectangle paintArea = new Rectangle(width, height);
final StreamingRenderer renderer = new StreamingRenderer();
renderer.setContext(map);
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderer.setJava2DHints(hints);
// we already do everything that the optimized data loading does...
// if we set it to true then it does it all twice...
Map rendererParams = new HashMap();
rendererParams.put("optimizedDataLoadingEnabled", Boolean.TRUE);
rendererParams.put("renderingBuffer", new Integer(mapContext.getBuffer()));
renderer.setRendererHints(rendererParams);
Envelope dataArea = map.getAreaOfInterest();
AffineTransform at = RendererUtilities.worldToScreenTransform(dataArea, paintArea);
renderer.paint(graphic, paintArea, dataArea, at);
graphic.dispose();
// /////////////////////////////////////////////////////////////////