Documentation ¶
Index ¶
- type Point
- type Rectangle
- func (r Rectangle) Add(p Point) Rectangle
- func (r Rectangle) At(x, y int) color.Color
- func (r Rectangle) Bounds() Rectangle
- func (r Rectangle) Canon() Rectangle
- func (r Rectangle) ColorModel() color.Model
- func (r Rectangle) Dx() int
- func (r Rectangle) Dy() int
- func (r Rectangle) Empty() bool
- func (r Rectangle) Eq(s Rectangle) bool
- func (r Rectangle) In(s Rectangle) bool
- func (r Rectangle) Inset(n int) Rectangle
- func (r Rectangle) Intersect(s Rectangle) Rectangle
- func (r Rectangle) Overlaps(s Rectangle) bool
- func (r Rectangle) Size() Point
- func (r Rectangle) Sub(p Point) Rectangle
- func (r Rectangle) Union(s Rectangle) Rectangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Point ¶
type Point struct {
X, Y int
}
A Point is an X, Y coordinate pair. The axes increase right and down.
var ZP Point
ZP is the zero Point.
type Rectangle ¶
type Rectangle struct {
Min, Max Point
}
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.
var ZR Rectangle
ZR is the zero Rectangle.
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) 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) ColorModel ¶
ColorModel implements the Image interface.
func (Rectangle) Eq ¶
Eq reports whether r and s contain the same set of points. All empty rectangles are considered equal.
func (Rectangle) 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) 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.