From 685e0772a3386f27cf730591fe0a88fba93166f0 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Wed, 21 Oct 2020 21:30:38 -0400 Subject: [PATCH] op/clip: add UniformRRect to create rects with uniform corner radii Signed-off-by: Chris Waldon --- op/clip/shapes.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/op/clip/shapes.go b/op/clip/shapes.go index 52091290..5a136619 100644 --- a/op/clip/shapes.go +++ b/op/clip/shapes.go @@ -7,6 +7,18 @@ import ( "gioui.org/op" ) +// UniformRRect returns an RRect with all corner radii set to the +// provided radius. +func UniformRRect(rect f32.Rectangle, radius float32) RRect { + return RRect{ + Rect: rect, + SE: radius, + SW: radius, + NE: radius, + NW: radius, + } +} + // RRect represents the clip area of a rectangle with rounded // corners. //