mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
op/clip: move Rect to shapes.go
It's a specialized shape like the others. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -387,19 +387,3 @@ func (o Outline) Op() Op {
|
||||
outline: true,
|
||||
}
|
||||
}
|
||||
|
||||
// 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() Op {
|
||||
return Op{
|
||||
bounds: image.Rectangle(r),
|
||||
outline: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Add the clip operation.
|
||||
func (r Rect) Add(ops *op.Ops) {
|
||||
r.Op().Add(ops)
|
||||
}
|
||||
|
||||
@@ -3,10 +3,28 @@
|
||||
package clip
|
||||
|
||||
import (
|
||||
"image"
|
||||
|
||||
"gioui.org/f32"
|
||||
"gioui.org/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() Op {
|
||||
return Op{
|
||||
bounds: image.Rectangle(r),
|
||||
outline: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Add the clip operation.
|
||||
func (r Rect) Add(ops *op.Ops) {
|
||||
r.Op().Add(ops)
|
||||
}
|
||||
|
||||
// UniformRRect returns an RRect with all corner radii set to the
|
||||
// provided radius.
|
||||
func UniformRRect(rect f32.Rectangle, radius float32) RRect {
|
||||
|
||||
Reference in New Issue
Block a user