简体   繁体   English

使用Actionscript 3.0 / Flex对两个图像进行异或运算

[英]xOr'ing Two Images Together Using Actionscript 3.0/Flex

Isn't there some way to combine two images together using the xOr operator? 有没有办法使用xOr运算符将两个图像组合在一起? 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. 我意识到我可以逐个像素地进行操作,但是由于Flash提供了所有图形选项,因此我不愿意采取这种束手无策的方法。 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);
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM