Documentation ¶
Overview ¶
Package linear provides support for working with linearised colour.
Index ¶
- func NormalisedTo16Bit(v float32) uint16
- func NormalisedTo8Bit(v float32) uint8
- func NormalisedTo9Bit(v float32) uint16
- func TransformImageColor(dst draw.Image, src image.Image, parallelism int, ...)
- type RGB
- func (c RGB) Luminance() float32
- func (c RGB) ToEncodedNRGBA(alpha float32, trcEncode func(float32) uint8) color.NRGBA
- func (c RGB) ToEncodedRGBA(alpha float32, trcEncode func(float32) uint8) color.RGBA
- func (c RGB) ToEncodedRGBA64(alpha float32, trcEncode func(float32) uint16) color.RGBA64
- func (c RGB) ToLinearRGBA64(alpha float32) color.RGBA64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalisedTo16Bit ¶ added in v0.30.0
NormalisedTo16Bit clamps and scales a normalised value to the range 0-65535.
func NormalisedTo8Bit ¶ added in v0.30.0
NormalisedTo8Bit clamps and scales a normalised value to the range 0-255.
func NormalisedTo9Bit ¶ added in v0.30.0
NormalisedTo9Bit clamps and scales a normalised value to the range 0-511.
func TransformImageColor ¶ added in v0.28.0
func TransformImageColor(dst draw.Image, src image.Image, parallelism int, transformColor func(color.Color) color.RGBA64)
TransformImageColor applies a colour transformation function to all pixels of src, writing the results to dst at its origin.
src and dst may be the same image.
parallelism specifies the degree of parallel processing; a value of 4 indicates that processing will be spread across four threads.
Types ¶
type RGB ¶ added in v0.20.0
RGB represents a linear normalised RGB colour value in an unspecified colour space.
func RGBFromEncoded ¶ added in v0.26.0
RGBFromEncoded returns a normalised RGB instance representing the specified color.Color value. The alpha component is returned as a normalised value in the range 0.0-1.0.
c is assumed to be an encoded colour.
func RGBFromLinear ¶ added in v0.26.0
RGBFromLinear returns a normalised RGB instance representing the specified color.Color value. The alpha component is returned as a normalised value in the range 0.0-1.0.
c is assumed to be a linear colour.
func (RGB) ToEncodedNRGBA ¶ added in v0.20.0
ToEncodedNRGBA returns an encoded 8-bit NRGBA representation of this colour suitable for use with instances of image.NRGBA.
alpha is the normalised alpha value and will be clipped to 0.0–1.0.
trcEncode is a tonal response curve encoding function.
func (RGB) ToEncodedRGBA ¶ added in v0.20.0
ToEncodedRGBA returns an encoded 8-bit RGBA representation of this colour suitable for use with instances of image.RGBA.
alpha is the normalised alpha value and will be clipped to 0.0–1.0.
trcEncode is a tonal response curve encoding function.
func (RGB) ToEncodedRGBA64 ¶ added in v0.26.0
ToEncodedRGBA64 returns an encoded 16-bit RGBA representation of this colour suitable for use with instances of image.RGBA64.
alpha is the normalised alpha value and will be clipped to 0.0–1.0.
trcEncode is a tonal response curve encoding function.