// Get BorderExtender from renderHints if any.
BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
// map the input kernel + gain factor to an equivalent
// convolution kernel and then do a normal convolve.
KernelJAI unRotatedKernel =
ImageUtil.getUnsharpMaskEquivalentKernel(
(KernelJAI)paramBlock.getObjectParameter(0),
paramBlock.getFloatParameter(1));
KernelJAI kJAI = unRotatedKernel.getRotatedKernel();
RenderedImage source = paramBlock.getRenderedSource(0);
int dataType = source.getSampleModel().getDataType();
boolean dataTypeOk = (dataType == DataBuffer.TYPE_BYTE ||
dataType == DataBuffer.TYPE_SHORT ||
dataType == DataBuffer.TYPE_INT);
if ((kJAI.getWidth() == 3) && (kJAI.getHeight() == 3) &&
(kJAI.getXOrigin() == 1) && (kJAI.getYOrigin() == 1) && dataTypeOk) {
return new Convolve3x3OpImage(source,
extender,
renderHints,
layout,
kJAI);
} else if (kJAI.isSeparable()) {
return new SeparableConvolveOpImage(source,
extender,
renderHints,
layout,
kJAI);