Skip to main content

Crate neco_pigment

Crate neco_pigment 

Source
Expand description

Kubelka-Munk spectral pigment mixing crate.

Structs§

KsSpectrum
K/S spectrum representation (164 bytes per color).
Pigment
Bundled pigment holding the original sRGB, sigmoid coefficients, and K/S spectrum.
RgbTransform
Precomputed spectral-to-linear-RGB transform matrix for a given illuminant.
SigmoidCoeffs
Jakob sigmoid coefficients (12 bytes per color).

Enums§

PigmentError
Error type for neco-pigment.

Constants§

LAMBDAS
Wavelength array [380, 390, …, 780] nm.
LAMBDA_MAX
LAMBDA_MIN
LAMBDA_STEP
N_SPECTRAL
Spectral discretization constants.

Functions§

illuminant_a
Return the cached RGB transform matrix for illuminant A.
illuminant_d50
Return the cached RGB transform matrix for illuminant D50.
illuminant_d65
Return the cached RGB transform matrix for illuminant D65.
illuminant_e
Return the cached RGB transform matrix for equal-energy illuminant E.
ks_mix
Linear interpolation in K/S space. t is not clamped (caller’s responsibility).
ks_mix_weighted
Weighted blend of multiple colors in K/S space. Weights are not normalized.
ks_to_reflectance
K/S to reflectance (KM infinite thickness).
ks_to_srgb
Convert K/S spectrum to sRGB (using LUT gamma).
linear_to_srgb
linear_to_srgb_lut
Linear to sRGB conversion using LUT with linear interpolation.
reflectance_to_ks
Reflectance to K/S conversion (per wavelength, KM infinite thickness).
rgb_to_ks
Convert sRGB to K/S spectrum (handles black/white analytically).
rgb_to_sigmoid
Fit Jakob sigmoid coefficients to an sRGB color via Gauss-Newton optimization.
sigmoid_to_spectrum
Convert sigmoid coefficients to a reflectance spectrum.
spectrum_to_linear_rgb
Convert a reflectance spectrum to linear sRGB via dot product with the precomputed matrix.
srgb_to_linear
srgb_to_linear_lut
sRGB to linear conversion using LUT with linear interpolation.
to_u8