BitmapData#draw() bug?
is this bug? anyone can explain why result bitmap looks like this?
♥0 |
Line 35 |
Modified 2012-03-24 14:42:39 |
MIT License
archived:2017-03-10 09:07:39
ActionScript3 source code
/**
* Copyright codeonwort ( http://wonderfl.net/user/codeonwort )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7b2l
*/
package {
import flash.text.TextField;
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
import flash.display.Bitmap;
public class BitmapData_Draw_Bug extends Sprite {
public function BitmapData_Draw_Bug() {
// write as3 code here..
var mc:Sprite = new Sprite
mc.graphics.lineStyle(1, 0x0)
mc.graphics.drawRect(0, 0, 300, 200)
mc.graphics.lineStyle()
mc.graphics.beginFill(0xff0000)
mc.graphics.drawCircle(150, 100, 50)
var bd:BitmapData = new BitmapData(mc.width+.5, mc.height+.5, true, 0x0)
bd.draw(mc)
addChild(new Bitmap(bd)).y = bd.height
var bd_wanted:BitmapData = bd.clone()
var temp:BitmapData = bd_wanted.clone()
addChild(new Bitmap(bd_wanted))
var m:Matrix = new Matrix
m.translate(-bd.width*.5, -bd.height*.5)
m.scale(1.2, 1.2)
m.translate(bd.width*.5, bd.height*.5)
bd.draw(bd, m, new ColorTransform(1,1,1, .5)) // here
bd_wanted.draw(temp)
bd_wanted.draw(temp, m, new ColorTransform(1,1,1,.5))
with(TextField(addChild(new TextField))){
autoSize = 'left'
text = 'What I wanted'
}
}
}
}