diff --git a/op/clip/shapes.go b/op/clip/shapes.go index 456cf191..e8acb6a5 100644 --- a/op/clip/shapes.go +++ b/op/clip/shapes.go @@ -18,10 +18,7 @@ type Rect image.Rectangle func (r Rect) Op() Op { return Op{ outline: true, - path: PathSpec{ - shape: ops.Rect, - bounds: image.Rectangle(r), - }, + path: r.Path(), } } @@ -30,6 +27,14 @@ func (r Rect) Push(ops *op.Ops) Stack { return r.Op().Push(ops) } +// Path returns the PathSpec for the rectangle. +func (r Rect) Path() PathSpec { + return PathSpec{ + shape: ops.Rect, + bounds: image.Rectangle(r), + } +} + // UniformRRect returns an RRect with all corner radii set to the // provided radius. func UniformRRect(rect f32.Rectangle, radius float32) RRect {