HI,everyone:
I have a problem,In the H5,I use [email protected] ,Bitmapdata.draw cann’t work when DisplayObject use filters.but In the [email protected] ,It can work!,please help me!
example:
class App extends Sprite {
public constructor () {
super ();
var sprite:Sprite=new Sprite();
sprite.filters=[new GlowFilter(0,0.8,8,8,2)];
sprite.x=200;
sprite.y=200;
sprite.graphics.beginFill(0xff0000,1);
sprite.graphics.drawRect(0,0,200,200);
sprite.graphics.endFill();
this.addChild(sprite);
var bitmapData=new BitmapData(sprite.width,sprite.height,true,0xeeeeee);
bitmapData.draw(sprite);
var bitmap=new Bitmap(bitmapData);
bitmap.x=300;
bitmap.y=300;
this.addChild(bitmap);//In the [email protected],can show on the stage.but 8.9.5 cann't.
my issue is
under openfl 8.9.5 bitmap cann’t display in the stage when bitmapdata.draw target use filters ;but under openfl 8.9.1 it can work.
issue step:
1、sprite use filters; code : sprite.filters=[new GlowFilter(0, 0.8, 8, 8,2)];
2、bitmapdata.draw sprite; code: bitmapData.draw(sprite);
3、bitmap created by bitmapdata; code: var bitmap = new Bitmap(bitmapData);
4、bitmap add to the stage;code: this.addChild(bitmap)
5、under openfl 8.9.5 bitmap cann’t display in the stage;
eg:
class App extends Sprite {
public constructor() {
var sprite: Sprite = new Sprite();
sprite.filters = [new GlowFilter(0, 0.8, 8, 8,2)];//**1.use `filters`**
sprite.x = 200;
sprite.y = 200;
sprite.graphics.beginFill(0xff0000, 1);
sprite.graphics.drawRect(0, 0, 200, 200);
sprite.graphics.endFill();
this.addChild(sprite);
var bitmapData = new BitmapData(sprite.width, sprite.height, true, 0xeeeeee);
bitmapData.draw(sprite);//**2.draw sprite that use filters**
var bitmap = new Bitmap(bitmapData);
bitmap.x = 300;
bitmap.y = 300;
this.addChild(bitmap);
**// 3、do this,under openfl 8.9.5 Can't display in the stage, but under openfl 8.9.1 it work.**
}
}