*/
public RenderedImage create(ParameterBlock args,
RenderingHints hints) {
// Get source and parameters.
RenderedImage source = args.getRenderedSource(0);
ColorCube colorMap =
(ColorCube)args.getObjectParameter(0);
KernelJAI[] ditherMask = (KernelJAI[])args.getObjectParameter(1);
// Check colorMap compatibility.
if(colorMap.getNumBands() != 1 &&
colorMap.getNumBands() != 3) {
// 1 or 3 band colorMaps only.
return null;
} else if(colorMap.getDataType() != DataBuffer.TYPE_BYTE) {
// byte colorMaps only
return null;
}
// Check source compatibility.
SampleModel sourceSM = source.getSampleModel();
if(sourceSM.getDataType() != DataBuffer.TYPE_BYTE) {
// byte source images only
return null;
} else if(sourceSM.getNumBands() != colorMap.getNumBands()) {
// band counts must match
return null;
}
// Get ImageLayout from RenderingHints if any.