本文整理了Java中it.geosolutions.jaiext.colorindexer.Quantizer.buildColorIndexer方法的一些代码示例,展示了Quantizer.buildColorIndexer的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quantizer.buildColorIndexer方法的具体详情如下:包路径:it.geosolutions.jaiext.colorindexer.Quantizer类名称:Quantizer方法名:buildColorIndexer
Quantizer.buildColorIndexer介绍
暂无
代码示例
代码示例来源:origin: geosolutions-it/jai-ext
@Testpublic void testCompletelyTransparentImage() { BufferedImage image = new BufferedImage(20, 20, BufferedImage.TYPE_INT_ARGB); Graphics g = image.getGraphics(); g.setColor(new Color(20, 20, 20, 0)); g.fillRect(0, 0, 20, 20); g.dispose(); Quantizer q = new Quantizer(2); ColorIndexer indexer = q.buildColorIndexer(image); assertTrue(indexer.toIndexColorModel().getTransparentPixel() != -1);}
代码示例来源:origin: geosolutions-it/jai-ext
@Testpublic void testAlphaZeroNoRemoval() { BufferedImage image = new BufferedImage(40, 40, BufferedImage.TYPE_INT_ARGB); Graphics g = image.getGraphics(); g.setColor(Color.WHITE); g.fillRect(0, 0, 20, 20); g.setColor(new Color(20, 20, 20, 20)); // A dark gray g.fillRect(20, 20, 20, 20); g.setColor(new Color(200, 200, 200, 20)); // A light gray g.fillRect(0, 20, 20, 20); g.setColor(new Color(254, 254, 254, 20)); // A light gray g.fillRect(0, 20, 20, 20); g.setColor(new Color(1, 1, 1, 0)); // transparent g.fillRect(20, 0, 20, 20); g.dispose(); Quantizer q = new Quantizer(2); ColorIndexer indexer = q.buildColorIndexer(image); assertTrue(indexer.toIndexColorModel().getTransparentPixel() != -1);}
代码示例来源:origin: geosolutions-it/jai-ext
private RenderedImage quantize(RenderedImage image, ROI roi, Range nodata, int destNoData) { Quantizer q = new Quantizer(256); ColorIndexer indexer = q.buildColorIndexer(image); RenderedImage indexed = ColorIndexerDescriptor.create(image, indexer, roi, nodata, destNoData, null); checkNoDataROI(indexed, image, roi, nodata, destNoData); return indexed;}
代码示例来源:origin: GeoWebCache/geowebcache
private static RenderedImage applyPalette(RenderedImage canvas) { if (!(canvas.getColorModel() instanceof IndexColorModel)) { // try to force a RGBA setup ImageWorker imageWorker = new ImageWorker(canvas); RenderedImage image = imageWorker.rescaleToBytes().forceComponentColorModel().getRenderedImage(); ColorIndexer indexer = new Quantizer(256).subsample().buildColorIndexer(image); // if we have an indexer transform the image if (indexer != null) { image = new ImageWorker(image).colorIndex(indexer).getRenderedImage(); } return image; } return canvas; }}
代码示例来源:origin: org.geoserver/gs-wms
} else if (palettedFormatName.equalsIgnoreCase(format)) { indexer = new Quantizer(256).subsample().buildColorIndexer(image);
代码示例来源:origin: GeoWebCache/geowebcache
/** * Quantize if the source did not do so already * * @param canvas * @return */ @Override public RenderedImage preprocess(RenderedImage canvas) { if (!(canvas.getColorModel() instanceof IndexColorModel)) { if (canvas.getColorModel() instanceof ComponentColorModel if (indexer != null) { ParameterBlock pb = new ParameterBlock(); pb.setSource(canvas, 0); // The source image. pb.set(indexer, 0); canvas = JAI.create( "ColorIndexer", pb, JAI.getDefaultInstance().getRenderingHints()); } } } return canvas; }};