private synchronized BufferedImage createResponse() { if (image == null) { if (cMapLegendCreator != null) // creating a legend image = cMapLegendCreator.getLegend(); else { image = ImageUtils.createImage(width, height, (IndexColorModel) null, transparent); final Graphics2D graphics = ImageUtils.prepareTransparency( transparent, bgColor, image, new HashMap<RenderingHints.Key, Object>()); if (defaultLegend == null) { drawRasterIcon(graphics); } else { graphics.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.drawImage(defaultLegend, 0, 0, width, height, null); } graphics.dispose(); } } return image; }
/** @param originalImage */ protected RenderedImage forceIndexed8Bitmask( RenderedImage originalImage, InverseColorMapOp paletteInverter) { return ImageUtils.forceIndexed8Bitmask(originalImage, paletteInverter); }
/** * Sets up a {@link BufferedImage#TYPE_4BYTE_ABGR} if the paletteInverter is not provided, or a * indexed image otherwise. Subclasses may override this method should they need a special kind * of image * * @param width * @param height * @param paletteInverter */ protected RenderedImage prepareImage( int width, int height, IndexColorModel palette, boolean transparent) { return ImageUtils.createImage( width, height, isPaletteSupported() ? palette : null, transparent && isTransparencySupported()); }
protected Graphics2D getGraphics( final boolean transparent, final Color bgColor, final RenderedImage preparedImage, final Map<RenderingHints.Key, Object> hintsMap) { return ImageUtils.prepareTransparency(transparent, bgColor, preparedImage, hintsMap); }
.getRenderedImage(); if (DEBUG) { writeRenderedImage(image, "indexed8translucent"); writeRenderedImage(image, "invColorMap"); writeRenderedImage(image, "forceComponentColorModel"); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer( "Computed Palette:" + paletteRepresentation(cpb.getIndexColorModel())); writeRenderedImage(image, "buildPalette");
/** * When you override {@link #prepareImage(int, int, IndexColorModel, boolean)} remember to * override this one as well * * @param width * @param height * @param palette * @param transparent */ protected long getDrawingSurfaceMemoryUse( int width, int height, IndexColorModel palette, boolean transparent) { return ImageUtils.getDrawingSurfaceMemoryUse( width, height, isPaletteSupported() ? palette : null, transparent && isTransparencySupported()); }
ImageUtils.createImage(w, h, (IndexColorModel) null, true);
ImageUtils.createImage(wid, height, (IndexColorModel) null, transparent); final Map<RenderingHints.Key, Object> hintsMap = new HashMap<RenderingHints.Key, Object>(); Graphics2D g2 = ImageUtils.prepareTransparency(transparent, backgroundColor, newImage, hintsMap); g2.setFont(labelFont); if (useAA) {
/** * Renders a title for a layer (to be put on top of the layer legend). * * @param legend FeatureType representing the layer * @param w width for the image (hint) * @param h height for the image (hint) * @param transparent (should the image be transparent) * @param request GetLegendGraphicRequest being built * @return image with the title */ private RenderedImage getLayerTitle( LegendRequest legend, int w, int h, boolean transparent, GetLegendGraphicRequest request) { String title = legend.getTitle(); final BufferedImage image = ImageUtils.createImage(w, h, (IndexColorModel) null, transparent); return LegendMerger.getRenderedLabel(image, title, request); }
/** * @param legend a {@link BufferedImageLegendGraphic} * @param output image destination * @param operation Operation descriptor the {@code legend} was produced for * @see Response#write(Object, OutputStream, Operation) */ @Override public void write(Object legend, OutputStream output, Operation operation) throws IOException, ServiceException { Assert.isInstanceOf(BufferedImageLegendGraphic.class, legend); BufferedImage legendGraphic = ((BufferedImageLegendGraphic) legend).getLegend(); RenderedImage forcedIndexed8Bitmask = ImageUtils.forceIndexed8Bitmask(legendGraphic, null); ImageWorker imageWorker = new ImageWorker(forcedIndexed8Bitmask); imageWorker.writeGIF(output, "LZW", 0.75f); } }
ImageUtils.createImage(wid, height, (IndexColorModel) null, transparent); final Map<RenderingHints.Key, Object> hintsMap = new HashMap<RenderingHints.Key, Object>(); Graphics2D g2 = ImageUtils.prepareTransparency(transparent, backgroundColor, newImage, hintsMap); g2.setFont(labelFont); if (useAA) {
ImageUtils.createImage(w, h, (IndexColorModel) null, true);
ImageUtils.createImage(1, 1, (IndexColorModel) null, transparent); final Map<Key, Object> hintsMap = new HashMap<Key, Object>(); final Graphics2D graphics = ImageUtils.prepareTransparency(transparent, backgroundColor, image, hintsMap);
/** * Renders a title for a layer (to be put on top of the layer legend). * * @param legend FeatureType representing the layer * @param w width for the image (hint) * @param h height for the image (hint) * @param transparent (should the image be transparent) * @param request GetLegendGraphicRequest being built * @return image with the title */ private RenderedImage getLayerTitle( LegendRequest legend, int w, int h, boolean transparent, GetLegendGraphicRequest request) { String title = legend.getTitle(); final BufferedImage image = ImageUtils.createImage(w, h, (IndexColorModel) null, transparent); return LegendMerger.getRenderedLabel(image, title, request); }
+ 0.5); final BufferedImage finalImage = ImageUtils.createImage( totalWidth, totalHeight, (IndexColorModel) null, transparent); final Graphics2D finalGraphics = ImageUtils.prepareTransparency(transparent, backgroundColor, finalImage, hintsMap);
protected int getTitleHeight(GetLegendGraphicRequest req) { final BufferedImage image = ImageUtils.createImage( req.getWidth(), req.getHeight(), (IndexColorModel) null, req.isTransparent()); return getRenderedLabel(image, "TESTTITLE", req).getHeight(); }
final int totalHeight = (int) finalDimension.getHeight(); BufferedImage finalLegend = ImageUtils.createImage( totalWidth, totalHeight, (IndexColorModel) null, transparent); ImageUtils.prepareTransparency( transparent, backgroundColor, finalLegend, hintsMap); hintsMap.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
ImageUtils.createImage( strokeWidth, strokeHeight, (IndexColorModel) null, false); Graphics2D finalGraphics = ImageUtils.prepareTransparency( false, LegendUtils.getBackgroundColor(legend.request),
BufferedImage image = ImageUtils.createImage(1, 1, (IndexColorModel) null, transparent); final Map<Key, Object> hintsMap = new HashMap<Key, Object>(); Graphics2D graphics = ImageUtils.prepareTransparency(transparent, backgroundColor, image, hintsMap);
public BufferedImage renderComposite(final DistributedRenderOptions renderOptions) { final BufferedImage image = ImageUtils.createImage( renderOptions.getMapWidth(), renderOptions.getMapHeight(), renderOptions.getPalette(), renderOptions.isTransparent() || renderOptions.isMetatile()); final Graphics2D graphics = ImageUtils.prepareTransparency( renderOptions.isTransparent(), renderOptions.getBgColor(), image, null); for (final CompositeGroupResult compositeGroup : orderedComposites) { compositeGroup.render(graphics, renderOptions.getMapWidth(), renderOptions.getMapHeight()); } final BufferedImage img = parentImage.getImage(); graphics.drawImage(img, 0, 0, null); graphics.dispose(); return image; }