mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 02:45:38 +00:00
op/clip: export Op method of clip shapes
This allows passing the resulting clip.Op types into functions that draw shapes. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
+6
-1
@@ -324,7 +324,12 @@ func (p *Path) End() Op {
|
||||
// Rect represents the clip area of a pixel-aligned rectangle.
|
||||
type Rect image.Rectangle
|
||||
|
||||
// Op returns the op for the rectangle.
|
||||
func (r Rect) Op(ops *op.Ops) Op {
|
||||
return Op{bounds: image.Rectangle(r)}
|
||||
}
|
||||
|
||||
// Add the clip operation.
|
||||
func (r Rect) Add(ops *op.Ops) {
|
||||
Op{bounds: image.Rectangle(r)}.Add(ops)
|
||||
r.Op(ops).Add(ops)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user