From 5fd4ecb01131da5c70d706976eb2854485b6a323 Mon Sep 17 00:00:00 2001 From: Pierre Curto Date: Tue, 23 Nov 2021 18:24:33 +0100 Subject: [PATCH] clip: add Path method to Ellipse Useful when drawing ellipses with Stroke. Also, this makes it consistent with the other clip operations. Signed-off-by: Pierre Curto --- op/clip/shapes.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/op/clip/shapes.go b/op/clip/shapes.go index 46b9e88e..f361572b 100644 --- a/op/clip/shapes.go +++ b/op/clip/shapes.go @@ -139,7 +139,7 @@ func (c Circle) Path(ops *op.Ops) PathSpec { Min: f32.Pt(c.Center.X-c.Radius, c.Center.Y-c.Radius), Max: f32.Pt(c.Center.X+c.Radius, c.Center.Y+c.Radius), } - return Ellipse(b).path(ops) + return Ellipse(b).Path(ops) } // Ellipse represents the largest axis-aligned ellipse that @@ -148,7 +148,7 @@ type Ellipse f32.Rectangle // Op returns the op for the filled ellipse. func (e Ellipse) Op(ops *op.Ops) Op { - return Outline{Path: e.path(ops)}.Op() + return Outline{Path: e.Path(ops)}.Op() } // Push the filled ellipse clip op on the clip stack. @@ -156,8 +156,8 @@ func (e Ellipse) Push(ops *op.Ops) Stack { return e.Op(ops).Push(ops) } -// path constructs a path for the ellipse. -func (e Ellipse) path(o *op.Ops) PathSpec { +// Path constructs a path for the ellipse. +func (e Ellipse) Path(o *op.Ops) PathSpec { bounds := f32.Rectangle(e) if bounds.Dx() == 0 || bounds.Dy() == 0 { return PathSpec{shape: ops.Rect}