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

spierce7

06/22/2022, 4:07 PM
If I have the below code, Is there a way to clip B to only where A has content (not clip to bounds, but actually clip B to where A has drawn)?
Copy code
Box {
  A()
  B()
}
It’s fine if the API here changes. The only way I can think to do this would be to somehow render A and B to `ImageBitmap`s and then draw them in a
Canvas
with a
BlendMode
. However the only way that I can think to get A or B to
ImageBitmap
would be with
ImageComposeScene
which seems like a really bad idea.
r

romainguy

06/22/2022, 4:17 PM
You'll have to go through an intermediate bitmap or raster layer anyway for blend modes to work. The window itself is opaque so there's no way to differentiate pixels drawn by A vs what's behind
s

spierce7

06/22/2022, 4:19 PM
How would I draw
A
to an intermediate bitmap, or raster layer?
3 Views