image

package
v1.2.117 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScaleLineSegment added in v1.2.70

func ScaleLineSegment(segment image.Point, length int, limit image.Point) image.Point

ScaleLineSegment segment's size to length flexible in limit

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

func UnionPoints(pts ...image.Point) image.Rectangle

UnionPoints returns the smallest rectangle that contains all points. an empty rectangle is a empty set, Not a point

func UnionRectangles

func UnionRectangles(rs ...image.Rectangle) image.Rectangle

UnionRectangles returns the smallest rectangle that contains all rectangles, empty rectangles excluded.

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.

var ZP2f Point2f

ZP2f is the zero Point2f.

Deprecated: Use a literal image.Point2f{} instead.

func Pt2f added in v1.2.24

func Pt2f(X, Y float32) Point2f

Pt2f is shorthand for Point2f{X, Y}.

func (Point2f) Add added in v1.2.24

func (p Point2f) Add(q Point2f) Point2f

Add returns the vector p+q.

func (Point2f) Div added in v1.2.24

func (p Point2f) Div(k float32) Point2f

Div returns the vector p/k.

func (Point2f) Eq added in v1.2.24

func (p Point2f) Eq(q Point2f) bool

Eq reports whether p and q are equal.

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

func (p Point2f) Mod(r image.Rectangle) image.Point

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) Mul added in v1.2.24

func (p Point2f) Mul(k float32) Point2f

Mul returns the vector p*k.

func (Point2f) RoundPoint added in v1.2.24

func (p Point2f) RoundPoint() image.Point

func (Point2f) String added in v1.2.24

func (p Point2f) String() string

String returns a string representation of p like "(3,4)".

func (Point2f) Sub added in v1.2.24

func (p Point2f) Sub(q Point2f) Point2f

Sub returns the vector p-q.

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) Dx added in v1.2.24

func (r Rectangle2f) Dx() float32

Dx returns r's width.

func (Rectangle2f) Dy added in v1.2.24

func (r Rectangle2f) Dy() float32

Dy returns r's height.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL