if(layout.getColorModel(src) == src.getColorModel()) {
// Nothing changed: return the source directly.
return src;
} else {
// Remove TileCache hint from RenderingHints if present.
RenderingHints hints = renderHints;
if(hints != null && hints.containsKey(JAI.KEY_TILE_CACHE)) {
hints = new RenderingHints((Map)renderHints);
hints.remove(JAI.KEY_TILE_CACHE);
}
// Only the ColorModel is changing.
return new NullOpImage(src, layout, hints,
OpImage.OP_IO_BOUND);
}
}
if (isDataTypeChange == true) {
// Add JAI.KEY_REPLACE_INDEX_COLOR_MODEL hint to renderHints
if (renderHints == null) {
renderHints =
new RenderingHints(JAI.KEY_REPLACE_INDEX_COLOR_MODEL,
Boolean.TRUE);
} else if (!renderHints.containsKey(
JAI.KEY_REPLACE_INDEX_COLOR_MODEL)) {
// If the user specified a value for this hint, we don't