Expand description

blend-srgb is a small, #![no_std]-compatible sRGB conversion and blending library designed for performance.

It provides a small number of helper functions for converting and blending sRGB values:

Additionally, these functions are designed to be performant enough to be used in software composition pipelines. To facilitate this, a small (4.5k) lookup table is included. The lookup table can be small due to the usage of 12-bit linear values rather than 16-bit. 12 bits are enough to store all 8-bit sRGB values in linear space.

All functions other than srgb_to_rgb and rgb_to_srgb use only integer operations, and are therefore fully compatible with #![no_std]. To activate #![no_std], just deactivate the std feature. To keep the floating-point methods, also add the libm feature.

Modules

Functions for blending together sRGB colors. These functions use the conversion functions in convert, but do not support transparent backgrounds.

Functions for converting between sRGB and linear space. There are floating-point (srgb_to_rgb and rgb_to_srgb) and integer (srgb8_to_rgb12 and rgb12_to_srgb8) versions.