The SBDTypeColorConversion class provides functions to transform colors between different color spaces. More...
Conversions | |
static void | toHCL (float *hcl, float *color) |
Converts sRGB color (as in SBColor) to HCL (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) More... | |
static void | fromHCL (float *color, float *hcl) |
Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to sRGB color (as in SBColor) More... | |
static void | HCLfromSRGB (float *hcl, float *rgb) |
Converts standard RGB (sRGB) color to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) More... | |
static void | SRGBfromHCL (float *rgb, float *hcl) |
Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to standard RGB (sRGB) color. More... | |
static void | SRGBfromRGB (float *srgb, float *rgb) |
Converts linear RGB values to standard RGB (sRGB) values. More... | |
static void | RGBfromSRGB (float *rgb, float *srgb) |
Converts standard RGB (sRGB) values to linear RGB values. More... | |
static void | CIEXYZfromRGB (float *XYZ, float *rgb) |
Converts linear RGB to CIE XYZ with D65/2° standard illuminant. More... | |
static void | RGBfromCIEXYZ (float *rgb, float *XYZ) |
Converts CIE XYZ with D65/2° standard illuminant to linear RGB. More... | |
static void | CIEXYZfromSRGB (float *XYZ, float *rgb) |
Converts device independent standard RGB (sRGB) to CIE XYZ with D65/2° standard illuminant. More... | |
static void | SRGBfromCIEXYZ (float *rgb, float *XYZ) |
Converts CIEXYZ with D65/2° standard illuminant to device independent standard RGB (sRGB) More... | |
static void | CIEXYZfromCIELab (float *XYZ, float *lab) |
Converts CIE L*a*b* to CIE XYZ D65/2° More... | |
static void | CIELabfromCIEXYZ (float *lab, float *XYZ) |
Converts CIE XYZ D65/2° to CIE L*a*b*. More... | |
static void | CIEXYZfromCIELuv (float *XYZ, float *luv) |
Converts CIE L*u*v* to CIE XYZ D65/2° More... | |
static void | CIELuvfromCIEXYZ (float *luv, float *XYZ) |
Converts CIE XYZ D65/2° to CIE L*u*v*. More... | |
static void | CylindricalCIELabfromCIELab (float *hcl, float *lab) |
Converts CIE L*a*b* to CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) More... | |
static void | CIELabfromCylindricalCIELab (float *lab, float *hcl) |
Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to CIE L*a*b*. More... | |
static void | CylindricalCIELuvfromCIELuv (float *hcl, float *luv) |
Converts CIE L*u*v* to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) More... | |
static void | CIELuvfromCylindricalCIELuv (float *luv, float *hcl) |
Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to CIE L*u*v*. More... | |
static void | CylindricalCIELabfromSRGB (float *hcl, float *rgb) |
Converts standard RGB (sRGB) to CIE L*a*b* in cylindrical coordinates a.k.a. (CIE LCh_ab) More... | |
static void | SRGBfromCylindricalCIELab (float *rgb, float *hcl) |
Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to standard RGB (sRGB) More... | |
static void | CylindricalCIELuvfromSRGB (float *hcl, float *rgb) |
Converts standard RGB (sRGB) to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) More... | |
static void | SRGBfromCylindricalCIELuv (float *rgb, float *hcl) |
Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to standard RGB (sRGB) More... | |
To use any function in this class, pass two pointers to float arrays (with 3 values) in a function: first one will contain the result, second one contains the input color data.
Example: float color_in_sRGB[3] = {1.0, 0.0, 0.0}; // red color in sRGB color space float color_in_HCL[3]; SBDTypeColorConversion::toHCL(color_in_HCL, color_in_sRGB);
Note that the conversion is not exact. For example, a converstion from sRGB to HCL and then back from HCL to sRGB will result in values that will slightly differ from the original ones by some numerical error due to approximations in conversion functions.
This class provides functions to transform between different color spaces.
|
static |
SBDTypeColorConversion::CIELabfromCIEXYZ - Converts CIE XYZ D65/2° to CIE L*a*b*.
lab | - CIE L*a*b* coordinates |
XYZ | - X, Y, Z input refer to a D65/2° standard illuminant. The CIE XYZ values must be scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883) |
|
static |
SBDTypeColorConversion::CIELabfromCIEPolarLab - Converts CIE L*a*b* in cylindrical coordinates (CIE LCh_ab) to CIE L*a*b*.
lab | - L*a*b* coordinates in the CIE L*a*b* |
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*a*b* color space. Cylindrical CIE Lab: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
|
static |
SBDTypeColorConversion::CIELuvfromCIEXYZ - Converts CIE XYZ D65/2° to CIE L*u*v*.
luv | - Resulting L*u*v* coordinates in the CIE L*u*v* color space. |
XYZ | - X, Y, Z input refer to a D65/2° standard illuminant. The CIE XYZ values must be scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883). |
|
static |
SBDTypeColorConversion::CIELuvfromCIEPolarLuv - Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to CIE L*u*v*.
luv | - L*u*v* coordinates in the CIE L*u*v* |
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
|
static |
SBDTypeColorConversion::CIEXYZfromCIELab - Converts CIE L*a*b* to CIE XYZ D65/2°
XYZ | - X, Y, Z input refer to a D65/2° standard illuminant. The CIE XYZ values must be scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883). |
lab | - L*a*b* coordinates in the CIE L*a*b* color space |
|
static |
SBDTypeColorConversion::CIEXYZfromCIELuv - Converts CIE L*u*v* to CIE XYZ D65/2°
XYZ | - X, Y, Z coordinates in the CIEXYZ color space, that refer to a D65/2° standard illuminant. The CIE XYZ values must be scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883). |
luv | - L*u*v* coordinates in the CIE L*u*v* color space. |
|
static |
SBDTypeColorConversion::CIEXYZfromRGB - Converts linear RGB to CIE XYZ with D65/2° standard illuminant.
XYZ | - X, Y and Z give the CIE chromaticies. X, Y, Z output refer to a D65/2° standard illuminant. The CIE XYZ values are scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883) (chromaticity of the white point). |
rgb | - linear R, G, and B give the levels of red, green and blue as values in the interval [0.0, 1.0] (input range: 0 ÷ 1). |
|
static |
SBDTypeColorConversion::CIEXYZfromSRGB - Converts device independent standard RGB (sRGB) to CIE XYZ with D65/2° standard illuminant.
XYZ | - X, Y and Z give the CIE chromaticies. X, Y, Z output refer to a D65/2° standard illuminant. The CIE XYZ values are scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883) (chromaticity of the white point). |
rgb | - standard R, G, and B give the levels of red, green and blue as values in the interval [0.0, 1.0] (input range: 0 ÷ 1). |
|
static |
SBDTypeColorConversion::CylindricalCIELabfromCIELab - Converts CIE L*a*b* to CIE L*a*b* in cylindrical coordinates (CIE LCh_ab)
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*a*b* color space. Cylindrical CIE Lab: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
lab | - L*a*b* coordinates in the CIE L*a*b* |
|
static |
SBDTypeColorConversion::CylindricalCIELabfromSRGB - Converts standard RGB (sRGB) to CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab)
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*a*b* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
rgb | - standard RGB (sRGB) |
|
static |
SBDTypeColorConversion::CIEPolarLuvfromCIELuv - Converts CIE L*u*v* to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)
hcl | - hue, chroma, and luminance values in the cylindrical CIE L*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
luv | - L*u*v* coordinates in the CIE L*u*v* |
|
static |
SBDTypeColorConversion::CylindricalCIELuvfromSRGB - Converts standard RGB (sRGB) to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
rgb | - standard RGB (sRGB) |
|
static |
SBDTypeColorConversion::fromHCL - Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to sRGB color as in SBColor.
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
color | - sRGB color as in SBColor |
|
static |
SBDTypeColorConversion::HCLfromSRGB - Converts standard RGB (sRGB) color to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
rgb | - standard RGB (sRGB) color |
|
static |
SBDTypeColorConversion::RGBfromCIEXYZ - Converts CIE XYZ with D65/2° standard illuminant to linear RGB.
rgb | - linear R, G, and B give the levels of red, green and blue as values in the interval [0.0, 1.0] (input range: 0 ÷ 1). |
XYZ | - X, Y and Z are the CIE chromaticies. X, Y, Z input refer to a D65/2° standard illuminant. The CIE XYZ values must be scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883) |
|
static |
SBDTypeColorConversion::RGBfromSRGB - Converts standard gamma-corrected RGB values to linear RGB values.
rgb | - linear RGB |
srgb | - standard RGB (sRGB) |
|
static |
SBDTypeColorConversion::SRGBfromCIEXYZ - Converts CIEXYZ with D65/2° standard illuminant to device independent standard RGB (sRGB)
rgb | - standard R, G, and B give the levels of red, green and blue as values in the interval [0.0, 1.0] (input range: 0 ÷ 1). |
XYZ | - X, Y and Z are the CIE chromaticies. X, Y, Z input refer to a D65/2° standard illuminant. The CIE XYZ values must be scaled so that the Y of D65 ("white") is 1.0 (X,Y,Z = 0.95047, 1.0000, 1.08883) |
|
static |
SBDTypeColorConversion::SRGBfromCylindricalCIELab - Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to standard RGB (sRGB)
rgb | - standard RGB (sRGB) |
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*a*b* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
|
static |
SBDTypeColorConversion::SRGBfromCylindricalCIELuv - Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to standard RGB (sRGB)
rgb | - standard RGB (sRGB) |
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
|
static |
SBDTypeColorConversion::SRGBfromHCL - Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to standard RGB (sRGB) color.
rgb | - standard RGB (sRGB) color |
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
|
static |
SBDTypeColorConversion::SRGBfromRGB - Converts linear RGB values to standard gamma-corrected RGB values.
srgb | - standard RGB (sRGB) |
rgb | - linear RGB |
|
static |
SBDTypeColorConversion::toHCL - Converts sRGB color as in SBColor to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)
hcl | - hue, chroma, and luminance values in the cylindrical CIEL*u*v* color space. Cylindrical CIE Luv: H: 0 ... 360; C: 0 ... 100; L: 0 ... 100 |
color | - sRGB color as in SBColor |