Anyone have any obvious ideas of how I might accom...
# compose
t
Anyone have any obvious ideas of how I might accomplish cross node Porter-Duff color mixing in compose? Wondering if there is some form of modifier hackery I could use to get things drawn into the same layer or if I would need to do two separate compositions where one is used inside of the canvas so that things can be mixed. sandbox project here: https://github.com/trevjonez/SharedCanvasPoc/tree/master End goal example as an image:
a
Your project isn’t public and I’m not sure what you mean by “cross node Porter-Duff color mixing”, but if you apply
Modifier.graphicsLayer(alpha = 0.99f)
to a composable, it and its children will be drawn into a composition layer so that some `BlendMode`s will work.
t
ahh ty for calling out the repo vis being private, I made it public. So I definitely already have the alpha on for the canvas behavior. what is the right way to blend mode a text composable paint modifier I assume?
a
it and its children will be drawn into a composition layer
You need to either remove the
Canvas
and use
Modifier.graphicsLayer(alpha = 0.99f).drawWithContent { ... }
on the
Text
, or apply
Modifier.graphicsLayer(alpha = 0.99f)
on the parent of the
Text
and the
Canvas
and put the
Text
before the
Canvas
.
t
Ok so moved things around and have some blending happening. now I just need to figure out what goes where for the right effect. BUT, this does prove it can be done. Text composable obviously causing color mixing with the canvas text pixels
Ended up getting it all working yesterday. TY for the help @Albert Chang Updated images on the readme so i can hand it off to my devs to use it.