desugar-64 / imla

Hardware-Accelerated Real-time Blur Effect for Android Jetpack Compose
MIT License
104 stars 5 forks source link

Blur broken if app is minimized and opened again #7

Open T8RIN opened 14 hours ago

T8RIN commented 14 hours ago

Huge black areas appearing after pausing app, also why minSdk is 23, i tried with 21 and all is ok

desugar-64 commented 12 hours ago

Thank you for your feedback! @T8RIN I acknowledge that the initialization component currently has significant stability issues. At this stage, the project has been primarily focused on implementing the core blurring functionality, while the initialization process requires separate development attention.

Regarding MinSDK21 support: The current implementation relies on hardware-accelerated canvas features for texture rendering, which may not be consistently available on API level 21. While this is a known limitation, a CPU-based fallback solution could be implemented in the future to extend compatibility. For now, the project maintains its current API level requirements.

T8RIN commented 12 hours ago

Good! Also here are the things that i noticed while playing around:

The library is looking great tho, potential way to add blur to older SDKs

desugar-64 commented 12 hours ago

I think I know what’s happening with the dialog issue, you’re probably sharing the blur state between different windows, which doesn’t work well. Each blur state needs to stick to its own window since the GraphicsLayer is tied to wherever it was first created.

T8RIN commented 12 hours ago

Got it, then it's not possible to blur the background of stacked dialogs? The only workaround is to put source to root and pass state down via composition local, but dialogs will not be visible if something above them requests blurring

desugar-64 commented 12 hours ago

The tricky part is whether we can combine multiple dialogs into one background image. Right now, the project uses GraphicsLayer to capture a compose layout, renders it into a 2D texture, applies the blur effect and other postprocessing, and shows it in a SurfaceView to create that blurred look. But with multiple windows, it gets complicated because each window has its own DisplayList and HwComposer and runs separately. I’m not sure if there’s a way to capture everything from different windows into a single texture yet.

T8RIN commented 12 hours ago

Thanks for explanation

desugar-64 commented 11 hours ago

The library is looking great tho, potential way to add blur to older SDKs

Thanks, that’s the plan for the foreseeable future. 🙂