util

package
v0.0.0-...-b2d8a4d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Debug = 1

Debugging

Variables

This section is empty.

Functions

func DPrintf

func DPrintf(format string, a ...interface{}) (n int, err error)

func DecodeImage

func DecodeImage(data string) (image.Image, error)

DecodeImage decodes a base64 and returns an image

func EncodeImage

func EncodeImage(img image.Image) (string, error)

EncodeImage encodes an image as png base64 string

func GetImageDimensions

func GetImageDimensions(img image.Image) (int, int)

func GetRandomImage

func GetRandomImage() image.Image

func GetSubImage

func GetSubImage(img image.Image, rect image.Rectangle) image.Image

func GrayImg

func GrayImg(img image.Image) *image.Gray

func ImgDiff

func ImgDiff(ai, bi, e image.Image) float64

func RandomColor

func RandomColor(rng *rand.Rand) color.RGBA

func RandomColorFromPalette

func RandomColorFromPalette(rng *rand.Rand, palette []color.RGBA) color.RGBA

func RandomRadius

func RandomRadius(rng *rand.Rand, radius float64) float64

func RandomRotation

func RandomRotation(rng *rand.Rand) float64

func RgbaImg

func RgbaImg(img image.Image) *image.RGBA

func SquareDifference

func SquareDifference(x, y float64) float64

Types

type Image

type Image struct {
	Image  image.Image
	Width  int
	Height int
}

type Vector

type Vector struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

func RandomVector

func RandomVector(rng *rand.Rand, bounds Vector, scale int) Vector

Jump to

Keyboard shortcuts

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