假设我在Compose中有以下代码.
一个背景洋红色圆圈,上面有一个默认黑色的文本.
我想将文本 colored颜色 混合为白色,当它在圆圈上方时.
Canvas(
modifier = Modifier.size(256.dp),
onDraw = {
drawCircle(
color = Color.Magenta,
radius = 50f,
center = Offset(
x = size.width / 2,
y = size.height / 2),
)
val textSize = textMeasurer.measure(text = AnnotatedString("A"))
drawText(
textMeasurer = textMeasurer,
text = "A",
style = TextStyle(
color = Color.Black,
fontSize = 14.sp
),
topLeft = Offset(
x = size.width / 2 - 100f - (textSize.size.width / 2),
y = size.height / 2 - (textSize.size.height / 2)
)
)
drawText(
textMeasurer = textMeasurer,
text = "B",
style = TextStyle(
color = Color.Black,
fontSize = 14.sp
),
topLeft = Offset(
x = size.width / 2 - (textSize.size.width / 2),
y = size.height / 2 - (textSize.size.height / 2)
)
)
}
)
我试过在Cirle上使用BlendMode,有很多不同的配置,但我无法让它工作.而draText没有我能看到的混合模式.
有没有一种简单的方法来实现混合,使圆圈上方的文本变白?