Documentation ¶
Index ¶
- func ComparePixelsExact(imageA *image.RGBA, imageB *image.RGBA, globalBounds image.Rectangle) (float64, error)
- func ComparePixelsWeighted(imageA *image.RGBA, imageB *image.RGBA, globalBounds image.Rectangle) (float64, error)
- func FillSpace(img *image.RGBA, nonTransparentImageBounds image.Rectangle)
- func HorizontalLine(img *image.RGBA, xStart int, xEnd int, y int, c color.Color)
- func InRange(number1 float64, number2 float64, maxRange float64) bool
- func PointCollides(p image.Point, r image.Rectangle) bool
- func ReadImage(path string) (img image.Image, err error)
- func ReadImageFromBytes(imageBytes []byte) (img image.Image, err error)
- func ReadImageFromReader(reader io.Reader) (img image.Image, err error)
- func Rectangle(img *image.RGBA, rectangle image.Rectangle, c color.Color, ...)
- func RectanglesCollide(r1 image.Rectangle, r2 image.Rectangle) bool
- func Scale(img *image.RGBA, bounds image.Rectangle, interpolator draw.Interpolator) image.Image
- func VerticalLine(img *image.RGBA, yStart int, yEnd int, x int, c color.Color)
- func WriteFile(filePath string, reader io.Reader) error
- func WriteImage(img image.Image, writer io.Writer, extension string) (err error)
- func WriteImageToFile(img image.Image, filePath string) error
- type FillConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePixelsExact ¶
func ComparePixelsExact(imageA *image.RGBA, imageB *image.RGBA, globalBounds image.Rectangle) (float64, error)
ComparePixelsExact naively compares two images by checking how many of the pixels between them are identical. It returns a float that ranges between 0 (no matches) and 1 (identical pictures)
func ComparePixelsWeighted ¶
func FillSpace ¶
FillSpace fills everything in img that doesn't fall within nonTransparentImageBounds with the scaled out edges and corners of img when masked by nonTransparentImageBounds
func HorizontalLine ¶
HorizontalLine draws a horizontal line onto an image
func PointCollides ¶
PointCollides returns true if p collides with r
func ReadImage ¶
ReadImage Takes the path to an image file in the file system and returns the decoded image
func ReadImageFromBytes ¶
ReadImageFromBytes that a byte slice and attempts to decode it into an image
func ReadImageFromReader ¶
ReadImageFromReader takes an io.Reader and attempts to decode it into an image
func RectanglesCollide ¶
RectanglesCollide returns true if r1 and r2 collide
func VerticalLine ¶
VerticalLine draws a vertical line onto an image
func WriteImage ¶
WriteImage encodes an image as either PNG or JPEG according to extension and writes it to writer. Note: extension needs to be prepended with a dot.
Types ¶
type FillConfig ¶
type FillConfig struct {
// contains filtered or unexported fields
}