Faster way to process and add filters to Bitmap

Currently I’m taking the screen bitmap data using draw and then adding a blur filter to it, It takes around 2 second on a Samsung s7 for android. Wondering if there is a way to do it faster thanks! Here’s my code below, scaling is somthing to do with my screen scale algorithmn not very important to it.

bitmapState = new Bitmap();
bitmapState.bitmapData = new BitmapData(Math.floor(Main.bg.width), Math.floor(Main.bg.height), false);
 bitmapState.bitmapData.draw(Main.state, Main.state.transform.matrix);
		bitmapState.filters = [new BlurFilter(16,16)];
		bitmapState.visible = true;
		trace("sx " + bitmapState.scaleX + " sy " + bitmapState.scaleY);
		bitmapState.scaleX *= 1 / Main.difY;
		bitmapState.scaleY *=  1 / Main.difY;

It’s possible to use a custom shader, with bitmap.shader (which is a beta API at the moment) but I would like a shader-based BitmapFilter system in the future, using framebuffers. We did this before, but in a way that froze performance on mobile, so we need to approach it again, hopefully in a way which should run faster :slight_smile:

Oh, you can also bitmapData.applyFilter, and see if it helps. That should allow you to control how often the filter is applied, as well as at what scale, which all affects the cost

1 Like

I did try to apply filter and I came up with quite a weird blur effect haha
https://cdn.discordapp.com/attachments/257999675158822912/380949573717458956/unknown.png

But I’ll try out the shader Api thankyou alot for the support! :slight_smile: