Add Drawer extension methods for rounded rectangle
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import org.openrndr.draw.Drawer
|
||||||
import org.openrndr.math.Vector2
|
import org.openrndr.math.Vector2
|
||||||
import org.openrndr.shape.contour
|
import org.openrndr.shape.contour
|
||||||
import kotlin.math.min
|
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))
|
curveTo(Vector2(x, y), Vector2(x + r, y))
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
Reference in New Issue
Block a user