hdrcolor

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RGBModel = color.ModelFunc(rgbModel)
	XYZModel = color.ModelFunc(xyzModel)
)

Models for the standard color types.

Functions

func IptToLms

func IptToLms(i, p, t float64) (l, m, s float64)

IptToLms converts from IPT-space to LMS-space.

func LmsMcat02ToXyz

func LmsMcat02ToXyz(l, m, s float64) (x, y, z float64)

LmsMcat02ToXyz converts from LMS-space (using CIE CAT02 matrix) to CIE XYZ-space.

func LmsMhpeToXyz

func LmsMhpeToXyz(l, m, s float64) (x, y, z float64)

LmsMhpeToXyz converts from LMS-space (using Hunt-Pointer-Estevez matrix) to CIE XYZ-space.

func LmsToIpt

func LmsToIpt(l, m, s float64) (i, p, t float64)

LmsToIpt converts from LMS-space to IPT-space.

func LmsToXyz

func LmsToXyz(l, m, s float64) (x, y, z float64)

LmsToXyz converts from LMS-space (using D65-LMS matrix) to CIE XYZ-space.

func XyzToLms

func XyzToLms(x, y, z float64) (l, m, s float64)

XyzToLms converts from CIE XYZ-space to LMS-space (using D65-LMS matrix).

func XyzToLmsMcat02

func XyzToLmsMcat02(x, y, z float64) (l, m, s float64)

XyzToLmsMcat02 converts from CIE XYZ-space to LMS-space (using CIE CAT02 matrix).

func XyzToLmsMhpe

func XyzToLmsMhpe(x, y, z float64) (l, m, s float64)

XyzToLmsMhpe converts from CIE XYZ-space to LMS-space (using Hunt-Pointer-Estevez matrix).

Types

type Color

type Color interface {
	color.Color

	// HDRRGBA returns the red, green, blue and alpha values
	// for the HDR color.
	HDRRGBA() (r, g, b, a float64)

	// HDRXYZA returns the x, y, z and alpha values
	// for the HDR color.
	HDRXYZA() (x, y, z, a float64)

	// HDRPixel returns the raw channels' values of a pixel.
	HDRPixel() (p1, p2, p3, pa float64)
}

Color can convert itself to alpha-premultiplied 16-bits per channel RGBA and HDR float64 RGB. The conversion may be lossy.

type RAW

type RAW struct {
	P1, P2, P3 float64
}

RAW represents a HDR color in no specific color-space. Take care when you use this color!

func (RAW) HDRPixel

func (c RAW) HDRPixel() (p1, p2, p3, pa float64)

HDRPixel returns the raw channels' values of a pixel.

func (RAW) HDRRGBA

func (c RAW) HDRRGBA() (r, g, b, a float64)

HDRRGBA aliases HDRPixel.

func (RAW) HDRXYZA

func (c RAW) HDRXYZA() (x, y, z, a float64)

HDRXYZA aliases HDRPixel.

func (RAW) RGBA

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

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the color. Each value ranges within [0, 0xffff], but is represented by a uint32 so that multiplying by a blend factor up to 0xffff will not overflow.

type RGB

type RGB struct {
	R, G, B float64
}

RGB represents a HDR color in RGB color-space.

func (RGB) HDRPixel

func (c RGB) HDRPixel() (r, g, b, a float64)

HDRPixel aliases the HDRRGBA func.

func (RGB) HDRRGBA

func (c RGB) HDRRGBA() (r, g, b, a float64)

HDRRGBA returns the red, green, blue and alpha values for the HDR color.

func (RGB) HDRXYZA

func (c RGB) HDRXYZA() (x, y, z, a float64)

HDRXYZA returns the x, y, z and alpha values for the HDR color.

func (RGB) RGBA

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

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the color. Each value ranges within [0, 0xffff], but is represented by a uint32 so that multiplying by a blend factor up to 0xffff will not overflow.

type XYZ

type XYZ struct {
	X, Y, Z float64
}

XYZ represents a HDR color in XYZ color-space.

func (XYZ) HDRPixel

func (c XYZ) HDRPixel() (x, y, z, a float64)

HDRPixel aliases the HDRXYZA func.

func (XYZ) HDRRGBA

func (c XYZ) HDRRGBA() (r, g, b, a float64)

HDRRGBA returns the red, green, blue and alpha values for the HDR color.

func (XYZ) HDRXYZA

func (c XYZ) HDRXYZA() (x, y, z, a float64)

HDRXYZA returns the x, y, z and alpha values for the HDR color.

func (XYZ) RGBA

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

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the color. Each value ranges within [0, 0xffff], but is represented by a uint32 so that multiplying by a blend factor up to 0xffff will not overflow.

Jump to

Keyboard shortcuts

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