views:

15

answers:

1

Isn't there some way to combine two images together using the xOr operator? I realize I can step through pixel by pixel, but with all the graphics options available to Flash, I am reluctant to take such a ham-fisted approach. How can this be accomplished efficiently?

var pixel1:uint;
var pixel2:uint;
var xorMergedPixel:uint;
for (var x:int=0;x<22;x++) {
  for (var y:int=0;y<22;y++) {
    pixel1=bitmapData1.getPixel(x,y);
    pixel2=bitmapData2.getPixel(x,y);
    xorMergedPixel=pixel1^pixel2;
    bitmapData3.setPixel(x,y,xorMergedPixel);
  }
}
+2  A: 

Pixel Bender is your best option. http://www.adobe.com/devnet/flex/articles/pixel_bender_basics_flex_air.html

Gregor Kiddie