diff --git a/orx-shapes/src/main/kotlin/RoundedRectangle.kt b/orx-shapes/src/main/kotlin/RoundedRectangle.kt index 29d4a196..4c88a302 100644 --- a/orx-shapes/src/main/kotlin/RoundedRectangle.kt +++ b/orx-shapes/src/main/kotlin/RoundedRectangle.kt @@ -1,3 +1,4 @@ +import org.openrndr.draw.Drawer import org.openrndr.math.Vector2 import org.openrndr.shape.contour import kotlin.math.min @@ -33,4 +34,13 @@ class RoundedRectangle(val corner: Vector2, val width: Double, val height: Doubl curveTo(Vector2(x, y), Vector2(x + r, y)) close() } -} \ No newline at end of file +} + +fun Drawer.roundedRectangle(x: Double, y: Double, width: Double, height: Double, radius: Double) = + contour(RoundedRectangle(x, y, width, height, radius).contour) + +fun Drawer.roundedRectangle(position: Vector2, width: Double, height: Double, radius: Double) = + contour(RoundedRectangle(position, width, height, radius).contour) + +fun Drawer.roundedRectangle(roundedRectangle: RoundedRectangle) = + contour(roundedRectangle.contour) \ No newline at end of file