Documentation ¶
Index ¶
- type Number
- type Point
- func (p Point[V]) Add(q Point[V]) Point[V]
- func (p Point[V]) Div(k V) Point[V]
- func (p Point[V]) Eq(q Point[V]) bool
- func (p Point[V]) In(r Rectangle[V]) bool
- func (p Point[V]) Mod(r Rectangle[V]) Point[V]
- func (p Point[V]) Mul(k V) Point[V]
- func (p Point[V]) Std() image.Point
- func (p Point[V]) String() string
- func (p Point[V]) Sub(q Point[V]) Point[V]
- func (p Point[V]) XY() (V, V)
- type Rectangle
- func (r Rectangle[V]) Add(p Point[V]) Rectangle[V]
- func (r Rectangle[V]) At(x, y V) color.Color
- func (r Rectangle[V]) Bounds() Rectangle[V]
- func (r Rectangle[V]) Canon() Rectangle[V]
- func (r Rectangle[V]) ColorModel() color.Model
- func (r Rectangle[V]) Dx() V
- func (r Rectangle[V]) Dy() V
- func (r Rectangle[V]) Empty() bool
- func (r Rectangle[V]) Eq(s Rectangle[V]) bool
- func (r Rectangle[V]) In(s Rectangle[V]) bool
- func (r Rectangle[V]) Inset(n V) Rectangle[V]
- func (r Rectangle[V]) Intersect(s Rectangle[V]) Rectangle[V]
- func (r Rectangle[V]) Overlaps(s Rectangle[V]) bool
- func (r Rectangle[V]) RGBA64At(x, y V) color.RGBA64
- func (r Rectangle[V]) Size() Point[V]
- func (p Rectangle[V]) Std() image.Rectangle
- func (r Rectangle[V]) String() string
- func (r Rectangle[V]) Sub(p Point[V]) Rectangle[V]
- func (r Rectangle[V]) Union(s Rectangle[V]) Rectangle[V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Number ¶
type Number interface { constraints.Integer | constraints.Float }
Number interface by combining the exp/contraints' Integer and Float
type Point ¶
type Point[V Number] struct { X, Y V }
A Point is an X, Y coordinate pair. The axes increase right and down.
func (Point[V]) Mod ¶
Mod returns the point q in r such that p.X-q.X is a multiple of r's width and p.Y-q.Y is a multiple of r's height.
func (Point[V]) Std ¶
Std returns the point as the standard package's image.Point type by a simple cast of X and Y to an int.
type Rectangle ¶
A Rectangle contains the points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y. It is well-formed if Min.X <= Max.X and likewise for Y. Points are always well-formed. A rectangle's methods always return well-formed outputs for well-formed inputs.
A Rectangle is also an [Image] whose bounds are the rectangle itself. At returns color.Opaque for points in the rectangle and color.Transparent otherwise.
func Rect ¶
Rect is shorthand for Rectangle{Pt(x0, y0), Pt(x1, y1)}. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func (Rectangle[V]) Canon ¶
Canon returns the canonical version of r. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func (Rectangle[V]) ColorModel ¶
ColorModel implements the [Image] interface.
func (Rectangle[V]) Eq ¶
Eq reports whether r and s contain the same set of points. All empty rectangles are considered equal.
func (Rectangle[V]) Inset ¶
Inset returns the rectangle r inset by n, which may be negative. If either of r's dimensions is less than 2*n then an empty rectangle near the center of r will be returned.
func (Rectangle[V]) Intersect ¶
Intersect returns the largest rectangle contained by both r and s. If the two rectangles do not overlap then the zero rectangle will be returned.
func (Rectangle[V]) Std ¶
Std returns the rectangle as the standard package's image.Rectangle type by a simple cast of the two points' X and Y to ints.