How to draw a custom
GenericShape or
Shape in general?
Following the
https://foso.github.io/Jetpack-Compose-Playground/cookbook/how_to_create_custom_shape
val shape = GenericShape { size ->
moveTo(size.width / 2f, 0f)
lineTo(size.width, size.height)
lineTo(0f, size.height)
}
After copy pasting the triangle shape (which I'm going to change later), I don't have idea of how to draw it.
Shape seems to be a parameter of
Modifier.border
,
Modifier.drawLayer
, so I tried, but nothing works 😛 :
fun main() =
Window(
title = "Compose for Desktop",
size = IntSize(300, 300),
) {
DesktopMaterialTheme(
colors = lightColors(background = Color.Cyan),
) {
Box(modifier = Modifier.border(5.dp, Color.Cyan, shape))
}
}
Any thoughts?