/** Forces the provided {@link ColorModel} via the JAI ColorConvert operation.*/ private void forceColorModel(final ColorModel cm){ final org.jaitools.imageutils.ImageLayout2 il = new org.jaitools.imageutils.ImageLayout2(image); il.setColorModel(cm); il.setSampleModel(cm.createCompatibleSampleModel(image.getWidth(), image.getHeight())); final RenderingHints oldRi = this.getRenderingHints(); final RenderingHints newRi = (RenderingHints) oldRi.clone(); newRi.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il)); setRenderingHints(newRi); image = ColorConvertDescriptor.create(image, cm, getRenderingHints()); // restore RI this.setRenderingHints(oldRi); // invalidate stats invalidateStatistics(); }
if (isValid(ImageLayout2.WIDTH_MASK)){ code += (getWidth(null) * i++); if (isValid(ImageLayout2.HEIGHT_MASK)){ code += (getHeight(null) * i++); if (isValid(ImageLayout2.MIN_X_MASK)){ code += (getMinX(null) * i++); if (isValid(ImageLayout2.MIN_Y_MASK)){ code += (getMinY(null) * i++); if (isValid(ImageLayout2.TILE_HEIGHT_MASK)){ code += (getTileHeight(null) * i++); if (isValid(ImageLayout2.TILE_WIDTH_MASK)){ code += (getTileWidth(null) * i++); if (isValid(ImageLayout2.TILE_GRID_X_OFFSET_MASK)){ code += (getTileGridXOffset(null) * i++); if (isValid(ImageLayout2.TILE_GRID_Y_OFFSET_MASK)){ code += (getTileGridYOffset(null) * i++); if (isValid(ImageLayout2.SAMPLE_MODEL_MASK)){ code ^= getSampleModel(null).hashCode(); if (isValid(ImageLayout2.COLOR_MODEL_MASK)) code ^= getColorModel(null).hashCode();
final ImageLayout2 il= new ImageLayout2(); il.setColorModel(rasterManager.defaultCM); Dimension tileSize= request.getTileDimensions(); if(tileSize==null){ tileSize=JAI.getDefaultTileSize(); il.setSampleModel(rasterManager.defaultCM.createCompatibleSampleModel(tileSize.width, tileSize.height)); il.setTileGridXOffset(0).setTileGridYOffset(0).setTileWidth((int)tileSize.getWidth()).setTileHeight((int)tileSize.getHeight()); return FormatDescriptor.create( finalImage, Integer.valueOf(il.getSampleModel(null).getDataType()), new RenderingHints(JAI.KEY_IMAGE_LAYOUT,il));
final ImageLayout2 layout = new ImageLayout2(finalImage); layout.setTileGridXOffset(0).setTileGridYOffset(0).setTileHeight(tileSizeY).setTileWidth(tileSizeX); final RenderingHints localHints = this.hints.clone(); localHints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout)); layout.unsetValid(ImageLayout2.COLOR_MODEL_MASK).unsetValid(ImageLayout2.SAMPLE_MODEL_MASK);
if (getValidMask() != other.getValidMask()) { return false; if (getWidth(null) != other.getWidth(null)) { return false; if (getHeight(null) != other.getHeight(null)) { return false; if (getMinX(null) != other.getMinX(null)) { return false; if (getMinY(null) != other.getMinY(null)) { return false; if (getTileWidth(null) != other.getTileWidth(null)) { return false; if (getTileHeight(null) != other.getTileHeight(null)) { return false; if (getTileGridXOffset(null) != other.getTileGridXOffset(null)) { return false; if (getTileGridYOffset(null) != other.getTileGridYOffset(null)) { return false; SampleModel sm = getSampleModel(null); if (sm == null) {