In pure AS3, I have a pixelbender and a large bitmap. The pixelbender is configurable with a distance parameter to affect only a small area of the bitmap. The problem is that the pixelbender is executing over the whole bitmap. What would be the best way to update only the effected region of the bitmap?
Given this config:
shader.data.image.input = referenceBitmap.bitmapData; // 300x200
shader.data.position = [150,100];
shader.data.distance = [20];
The following does not work:
new ShaderJob(shader,
bitmap.bitmapData.getPixels(
new Rectangle(particle.x -10,
particle.y -10,
20,
20))).start();
I could make a temporary array to hold the computed values and then copy them back into the bitmapData array. Although I would like for the shader to update the bitmapData pixels directly and only on the affected area.
The following works, but the shader runs on the whole 300x200 bitmap:
new ShaderJob(shader, bitmap.bitmapData).start();
Any suggestions?
EDIT: a filter will not work as there are 3 input images