How to draw a custom <GenericShape> or <Shape> in ...
# compose-desktop
a
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
Copy code
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 😛 :
Copy code
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?
a
or pass it to
Modifier.background
👍 1