Documentation
¶
Index ¶
- func ByteDecoded(v uint8) float32
- func ByteEncoded(v float32) uint8
- func Linear(v float32) float32
- func Linear16(v uint16) float32
- func Linear16AllNew(values []uint16) []float32
- func LinearAll(values []float32)
- func LinearAllNew(values []float32) []float32
- func Linearb(b uint8) float32
- func LinearbAllNew(values []uint8) []float32
- func Standard(v float32) float32
- func Standard16(v float32) uint16
- func Standard16AllNew(values []float32) []uint16
- func StandardAll(values []float32)
- func StandardAllNew(values []float32) []float32
- func Standardb(v float32) uint8
- func StandardbAllNew(values []float32) []uint8
- type RGB
- func (c RGB) Add(other RGB) RGB
- func (c RGB) Alpha(alpha float32) RGBA
- func (c RGB) Blend(other RGB, amount float32) RGB
- func (c RGB) Clamp() RGB
- func (c RGB) Luminance() float32
- func (c RGB) LuminanceCustom(luminanceRed, luminanceGreen, luminanceBlue float32) float32
- func (c RGB) Mul(amount float32) RGB
- func (c RGB) Standard() SRGB
- func (c RGB) Std() color.RGBA64
- func (c RGB) StdN() color.NRGBA64
- func (c RGB) Sub(other RGB) RGB
- type RGBA
- func (c RGBA) Add(other RGBA) RGBA
- func (c RGBA) Add3(other RGB) RGBA
- func (c RGBA) AddC(other RGBA) RGBA
- func (c RGBA) Blend(other RGBA, amount float32) RGBA
- func (c RGBA) Clamp() RGBA
- func (c RGBA) Luminance() float32
- func (c RGBA) LuminanceCustom(luminanceRed, luminanceGreen, luminanceBlue float32) float32
- func (c RGBA) Mul(amount float32) RGBA
- func (c RGBA) Premultiplied() RGBA
- func (c RGBA) RGB() RGB
- func (c RGBA) Standard() SRGBA
- func (c RGBA) Std() color.RGBA64
- func (c RGBA) StdN() color.NRGBA64
- func (c RGBA) Sub(other RGBA) RGBA
- func (c RGBA) Sub3(other RGB) RGBA
- func (c RGBA) SubC(other RGBA) RGBA
- func (c RGBA) UnPremultiplied() RGBA
- type SRGB
- type SRGBA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteDecoded ¶
ByteDecoded decodes the range [0; 255] of a byte value into a float32 using range [0.0; 1.0] and returns it.
func ByteEncoded ¶
ByteEncoded lossily encodes the range [0.0; 1.0] of a float32 value into a byte using range [0; 255] and returns it.
func Linear ¶
Linear returns the linear RGB color space value in range [0.0-1.0] for v, assuming v is in sRGB in range [0.0-1.0].
func Linear16 ¶
Linear16 returns the linear RGB color space value in range [0.0-1.0] for v, assuming v is in sRGB in range [0-65535].
func Linear16AllNew ¶
Linear16AllNew returns a new slice containing the linearized elements of values assuming they are sRGB-encoded color components, or nil if values is empty.
func LinearAll ¶
func LinearAll(values []float32)
LinearAll linearizes each element in values assuming it is an sRGB-encoded color component.
func LinearAllNew ¶
LinearAllNew returns a new slice containing the linearized elements of values assuming they are sRGB-encoded color components, or nil if values is empty.
func Linearb ¶
Linearb returns the linear RGB color space value in range [0.0-1.0] for b, assuming b is in sRGB in range [0-255].
func LinearbAllNew ¶
LinearbAllNew returns a new slice containing the linearized elements of values assuming they are sRGB-encoded color components, or nil if values is empty.
func Standard ¶
Standard returns the sRGB color space value in range [0.0-1.0] for v, assuming v is in linear RGB in range [0.0-1.0].
func Standard16 ¶
Standard16 returns the sRGB color space value in range [0-65535] for v, assuming v is in linear RGB in range [0.0-1.0].
func Standard16AllNew ¶
Standard16AllNew returns a new slice containing the sRGB-encoded elements of values assuming they are linear RGB color components, or nil if values is empty.
func StandardAll ¶
func StandardAll(values []float32)
StandardAll encodes each element in values in sRGB assuming it is an linear RGB color component.
func StandardAllNew ¶
StandardAllNew returns a new slice containing the sRGB-encoded elements of values assuming they are linear RGB color components, or nil if values is empty.
func Standardb ¶
Standardb returns the sRGB color space value in range [0-255] for v, assuming v is in linear RGB in range [0.0-1.0].
func StandardbAllNew ¶
StandardbAllNew returns a new slice containing the sRGB-encoded elements of values assuming they are linear RGB color components, or nil if values is empty.
Types ¶
type RGB ¶
type RGB [3]float32
RGB represents a linear RGB color.
func (RGB) Luminance ¶
Luminance returns the luminance of the color using standard luminance values.
func (RGB) LuminanceCustom ¶
LuminanceCustom returns the luminance of the color using given luminance values.
type RGBA ¶
type RGBA [4]float32
RGBA represents a linear RGB color with alpha.
func (RGBA) Luminance ¶
Luminance returns the luminance of the color using standard luminance values, multiplied by its alpha value.
func (RGBA) LuminanceCustom ¶
LuminanceCustom returns the luminance of the color using given luminance values, multiplied by its alpha value.
func (RGBA) Premultiplied ¶
Premultiplied multiplies the R, G and B component of this color with its alpha component, such that in a normal blending scenario the new color is then given by source + dest * (1 - c[3]) instead of source * c[3] + dest * (1 - c[3]), in hopes of easing computational load.
It is the caller's responsibility to track whether this RGBA color is currently premulitplied or not.
func (RGBA) Standard ¶
Standard returns the sRGB-encoded representation of this linear RGB color with alpha.
func (RGBA) StdN ¶
StdN lossily returns c as a color.NRGBA64, assuming it is not alpha-premultiplied.
func (RGBA) UnPremultiplied ¶
UnPremultiplied reverts a prior multiplication of the R, G and B components of this color with its alpha value.
It is the caller's responsibility to track whether this RGBA color is currently premulitplied or not.
type SRGB ¶
type SRGB [3]uint8
SRGB represents an sRGB color where each color component is encoded in a byte.
type SRGBA ¶
type SRGBA [4]uint8
SRGBA represents an sRGB color with alpha where each color component is encoded in a byte.
func (SRGBA) Linear ¶
Linear returns the linear RGB representation of this sRGB-encoded color with alpha.