import flash.display.Bitmap; import flash.display.BitmapData; import flash.geom.Rectangle; import flash.geom.Point; var bmd1: BitmapData = new BitmapData(100, 80, true, 0xFF00FF00); var bmd2: BitmapData = new BitmapData(100, 80, true, 0xFFFF0000); //如果bmd2透明度为0就能达到抠图的效果 var rect: Rectangle = new Rectangle(0, 0, 40, 40); var pt: Point = new Point(20, 20); var mult: uint = 0x80; // 50 % , 各通道值均为128,即 50 % bmd1.merge(bmd2, rect, pt, mult, mult, mult, mult); var bm1: Bitmap = new Bitmap(bmd1); addChild(bm1); var bm2: Bitmap = new Bitmap(bmd2); addChild(bm2); bm2.x = 110; //最终值 //new redDest = [(redSrc * redMultiplier) + (redDest * (256 - redMultiplier))] / 256; trace(bmd1.getPixel32(20, 20).toString(16)); //ff7f7f00 //解释: //返回值中Red分量为 7f = 0x00 * 0x80 + 0xff * (0x100 - 0x80) / 0x100