common

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MistyRose        = color.RGBA{R: 0xFF, G: 0xE4, B: 0xE1, A: 0xFF}
	DarkSalmon       = color.RGBA{R: 0xE9, G: 0x96, B: 0x7A, A: 0xFF}
	Tan              = color.RGBA{R: 0xD2, G: 0xB4, B: 0x8C, A: 0xFF}
	Bisque           = color.RGBA{R: 0xFF, G: 0xE4, B: 0xC4, A: 0xFF}
	Mintcream        = color.RGBA{R: 0xF5, G: 0xFF, B: 0xFA, A: 0xFF}
	Aquamarine       = color.RGBA{R: 0x7F, G: 0xFF, B: 0xD4, A: 0xFF}
	Azure            = color.RGBA{R: 0xF0, G: 0xFF, B: 0xFF, A: 0xFF}
	Lavender         = color.RGBA{R: 0xE6, G: 0xE6, B: 0xFA, A: 0xFF}
	Plum             = color.RGBA{R: 0xDD, G: 0xA0, B: 0xDD, A: 0xFF}
	AntiqueWhite     = color.RGBA{R: 0xFA, G: 0xEB, B: 0xD7, A: 0xFF}
	NavajoWhite      = color.RGBA{R: 0xFF, G: 0xDE, B: 0xAD, A: 0xFF}
	Moccasin         = color.RGBA{R: 0xFF, G: 0xE4, B: 0xB5, A: 0xFF}
	MediumAquamarine = color.RGBA{R: 0x66, G: 0xCD, B: 0xAA, A: 0xFF}
	PaleTurquoise    = color.RGBA{R: 0xAF, G: 0xEE, B: 0xEE, A: 0xFF}
	LightPink        = color.RGBA{R: 0xFF, G: 0xB6, B: 0xC1, A: 0xFF}
	Tomato           = color.RGBA{R: 0xFF, G: 0x63, B: 0x47, A: 0xFF}
	Orange           = color.RGBA{R: 0xFF, G: 0xA5, A: 0xFF}
	Black            = color.RGBA{A: 0xFF}
	White            = color.RGBA{R: 0xFF, G: 0xFF, B: 0xFF, A: 0xFF}
	LightGray        = color.RGBA{R: 200, G: 200, B: 200, A: 255}
	Outdoors         = []color.RGBA{
		{67, 110, 165, 255},
		{47, 76, 114, 255},
		{165, 138, 3, 255},
		{242, 182, 4, 255},
		{191, 131, 59, 255},
	}
	Reddery = []color.RGBA{
		{89, 2, 16, 255},
		{37, 2, 5, 255},
		{186, 7, 55, 255},
		{253, 55, 51, 255},
		{245, 169, 167, 255},
	}
	DarkPink = []color.RGBA{
		{2, 64, 89, 255},
		{242, 131, 107, 255},
		{140, 40, 31, 255},
		{191, 69, 57, 255},
		{13, 13, 13, 255},
	}

	DarkRed = []color.RGBA{
		{48, 19, 21, 255},
		{71, 15, 16, 255},
		{92, 10, 12, 255},
		{115, 5, 4, 255},
		{139, 0, 3, 255},
		{163, 32, 1, 255},
		{185, 66, 0, 255},
		{208, 98, 1, 255},
		{231, 133, 0, 255},
		{254, 165, 0, 255},
	}

	Sleek = []color.RGBA{
		{R: 0x2C, G: 0x35, B: 0x31, A: 0xFF},
		{R: 0x11, G: 0x64, B: 0x66, A: 0xFF},
		{R: 0xD9, G: 0xB0, B: 0x8C, A: 0xFF},
		{R: 0xFF, G: 0xCB, B: 0x9A, A: 0xFF},
		{R: 0xD1, G: 0xE8, B: 0xE2, A: 0xFF},
	}

	Energetic = []color.RGBA{
		{R: 0x56, G: 0x80, B: 0xE9, A: 0xFF},
		{R: 0x84, G: 0xCE, B: 0xEB, A: 0xFF},
		{R: 0x5A, G: 0x89, B: 0xEA, A: 0xFF},
		{R: 0xC1, G: 0xC8, B: 0xEA, A: 0xFF},
		{R: 0x88, G: 0x60, B: 0xD0, A: 0xFF},
	}

	Youthful = []color.RGBA{
		{R: 0xA6, G: 0x4A, B: 0xC9, A: 0xFF},
		{R: 0xFC, G: 0xCD, B: 0x04, A: 0xFF},
		{R: 0xFF, G: 0xB4, B: 0x8F, A: 0xFF},
		{R: 0xF5, G: 0xE6, B: 0xCC, A: 0xFF},
		{R: 0x17, G: 0xE9, B: 0xE0, A: 0xFF},
	}

	PinkPastel = []color.RGBA{
		{R: 0xA1, G: 0xC3, B: 0xD1, A: 0xFF},
		{R: 0xB3, G: 0x9B, B: 0xC8, A: 0xFF},
		{R: 0xF0, G: 0xEB, B: 0xF4, A: 0xFF},
		{R: 0xF1, G: 0x72, B: 0xA1, A: 0xFF},
		{R: 0xE6, G: 0x43, B: 0x98, A: 0xFF},
	}

	Citrus = []color.RGBA{
		{R: 0x1F, G: 0x26, B: 0x05, A: 0xFF},
		{R: 0x1F, G: 0x65, B: 0x21, A: 0xFF},
		{R: 0x53, G: 0x90, B: 0x0F, A: 0xFF},
		{R: 0xA4, G: 0xA7, B: 0x1E, A: 0xFF},
		{R: 0xD6, G: 0xCE, B: 0x15, A: 0xFF},
	}

	Cheerful = []color.RGBA{
		{R: 0xFB, G: 0xE8, B: 0xA6, A: 0xFF},
		{R: 0xF4, G: 0x97, B: 0x6C, A: 0xFF},
		{R: 0x30, G: 0x3C, B: 0x6C, A: 0xFF},
		{R: 0xB4, G: 0xDF, B: 0xE5, A: 0xFF},
		{R: 0xD2, G: 0xFD, B: 0xFF, A: 0xFF},
	}

	Earthy = []color.RGBA{
		{R: 0x8D, G: 0x87, B: 0x41, A: 0xFF},
		{R: 0xF4, G: 0x97, B: 0x6C, A: 0xFF},
		{R: 0x30, G: 0x3C, B: 0x6C, A: 0xFF},
		{R: 0xB4, G: 0xDF, B: 0xE5, A: 0xFF},
		{R: 0xD2, G: 0xFD, B: 0xFF, A: 0xFF},
	}
)

Functions

func Blend

func Blend(src, dest *image.RGBA, mode BlendMode) *image.RGBA

func Constrain

func Constrain(val, low, high float64) float64

Constrain returns a value between a minimum and maximum value.

func ConstrainInt

func ConstrainInt(val, low, high int) int

ConstrainInt returns a int value between a minimum and maximum value.

func ConvertCartesianToPixel

func ConvertCartesianToPixel(x, y, xaixs, yaixs float64, h, w int) (int, int)

ConvertCartesianToPixel converts cartesian coordinates to actual pixels in an image.

func ConvertCartesianToPolar

func ConvertCartesianToPolar(x, y float64) (float64, float64)

ConvertCartesianToPolar converts points from cartesian coordinates to polar coordinates.

func ConvertCartesianToPolarPixel

func ConvertCartesianToPolarPixel(x, y, xaixs, yaixs float64, h, w int) (int, int)

func ConvertPolarToPixel

func ConvertPolarToPixel(r, theta, xaixs, yaixs float64, h, w int) (int, int)

ConvertPolarToPixel converts polar coordinates to actual pixels in an image.

func Distance

func Distance(x1, y1, x2, y2 float64) float64

Distance returns the Euclidean distance between two point on 2D dimension.

func LerpColor

func LerpColor(c1, c2 color.RGBA, ratio float64) color.RGBA

LerpColor blends two colors to find a third color somewhere between them.

func Magnitude

func Magnitude(x, y float64) float64

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func RandomGaussian

func RandomGaussian(mean, std float64) float64

RandomGaussian returns a gaussian random float64 number.

func RandomRangeFloat64

func RandomRangeFloat64(min, max float64) float64

RandomRangeFloat64 returns a float64 number between min and max.

func RandomRangeInt

func RandomRangeInt(min, max int) int

RandomRangeInt returns a integer number between min and max.

func Remap

func Remap(n, start1, stop1, start2, stop2 float64) float64

Remap re-maps a number from one range to another.

Types

type BlendMode

type BlendMode int
const (
	Add BlendMode = iota
)

type HSV

type HSV struct {
	H, S, V int
}

func (HSV) ToRGB

func (hs HSV) ToRGB(mh, ms, mv int) color.RGBA

ToRGB converts a HSV color mode to RGB mode mh, ms, mv are used to set the maximum number for HSV.

type PerlinNoise

type PerlinNoise struct {
	// contains filtered or unexported fields
}

PerlinNoise is a perlin noise struct to generate perlin noise.

func NewPerlinNoise

func NewPerlinNoise() *PerlinNoise

NewPerlinNoise returns a PerlinNoise object.

func (*PerlinNoise) Noise1D

func (p *PerlinNoise) Noise1D(x float64) float64

Noise1D returns a float noise number on one dimension.

func (*PerlinNoise) Noise2D

func (p *PerlinNoise) Noise2D(x, y float64) float64

Noise2D returns a float noise number on two dimensions.

func (*PerlinNoise) Noise3D

func (p *PerlinNoise) Noise3D(x, y, z float64) float64

Noise3D returns a float noise number on three dimensions.

type Rect

type Rect struct {
	// contains filtered or unexported fields
}

func NewRect

func NewRect(x, y, w, h float64) *Rect

func (Rect) H

func (r Rect) H() float64

func (Rect) W

func (r Rect) W() float64

func (Rect) X

func (r Rect) X() float64

func (Rect) Y

func (r Rect) Y() float64

type Vector

type Vector struct {
	X, Y float64
}

func NewVector

func NewVector(x, y float64) *Vector

func (*Vector) Multiple

func (v *Vector) Multiple(z float64)

func (*Vector) Normalize

func (v *Vector) Normalize()

func (*Vector) SetMag

func (v *Vector) SetMag(m float64)

Jump to

Keyboard shortcuts

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