Crate srgb[][src]

Expand description

The crate provides primitives for manipulating colours in sRGB colour space.

Specifically, it provides functions for converting between sRGB space, linear sRGB space and XYZ colour space; as well as exposes the definition of D65 reference white point as well as XYZ colour conversion matrices; and in addition provides functions for handling Rec.709 components encoding.

The crate intents to provide low-level primitives needed to work with sRGB colour space. Those primitives can be used by other libraries which need to convert between sRGB and other colour spaces (if the conversion requires going through XYZ colour space) or blend colours together (which requires performing gamma correction).

Functions provided in the main module implement conversions between sRGB and XYZ colour spaces while providing routines for intermediate conversions. Functions in gamma submodule provide functions for doing gamma compression and expansion; they operate on a single colour component. Lastly, xyz submodule provides functions for converting between linear sRGB and XYZ colour spaces as well as constants exposing the matrices used by those functions.

Modules

Functions implementing sRGB gamma compression and expansion formulæ.

Functions and constant handling and related to conversion between linear sRGB space and CIE XYZ colour space.

Functions

Converts a colour in an XYZ colour space into a normalised sRGB representation.

Converts a colour in an XYZ colour space into 24-bit sRGB representation.

Converts a normalised representation of a sRGB colour into XYZ colour space.

Converts a 24-bit sRGB colour into XYZ colour space.