Ch8n
03/04/2021, 6:23 AMjoakim
03/04/2021, 6:32 AMNader Jawad
03/04/2021, 8:40 PM// Configure alpha to almost 1 but not quite 1 to force graphics layer into
// offscreen composition to ensure XOR blends against transparent pixels
// otherwise the contents are drawn directly.
val textColor = Color.Blue
Box(Modifier.fillMaxWidth().wrapContentHeight().graphicsLayer(alpha = 0.99f).drawWithContent {
drawContent()
drawRect(
textColor,
topLeft = Offset(0f, size.height / 2),
size = Size(size.width, size.height / 2),
blendMode = BlendMode.Xor
)
}) {
Text(
"Hello World",
textAlign = TextAlign.Center,
fontSize = 50.sp,
color = textColor
)
}
Colton Idle
03/04/2021, 10:10 PMNader Jawad
03/07/2021, 7:51 PMCan
03/07/2021, 7:52 PMNader Jawad
03/07/2021, 7:55 PMuseCompostingLayer
that can be configured on the graphics layer to do this without having to manipulate alpha to do soCan
03/07/2021, 7:59 PMNader Jawad
03/25/2021, 6:18 PM