util

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 5 Imported by: 19

Documentation

Overview

Package util provides various helper functions for the package bild.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrayImageEqual

func GrayImageEqual(a, b *image.Gray) bool

GrayImageEqual returns true if the parameter images a and b match or false if otherwise.

func HSLToRGB added in v0.7.0

func HSLToRGB(h, s, l float64) color.RGBA

HSLToRGB converts from HSL to RGB color model. Parameter h is the hue and its range is from 0 to 360 degrees. Parameter s is the saturation and its range is from 0.0 to 1.0. Parameter l is the lightness and its range is from 0.0 to 1.0.

func HSVToRGB added in v0.7.0

func HSVToRGB(h, s, v float64) color.RGBA

HSVToRGB converts from HSV to RGB color model. Parameter h is the hue and its range is from 0 to 360 degrees. Parameter s is the saturation and its range is from 0.0 to 1.0. Parameter v is the value and its range is from 0.0 to 1.0.

func RGBAImageEqual

func RGBAImageEqual(a, b *image.RGBA) bool

RGBAImageEqual returns true if the parameter images a and b match or false if otherwise.

func RGBASlicesEqual

func RGBASlicesEqual(a, b []color.RGBA) bool

RGBASlicesEqual returns true if the parameter RGBA color slices a and b match or false if otherwise.

func RGBAToString

func RGBAToString(img *image.RGBA) string

RGBAToString returns a string representation of the Hex values contained in an image.RGBA.

func RGBToHSL added in v0.7.0

func RGBToHSL(c color.RGBA) (float64, float64, float64)

RGBToHSL converts from RGB to HSL color model. Parameter c is the RGBA color and must implement the color.RGBA interface. Returned values h, s and l correspond to the hue, saturation and lightness. The hue is of range 0 to 360 and the saturation and lightness are of range 0.0 to 1.0.

func RGBToHSV added in v0.7.0

func RGBToHSV(c color.RGBA) (h, s, v float64)

RGBToHSV converts from RGB to HSV color model. Parameter c is the RGBA color and must implement the color.RGBA interface. Returned values h, s and v correspond to the hue, saturation and value. The hue is of range 0 to 360 and the saturation and value are of range 0.0 to 1.0.

func Rank

func Rank(c color.RGBA) float64

Rank a color based on a color perception heuristic.

func SortRGBA

func SortRGBA(data []color.RGBA, min, max int)

SortRGBA sorts a slice of RGBA values. Parameter min and max correspond to the start and end slice indices that determine the range to be sorted.

Types

type Stack added in v0.9.0

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

Stack implementation for arbitrary data types with Push(), Pop() and Len() functions

func (*Stack) Len added in v0.9.0

func (s *Stack) Len() int

Len returns the size of stack

func (*Stack) Pop added in v0.9.0

func (s *Stack) Pop() interface{}

Pop the most recently pushed value from the stack

func (*Stack) Push added in v0.9.0

func (s *Stack) Push(value interface{})

Push a new value onto the stack

Jump to

Keyboard shortcuts

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