mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 10:55:35 +00:00
io/pointer,op/clip: remove clip.Circle, pointer.Rect, pointer.Ellipse
They've been deprecated for a while, and gio-x is updated to not use them. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
|||||||
"gioui.org/io/event"
|
"gioui.org/io/event"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/op"
|
"gioui.org/op"
|
||||||
"gioui.org/op/clip"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Event is a pointer event.
|
// Event is a pointer event.
|
||||||
@@ -162,20 +161,6 @@ const (
|
|||||||
ButtonTertiary
|
ButtonTertiary
|
||||||
)
|
)
|
||||||
|
|
||||||
// Rect constructs a rectangular hit area.
|
|
||||||
//
|
|
||||||
// Deprecated: use clip.Rect instead.
|
|
||||||
func Rect(size image.Rectangle) clip.Op {
|
|
||||||
return clip.Rect(size).Op()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ellipse constructs an ellipsoid hit area.
|
|
||||||
//
|
|
||||||
// Deprecated: use clip.Ellipse instead.
|
|
||||||
func Ellipse(size image.Rectangle) clip.Ellipse {
|
|
||||||
return clip.Ellipse(frect(size))
|
|
||||||
}
|
|
||||||
|
|
||||||
// frect converts a rectangle to a f32.Rectangle.
|
// frect converts a rectangle to a f32.Rectangle.
|
||||||
func frect(r image.Rectangle) f32.Rectangle {
|
func frect(r image.Rectangle) f32.Rectangle {
|
||||||
return f32.Rectangle{
|
return f32.Rectangle{
|
||||||
|
|||||||
@@ -115,33 +115,6 @@ func (rr RRect) Path(ops *op.Ops) PathSpec {
|
|||||||
return p.End()
|
return p.End()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Circle represents the clip area of a circle.
|
|
||||||
type Circle struct {
|
|
||||||
Center f32.Point
|
|
||||||
Radius float32
|
|
||||||
}
|
|
||||||
|
|
||||||
// Op returns the op for the filled circle.
|
|
||||||
func (c Circle) Op(ops *op.Ops) Op {
|
|
||||||
return Outline{Path: c.Path(ops)}.Op()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Push the circle clip on the clip stack.
|
|
||||||
func (c Circle) Push(ops *op.Ops) Stack {
|
|
||||||
return c.Op(ops).Push(ops)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Path returns the PathSpec for the circle.
|
|
||||||
//
|
|
||||||
// Deprecated: use Ellipse instead.
|
|
||||||
func (c Circle) Path(ops *op.Ops) PathSpec {
|
|
||||||
b := f32.Rectangle{
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ellipse represents the largest axis-aligned ellipse that
|
// Ellipse represents the largest axis-aligned ellipse that
|
||||||
// is contained in its bounds.
|
// is contained in its bounds.
|
||||||
type Ellipse f32.Rectangle
|
type Ellipse f32.Rectangle
|
||||||
|
|||||||
Reference in New Issue
Block a user