Stylianos Gakis
09/10/2024, 9:43 AMShape
object by having an extension function like private fun Shape.alter(someInput): Shape
, where the impl assumes that it's a Outline.generic so that I can grab its Path
and combine it with another.
return object : Shape {
override fun createOutline(size: Size, layoutDirection: LayoutDirection, density: Density): Outline {
val outline = this@alter.createOutline(size, layoutDirection, density)
val path: Path = (outline as Outline.Generic).path
val extraPath = Path()...
return Outline.Generic(Path.combine(PathOperation.Union, extraPath, path))
}
}
Now I want to be able to support also Outline.Rounded but I can't seem to find the right API to achieve this, if there is one. Any ideas?Stylianos Gakis
09/10/2024, 9:53 AMval squirclePath: Path = when (squircleOutline) {
is Outline.Generic -> squircleOutline.path
is Outline.Rectangle -> Path().apply { addRect(squircleOutline.rect) }
is Outline.Rounded -> Path().apply { addRoundRect(squircleOutline.roundRect) }
}
Actually looks alright