![]() | editing-note |
---|---|
(Bill) These Conversion Formulas will likely move to Section 2.7 Fixed-Point Data Conversions (RGB to sRGB and sRGB to RGB) and section 2.6 Numeric Representation and Computation (RGB to Shared Exponent and Shared Exponent to RGB) |
An RGB color $(red, green, blue)$ is transformed to a shared exponent color $(red_{shared}, green_{shared}, blue_{shared}, exp_{shared})$ as follows:
First, the components $(red, green, blue)$ are clamped to $(red_{clamped}, green_{clamped}, blue_{clamped})$ as:
Where:
![]() | Note |
---|---|
$NaN$ , if supported, is handled as in IEEE 754-2008 minNum() and maxNum(). That is the result is a $NaN$ is mapped to zero. |
The largest clamped component, $max_{clamped}$ is determined:
A preliminary shared exponent $exp'$ is computed:
The shared exponent $exp_{shared}$ is computed:
Finally, three integer values in the range $0$ to $2^N$ are computed:
A shared exponent color $(red_{shared}, green_{shared}, blue_{shared}, exp_{shared})$ is transformed to an RGB color $(red, green, blue)$ as follows:
Where: