int historyIdx;
int aSum;
ColorModel srcColorModel = src.getColorModel();
WritableRaster srcRaster = src.getRaster();
int[] dstBuffer = ((DataBufferInt) dst.getRaster().getDataBuffer()).getData();
int lastPixelOffset = right * dstWidth;
float hSumDivider = 1.0f / size;
float vSumDivider = opacity / size;
// horizontal pass : extract the alpha mask from the source picture and
// blur it into the destination picture
for (int srcY = 0, dstOffset = left * dstWidth; srcY < srcHeight; srcY++) {
// first pixels are empty
for (historyIdx = 0; historyIdx < shadowSize; ) {
aHistory[historyIdx++] = 0;
}
aSum = 0;
historyIdx = 0;
// compute the blur average with pixels from the source image
for (int srcX = 0; srcX < srcWidth; srcX++) {
int a = (int) (aSum * hSumDivider); // calculate alpha value
dstBuffer[dstOffset++] = a << 24; // store the alpha value only
// the shadow color will be added in the next pass
aSum -= aHistory[historyIdx]; // substract the oldest pixel from the sum
// extract the new pixel ...
a = srcColorModel.getAlpha(srcRaster.getDataElements(srcX, srcY, null));
aHistory[historyIdx] = a; // ... and store its value into history
aSum += a; // ... and add its value to the sum
if (++historyIdx >= shadowSize) {
historyIdx -= shadowSize;