Is the background blur achievable? It would help a...
# compose-desktop
r
Is the background blur achievable? It would help a lot if there’s a sample project that does something similar. Thanks!
k
See here. You’ll need to apply the blur effect on the panel behind your “popup”, as render effects can only be applied within the rendering pass of the matching content. That is, you can’t apply a blur, for example, on an unrelated piece in your UI hierarchy. Only that piece can apply a blur on itself.
r
Thanks! However RuntimeShaderBuilder class is not resolved. Would you know where can I find this? @Kirill Grouchnikov
k
You can’t use that in
commonMain
. It’s only available in
desktopMain
.
Full code is here.
r
Oh. Thanks. I was running it under jvmMain.
Thanks a lot bro!
Ohh, its only blurring the desktop app and not the window of a different app.
k
Sure, how would it be able to blur another app’s content? That would be an OS-level feature
For that you can look into what https://github.com/MayakaApps/ComposeWindowStyler offers
r
Thanks a lot for the help! Unfortunately, the demo is not working. Probably an issue with Apple Silicon?
k
Read the documentation to see which effects are supported on specific OS versions
r
Yep. Submitted this . Thanks again!
I wish I could help debug this issue. I’m open to help. (Will have to manage time tho)
k
There’s nothing to debug on non-Windows platforms, as the current implementation only supports Windows OS effects. You can see that in the source code over here. Different OSs support different effects. On macOS there’s
NSVisualEffectView
(see documentation) for individual views which may or may not be what you’re looking for. You would need to figure out how to make JNI bindings for those APIs (see here for some examples) and how to wire those bindings upwards into the Compose world.
r
It’s clear just how much little i know about this. Thanks a lot for the help. I’ll try studying this.
164 Views