lgraya

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Provides a color.Color type for dealing with premultiplied linear grayscale+alpha colours.

Index

Constants

This section is empty.

Variables

View Source
var Model = helper.Model(Convert)

A color.Model for converting arbitrary colours to a premultiplied linear RGBA Color.

Wraps the Convert function, returning a color.Color interface rather than the Color type.

Functions

func Distance

func Distance(a, b Color) float64

Distance returns the maximum possible euclidean distance between two colours, accounting for the possible backgrounds they might be composited over.

func DistanceSqr

func DistanceSqr(a, b Color) float64

DistanceSqr returns the maximum possible euclidean distance squared between two colours, accounting for the possible backgrounds they might be composited over.

Types

type Color

type Color struct {
	Y, A float64
}

Color is a pre-multiplied linear grayscale+alpha color.Color.

func Convert

func Convert(c color.Color) Color

Convert converts an arbitrary colour type to a premultiplied linear RGBA Color.

func (Color) NLRGBA

func (c Color) NLRGBA() (r, g, b, a float64)

NLRGBA converts to non-premultiplied linear RGBA.

func (Color) NLYA

func (c Color) NLYA() (y, a float64)

NLYA converts to non-premultiplied linear grayscale+alpha.

func (Color) NOkLabA

func (c Color) NOkLabA() (lightness, chromaA, chromaB, a float64)

NOkLabA converts to non-premultiplied OkLab+Alpha.

func (Color) NRGBA

func (c Color) NRGBA() (r, g, b, a uint32)

NRGBA converts to non-premultiplied RGBA.

func (Color) NXYZA

func (c Color) NXYZA() (x, y, z, a float64)

NXYZA converts to non-premultiplied XYZ+Alpha.

func (Color) NYA

func (c Color) NYA() (y, a uint32)

NYA converts to non-premultiplied sRGB grayscale+alpha.

func (Color) RGBA

func (c Color) RGBA() (r, g, b, a uint32)

RGBA converts to premultiplied RGBA, implementing the color.Color interface.

func (Color) YA

func (c Color) YA() (y, a uint32)

YA converts to premultiplied sRGB grayscale+alpha.

Jump to

Keyboard shortcuts

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