Documentation
¶
Overview ¶
Package linear provides support for working with linearised colour.
Index ¶
- func NormalisedTo8Bit(v float32) uint8
- func NormalisedTo9Bit(v float32) uint16
- func NormalisedTo16Bit(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 NormalisedTo8Bit ¶
NormalisedTo8Bit clamps and scales a normalised value to the range 0-255.
func NormalisedTo9Bit ¶
NormalisedTo9Bit clamps and scales a normalised value to the range 0-511.
func NormalisedTo16Bit ¶
NormalisedTo16Bit clamps and scales a normalised value to the range 0-65535.
func TransformImageColor ¶
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. Zero means use GOMAXPROCS.
Types ¶
type RGB ¶
RGB represents a linear normalised RGB colour value in an unspecified colour space.
func RGBFromEncoded ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.