https://kotlinlang.org logo
#compose
Title
# compose
g

galex

08/02/2020, 5:56 AM
Hello, is there a way to blur a Composable? 😱 If not, how could I achieve that?
a

aiidziis

08/02/2020, 6:11 AM
This is a conversation from 5 months ago. I don’t know if it still valid. https://kotlinlang.slack.com/archives/CJLTWPH7S/p1582840209116000
🙏 1
g

galex

08/02/2020, 6:17 AM
Did you find a way to do it @Zach Klippenstein (he/him) [MOD]?
m

mzgreen

08/02/2020, 8:08 AM
yeah, having a 1st party blur solution would be great, right now blurring textureview/surfaceview is not easy
4
g

galex

08/02/2020, 8:31 AM
The best would be to have it as a Modifier I guess, to blur whatever we put in a Composable. I need to learn how to create that Modifier 😄 If someone could point me into the right direction, that would be great!
👍 1
z

Zach Klippenstein (he/him) [MOD]

08/02/2020, 4:01 PM
Here's the W3 spec for how to implement this feature for CSS in web browsers: https://www.w3.org/TR/filter-effects-2/ Here's the source code for the Magnifier that is used for text selection on newer versions of Android: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/widget/Magnifier.java;l=70?q=Magnifier&sq= They're similar, you could probably copy the magnifier code and make it do blurring instead. None of this is Compose-specific but Compose just uses Android's APIs for graphics so the low-level bits are gonna require working with Android system APIs anyway (eg Surfaces), even if you put a nice Compose API on top of it.
😨 1
👍 1
6 Views