代码
var myParentSquareBitmapData:BitmapData = new BitmapData(178, 178, false, 0xff000000);
myParentSquareBitmapData.draw(ldr);
var bounds:Rectangle = new Rectangle(0, 0, myParentSquareBitmapData.width, myParentSquareBitmapData.height);
var BA:ByteArray = new ByteArray();
BA.position = 0;
BA = myParentSquareBitmapData.getPixels(bounds);
var myParentSquareContainer:Bitmap = new Bitmap();
var myClonedChild:BitmapData = new BitmapData(200, 178, false, 0xff000000);
trace(BA.length);
// 4位
for (var i:int = 0; i < BA.length; i += 4)
{
if ((BA[i] == 255) && (BA[i + 1] <= 32) && (BA[i + 2] <= 32) && (BA[i + 3] <= 32))
{
BA[i] = 255; //透明度
BA[i + 1] = 255; //red
BA[i + 2] = 255; //green
BA[i + 3] = 255; //blue
}
}
myParentSquareBitmapData.draw(ldr);
var bounds:Rectangle = new Rectangle(0, 0, myParentSquareBitmapData.width, myParentSquareBitmapData.height);
var BA:ByteArray = new ByteArray();
BA.position = 0;
BA = myParentSquareBitmapData.getPixels(bounds);
var myParentSquareContainer:Bitmap = new Bitmap();
var myClonedChild:BitmapData = new BitmapData(200, 178, false, 0xff000000);
trace(BA.length);
// 4位
for (var i:int = 0; i < BA.length; i += 4)
{
if ((BA[i] == 255) && (BA[i + 1] <= 32) && (BA[i + 2] <= 32) && (BA[i + 3] <= 32))
{
BA[i] = 255; //透明度
BA[i + 1] = 255; //red
BA[i + 2] = 255; //green
BA[i + 3] = 255; //blue
}
}