I'm doing some image effects and wondering if ConvolveOp is working correctly. I was doing some filters on images and was getting dark halos around them. I read somewhere that this might be due to not using pre-calculated alpha (i.e. RGB values do not already include the effect of the alpha channel), so I switched my BufferedImage type to
TYPE_INT_ARGB_PRE, and it worked as expected (see below).
However I do not understand why the image does not display correctly when using
TYPE_INT_ARGB. According to the ConvolveOp documents
This class operates with BufferedImage data in which color components are premultiplied with the alpha component. If the Source BufferedImage has an alpha component, and the color components are not premultiplied with the alpha component, then the data are premultiplied before being convolved. If the Destination has color components which are not premultiplied, then alpha is divided out before storing into the Destination (if alpha is 0, the color components are set to 0). If the Destination has no alpha component, then the resulting alpha is discarded after first dividing it out of the color components.
Doesn't the bolded part mean that non-premultiplied images should work? Or are ConvolvedOp operations only possible on images with premultiplied alpha?
Above: left: BufferedImage type TYPE_INT_ARGB before and after convolution; right: TYPE_INT_ARGB_PRE