BitmapData draw() test
/**
* Copyright yonatan ( http://wonderfl.net/user/yonatan )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/Daoa
*/
package {
import flash.display.*;
import flash.text.*;
import flash.system.*;
public class Test extends Sprite {
private var bmd:BitmapData = new BitmapData(1, 1, true, 0xff112244);
private var tf:TextField = new TextField;
public function Test() {
with(graphics) {
lineStyle(2);
drawRect(465/4, 465/4, 465/2, 465/2);
}
var bmp:Bitmap = new Bitmap(bmd);
bmp.x = bmp.y = 465/4;
bmp.width = bmp.height = 465/2;
addChild(bmp);
bmd.draw(new BitmapData(1, 1, true, 0x000000ff));
var result:uint = bmd.getPixel32(0,0);
addChild(tf);
tf.width = tf.height = 465;
tf.autoSize = "center";
tf.defaultTextFormat = new TextFormat(null, 32);
tf.defaultTextFormat.align = "center";
tf.text = Capabilities.version + "\r" + "color: " + result;
}
}
}