utils

package
v0.0.0-...-bbf78bc Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x int) int

func BiLERP

func BiLERP(p1, p2, p3, p4, alpha, beta float64) float64

BiLERP is a bilinear interpolation function

func Clamp

func Clamp(x, min, max float64) float64

func ClampUint16

func ClampUint16(x float64) float64

ClampUint16 returns given value clamped into uint16 range

func ClampUint32

func ClampUint32(x float64) float64

ClampUint32 returns given value clamped into uint32 range

func ClampUint64

func ClampUint64(x float64) float64

ClampUint64 returns given value clamped into uint64 range

func ClampUint8

func ClampUint8(x float64) float64

ClampUint8 returns given value clamped into uint8 range

func CreateBackground

func CreateBackground(bounds image.Rectangle, col color.Color) image.Image

CreateBackground returns an image with the given size and a monochrome background of the given color

func CreateRGBA

func CreateRGBA(bounds image.Rectangle) image.Image

CreateRGBA returns an image with the given size

func EaseInCubic

func EaseInCubic(t float64) float64

EaseInCubic based on https://gist.github.com/gre/1650294

func EaseInLinear

func EaseInLinear(t float64) float64

EaseInLinear based on https://gist.github.com/gre/1650294

func EaseInOutCubic

func EaseInOutCubic(t float64) float64

EaseInOutCubic based on https://gist.github.com/gre/1650294

func EaseInOutQuad

func EaseInOutQuad(t float64) float64

EaseInOutQuad based on https://gist.github.com/gre/1650294

func EaseInOutQuart

func EaseInOutQuart(t float64) float64

EaseInOutQuart based on https://gist.github.com/gre/1650294

func EaseInQuad

func EaseInQuad(t float64) float64

EaseInQuad based on https://gist.github.com/gre/1650294

func EaseInQuart

func EaseInQuart(t float64) float64

EaseInQuart based on https://gist.github.com/gre/1650294

func EaseOutCubic

func EaseOutCubic(t float64) float64

EaseOutCubic based on https://gist.github.com/gre/1650294

func EaseOutLinear

func EaseOutLinear(t float64) float64

EaseOutLinear based on https://gist.github.com/gre/1650294

func EaseOutQuad

func EaseOutQuad(t float64) float64

EaseOutQuad based on https://gist.github.com/gre/1650294

func EaseOutQuart

func EaseOutQuart(t float64) float64

EaseOutQuart based on https://gist.github.com/gre/1650294

func GeneratePallet

func GeneratePallet(img image.Image, numColors int) []color.Color

GeneratePallet generates a pallet for the given image with the given maximum number of colors

func LERP

func LERP(p1, p2, alpha float64) float64

LERP is a linear interpolation function

func Max

func Max(x, y int) int

func Min

func Min(x, y int) int

func PixelBiLERP

func PixelBiLERP(p1, p2, p3, p4 color.Color, alpha, beta float64) color.Color

PixelBiLERP is an application of BiLERP on each color channel

func PixelLERP

func PixelLERP(p1, p2 color.Color, alpha float64) color.Color

PixelLERP is an application of LERP on each color channel

Types

type EasingFunction

type EasingFunction func(t float64) float64

EasingFunction returns a value between 0 and 1 for a given factor between 0 and 1

func MirrorSpike

func MirrorSpike(f EasingFunction) EasingFunction

MirrorSpike returns a spike function with the maximum in the middle

func Spike

func Spike(threshold float64, f EasingFunction) EasingFunction

Spike returns a spike function with the given threshold for them maximum value and an EasingFunction for the 2 parts

func Step

func Step(threshold float64) EasingFunction

Step returns a step function with the given threshold

func Wave

func Wave(threshold float64, f EasingFunction) EasingFunction

Wave returns a spike function with the shape of a wave

type Kernel

type Kernel [][]float64

Kernel encapsulates the data for a matrix

func (*Kernel) Get

func (m *Kernel) Get(x, y int) float64

Get returns the value on the line y, row x

func (*Kernel) Radius

func (m *Kernel) Radius() int

Radius returns the radius of the Kernel

Jump to

Keyboard shortcuts

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