I'd like to create a component with following result, assuming that the leaf is an existing ImageVector
With the following code:
@Composable
fun MyIcon(
modifier: Modifier = Modifier,
) {
Box(modifier = modifier) {
Image(imageVector = leafImageVector)
Ring( // the part that need to be removed from Image
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(
end = 4.dp,
bottom = 8.dp
),
)
Badge(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(
end = 8.dp,
bottom = 8.dp
),
badgeColor = badgeColor
)
}
}
@Composable
private fun Ring(
modifier: Modifier = Modifier,
) {
Canvas(
modifier = modifier.size(8.dp),
onDraw = {
val strokeWidth = 8f
drawCircle(
color = Color.Black, // Change this to Transparent or Unspecified does not help
radius = 12f,
style = Stroke(
width = strokeWidth
)
)
}
)
}
@Composable
fun Badge(
modifier: Modifier = Modifier,
badgeColor: Color,
) {
Box(
modifier = modifier
.size(8.dp)
.clip(CircleShape)
.background(
badgeColor
)
)
}
The black part is the part I need to be removed from the Image

You can use
BlendMods insideModifier.drawWithContentto remove some part of Composable, it doesn't necessarily need to be Image for this to work. You can clip or cut from any Composable.How to clip or cut a Composable?
You can also draw red circle if you wish to as in example above.