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

Zach Klippenstein (he/him) [MOD]

02/27/2020, 9:50 PM
Flutter has a UI component
BackdropFilter
that lets you do stuff like blur whatever’s behind a view. I know that effect isn’t part of the Material spec, but is something like that possible (or potentially possible in the future) with Compose?
l

Leland Richardson [G]

02/27/2020, 9:53 PM
i think you could build this with public API today
could be wrong though
z

Zach Klippenstein (he/him) [MOD]

02/27/2020, 10:03 PM
I haven’t seen anything in the API that looked obvious, but i might be thinking about it wrong
l

Leland Richardson [G]

02/27/2020, 10:18 PM
i think if you used Draw (and in the future, the draw modifier), you get raw access to the canvas and i think you could apply a filter there
z

Zach Klippenstein (he/him) [MOD]

02/27/2020, 10:20 PM
The flutter implementation has a bunch of components that manipulate “layers” (presumably hardware layers?).
Draw(Modifier)
only give you access to your own children, not the layer below you, I think? https://github.com/flutter/flutter/blob/2132a0c7a3d2a107190238ca0c5570baa0467bb7/packages/flutter/lib/src/rendering/proxy_box.dart#L1064-L1073
Maybe i missed something in the canvas API
l

Leland Richardson [G]

02/27/2020, 10:28 PM
this might be relevant to some of the rendernode work we are doing
c

Chris Craik

02/27/2020, 10:52 PM
Android canvas doesn't really expose any blurring, other than BlurMaskFilter, which isn't supported for most operations
At least on most versions of the platform, not sure about recent ones
z

Zach Klippenstein (he/him) [MOD]

02/27/2020, 11:34 PM
Yea, I was playing with BlurMaskFilter but it only lets you blur the current layer. I was wondering if this would require explicit RenderNode support.
r

romainguy

02/28/2020, 1:50 AM
BlurMaskFilter also doesn’t blur the content
z

Zach Klippenstein (he/him) [MOD]

02/28/2020, 2:26 AM
Yea, it just fades the alpha along the edges
r

romainguy

02/28/2020, 4:08 AM
Well it blurs alpha :)
15 Views