ucolor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package ucolor extends image/color.

Index

Constants

This section is empty.

Variables

View Source
var (
	HSVModel  color.Model = color.ModelFunc(hsvModel)
	HSVAModel color.Model = color.ModelFunc(hsvaModel)
)

Functions

func Premultiply added in v0.3.0

func Premultiply(ur, ug, ub, ua uint32) (r, g, b, a uint32)

Premultiply applies alpha-premultiplication that colors must apply as per color.Color.RGBA. This is an intrinsically lossy proccess.

func ToRGBA

func ToRGBA(c color.Color) color.RGBA

ToRGBA converts any color to a color.RGBA value.

func Transparent

func Transparent(c color.Color) bool

Transparent returns whether or not a color has transparency.

func Unpremultiply added in v0.3.0

func Unpremultiply(r, g, b, a uint32) (ur, ug, ub, ua uint32)

Unpremultiply reverses alpha-premultiplication that colors must apply as per color.Color.RGBA. This may or may not return the precise original color.

Types

type HSV added in v0.3.0

type HSV struct {
	H float64
	S float64
	V float64
}

HSV represents a color with hue, saturation, and value components. Each component C is in range 0 <= C <= 1.

func (HSV) Canon added in v0.3.0

func (hsv HSV) Canon() HSV

Canon returns the color but with the H, S, and V fields are constrained to the range 0.0-1.0

func (HSV) RGBA added in v0.3.0

func (hsv HSV) RGBA() (r, g, b, a uint32)

type HSVA added in v0.3.0

type HSVA struct {
	H float64
	S float64
	V float64
	A uint16
}

HSVA is an HSV color with an added 8-bit alpha component. The alpha component ranges from 0x0000 (fully transparent) to 0xFFFF (opaque), and has no bearing on the other components.

func (HSVA) Canon added in v0.3.0

func (hsva HSVA) Canon() HSVA

Canon returns the color but with the H, S, and V fields are constrained to the range 0.0-1.0

func (HSVA) RGBA added in v0.3.0

func (hsva HSVA) RGBA() (r, g, b, a uint32)

Jump to

Keyboard shortcuts

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