Hello. Is there any way to draw blurred content in...
# compose
b
Hello. Is there any way to draw blurred content inside a
Canvas
?
r
With Android 12, yes
Using the
RenderEffect
API
👌 2
m
Wow that looks powerful
b
Any hint regarding how to use that API? I was exploring how it is done internally with
shadow
modifier. I think it uses graphics layer internally and eventually interacts with the render API, but I got lost in the process.
b
ah, I was wondering if there was a way to do it inside a Compose's
Canvas
😅
2
n
We are working on exposing the
RenderEffect
api to the compose framework. If you are very keen on getting this to work today there are ways to do so but requires some compose interop usage of the
RenderNode
API and configuring the blur on that and drawing into the compose canvas
👍 2
❤️ 2
b
That sounds nice, thanks!
r
RenderScript cannot blur a
View
, it can blur a
Bitmap
So you can do what others have done in the past and render to a
Bitmap
first (or use
PixelCopy
) and then blur the result
h
Thanks for the reassurance! I actually got that working, but did not yet figure out how I could see the composed UI underneath. Do you think that's possible, or does the blurred content all need to be laid out in an AndroidView?