Struct LinearSRgb
Stores linear-light sRGB channel values.
struct LinearSRgb(T)
if (is(T == float) || is(T == double));
Use this type for calculations that require linear light, such as alpha
compositing. T must be float or double. Construction stores
components unchanged, including values outside [0, 1].
The natural value contains NaNs, so it does not represent black.
Fields
| Name | Type | Description |
|---|---|---|
b
|
T | Blue linear-light component. |
g
|
T | Green linear-light component. |
r
|
T | Red linear-light component. |
Aliases
| Name | Description |
|---|---|
Scalar
|
Scalar component type. |
Example
// Linear-light values are the correct domain for light mixing and
// compositing. Encode only when a consumer needs encoded sRGB.
const linear = LinearSRgbd(0.25, 0.50, 1.0);
const encoded = linear .toSRgb;
assert(encoded .r > linear .r);
assert(encoded .g > linear .g);
assert(encoded .b == 1.0);