Filter cann't work in the openfl 8.9.6

When I use a filter on a bitmap, the filter doesn’t work.In the openfl 8.9.6.
But In the openfl 8.9.5 ,It’s can work.
The TypeScript code

  var image=Assets.getBitmapData("assets/openfl.png");
   var bitmap=new Bitmap(image);
   bitmap.filters=[new GlowFilter(0xff0000, 1, 5, 5, 1, 1,true)] ; 
    this.addChild(bitmap)      

openfl 8.9.5 preview:
image
openfl 8.9.6 preview:
image

Filter support has been up and down since v8.9.5. Lots of wonderful changes happening, and, well, …to make an omelette…
Can you please try branch “develop-v9”, where filters should work fine?
If it doesn’t work as expected there, please respond.

HI,I’m try it in the develop-v9 ,The filter it work,but the object use filter ,cann’t be bitmapdata.draw It.
the issue like this.

I’m use other example ,I use the same typescript code in three openfl version,
when use the openfl 8.9.6,effect preview.bitmap is draw from the Sprite.but filter cann’t work.
image
when use in the openfl develop-v9,filter can work,but bitmap cann’t display that draw from the Sprite
image
when use in the openfl 9.8.5 .filter can work,bitmap cann’t display that draw from the Sprite.
image
this example code eg:

   var sprite=new Sprite();
    sprite.graphics.beginFill(0xffff41,1);
    sprite.graphics.drawRect(0,0,50,50);
    sprite.graphics.endFill();
    sprite.filters=[new GlowFilter(0xff0000, 1, 5, 5, 1, 1,true)] ; 
    this.addChild(sprite)   

    var newBitmapData=new BitmapData(sprite.width,sprite.height);
    newBitmapData.draw(sprite);
    var newBitmap=new Bitmap(newBitmapData);
    newBitmap.x=100;
    this.addChild(newBitmap)

I just moved the newer GlowFilter improvements for the Context3D renderer to the ‘develop’ branch on Github. Here’s how it looks:

image

(This should be the best of the above screenshots where the displayed version has the full filter and the bitmapData.draw version at least preserves the original fill)

The issue is that glow has been implemented in OpenGL shaders but has not been implemented for an inner glow in software. bitmapData.draw by default runs in software so that you can getPixel on the results

Long-term I think the best solution is for us to get more complete filter implementations in both hardware and software, but there’s a workaround you can use in order to force bitmapData.draw to use hardware instead of software. It does mean you cannot “read” the pixels again later (such as getPixels()) but it is useful for caching:

var newBitmapData=new BitmapData(sprite.width,sprite.height);
newBitmapData.disposeImage(); // force hardware
newBitmapData.draw(sprite);
var newBitmap=new Bitmap(newBitmapData);
newBitmap.x=100;
this.addChild(newBitmap)

image

1 Like

Thanks for your Reply.Looking forward to perfect solution of filter and draw.