Documentation
¶
Index ¶
- func ScaleRectangleBySize(rect image.Rectangle, size image.Point, limit image.Rectangle) image.Rectangle
- func UnionPoints(pts ...image.Point) image.Rectangle
- func UnionRectangles(rs ...image.Rectangle) image.Rectangle
- type Point2f
- func (p Point2f) Add(q Point2f) Point2f
- func (p Point2f) Div(k float32) Point2f
- func (p Point2f) Eq(q Point2f) bool
- func (p Point2f) In(r Rectangle2f) bool
- func (p Point2f) Mod(r image.Rectangle) image.Point
- func (p Point2f) Mul(k float32) Point2f
- func (p Point2f) RoundPoint() image.Point
- func (p Point2f) String() string
- func (p Point2f) Sub(q Point2f) Point2f
- type Rectangle2f
- func (r Rectangle2f) Add(p Point2f) Rectangle2f
- func (r Rectangle2f) At(x, y float32) color.Color
- func (r Rectangle2f) Bounds() Rectangle2f
- func (r Rectangle2f) Canon() Rectangle2f
- func (r Rectangle2f) ColorModel() color.Model
- func (r Rectangle2f) Dx() float32
- func (r Rectangle2f) Dy() float32
- func (r Rectangle2f) Empty() bool
- func (r Rectangle2f) Eq(s Rectangle2f) bool
- func (r Rectangle2f) In(s Rectangle2f) bool
- func (r Rectangle2f) Inset(n float32) Rectangle2f
- func (r Rectangle2f) Intersect(s Rectangle2f) Rectangle2f
- func (r Rectangle2f) Overlaps(s Rectangle2f) bool
- func (r Rectangle2f) RGBA64At(x, y float32) color.RGBA64
- func (r Rectangle2f) RoundRectangle() image.Rectangle
- func (r Rectangle2f) ScaleByFactor(factor Point2f) Rectangle2f
- func (r Rectangle2f) Size() Point2f
- func (r Rectangle2f) String() string
- func (r Rectangle2f) Sub(p Point2f) Rectangle2f
- func (r Rectangle2f) Union(s Rectangle2f) Rectangle2f
- func (r Rectangle2f) UnionPoints(pts ...Point2f) Rectangle2f
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScaleRectangleBySize ¶ added in v1.2.30
func ScaleRectangleBySize(rect image.Rectangle, size image.Point, limit image.Rectangle) image.Rectangle
ScaleRectangleBySize scale rect to size flexible in limit
func UnionPoints ¶
UnionPoints returns the smallest rectangle that contains all points.
Types ¶
type Point2f ¶ added in v1.2.24
type Point2f struct {
X, Y float32
}
A Point2f is an X, Y coordinate pair. The axes increase right and down.
func (Point2f) In ¶ added in v1.2.24
func (p Point2f) In(r Rectangle2f) bool
In reports whether p is in r.
func (Point2f) Mod ¶ added in v1.2.24
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 (Point2f) RoundPoint ¶ added in v1.2.24
type Rectangle2f ¶ added in v1.2.24
type Rectangle2f struct {
Min, Max Point2f
}
var ZR2f Rectangle2f
ZR2f is the zero Rectangle2f.
Deprecated: Use a literal image.Rectangle2f{} instead.
func Rect2f ¶ added in v1.2.24
func Rect2f(x0, y0, x1, y1 float32) Rectangle2f
Rect2f is shorthand for Rectangle2f{Pt(x0, y0), Pt(x1, y1)}. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func Rect2fFromRect ¶ added in v1.2.30
func Rect2fFromRect(rect image.Rectangle) Rectangle2f
func (Rectangle2f) Add ¶ added in v1.2.24
func (r Rectangle2f) Add(p Point2f) Rectangle2f
Add returns the rectangle r translated by p.
func (Rectangle2f) At ¶ added in v1.2.24
func (r Rectangle2f) At(x, y float32) color.Color
At implements the Image interface.
func (Rectangle2f) Bounds ¶ added in v1.2.24
func (r Rectangle2f) Bounds() Rectangle2f
Bounds implements the Image interface.
func (Rectangle2f) Canon ¶ added in v1.2.24
func (r Rectangle2f) Canon() Rectangle2f
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 (Rectangle2f) ColorModel ¶ added in v1.2.24
func (r Rectangle2f) ColorModel() color.Model
ColorModel implements the Image interface.
func (Rectangle2f) Empty ¶ added in v1.2.24
func (r Rectangle2f) Empty() bool
Empty reports whether the rectangle contains no points.
func (Rectangle2f) Eq ¶ added in v1.2.24
func (r Rectangle2f) Eq(s Rectangle2f) bool
Eq reports whether r and s contain the same set of points. All empty rectangles are considered equal.
func (Rectangle2f) In ¶ added in v1.2.24
func (r Rectangle2f) In(s Rectangle2f) bool
In reports whether every point in r is in s.
func (Rectangle2f) Inset ¶ added in v1.2.24
func (r Rectangle2f) Inset(n float32) Rectangle2f
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 (Rectangle2f) Intersect ¶ added in v1.2.24
func (r Rectangle2f) Intersect(s Rectangle2f) Rectangle2f
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 (Rectangle2f) Overlaps ¶ added in v1.2.24
func (r Rectangle2f) Overlaps(s Rectangle2f) bool
Overlaps reports whether r and s have a non-empty intersection.
func (Rectangle2f) RGBA64At ¶ added in v1.2.24
func (r Rectangle2f) RGBA64At(x, y float32) color.RGBA64
RGBA64At implements the RGBA64Image interface.
func (Rectangle2f) RoundRectangle ¶ added in v1.2.25
func (r Rectangle2f) RoundRectangle() image.Rectangle
func (Rectangle2f) ScaleByFactor ¶ added in v1.2.30
func (r Rectangle2f) ScaleByFactor(factor Point2f) Rectangle2f
ScaleByFactor scale rect to factor*size
func (Rectangle2f) Size ¶ added in v1.2.24
func (r Rectangle2f) Size() Point2f
Size returns r's width and height.
func (Rectangle2f) String ¶ added in v1.2.24
func (r Rectangle2f) String() string
String returns a string representation of r like "(3,4)-(6,5)".
func (Rectangle2f) Sub ¶ added in v1.2.24
func (r Rectangle2f) Sub(p Point2f) Rectangle2f
Sub returns the rectangle r translated by -p.
func (Rectangle2f) Union ¶ added in v1.2.24
func (r Rectangle2f) Union(s Rectangle2f) Rectangle2f
Union returns the smallest rectangle that contains both r and s.
func (Rectangle2f) UnionPoints ¶ added in v1.2.30
func (r Rectangle2f) UnionPoints(pts ...Point2f) Rectangle2f
UnionPoints returns the smallest rectangle that contains all points.