Class SBDTypeColor#
This class describes a color. More...
#include <SBDTypeColor.hpp>
Public Static Attributes#
Type | Name |
---|---|
const SBDTypeColor | black The black color. |
const SBDTypeColor | blue The blue color. |
const SBDTypeColor | cyan The cyan color. |
const SBDTypeColor | defaultKeyframeColor The default keyframe color. |
const SBDTypeColor | globalXAxis The global X axis color. |
const SBDTypeColor | globalYAxis The global Y axis color. |
const SBDTypeColor | globalZAxis The global Z axis color. |
const SBDTypeColor | green The green color. |
const SBDTypeColor | ice The frozen color. |
const SBDTypeColor | localXAxis The local X axis color. |
const SBDTypeColor | localYAxis The local Y axis color. |
const SBDTypeColor | localZAxis The local Z axis color. |
const SBDTypeColor | magenta The magenta color. |
const SBDTypeColor | orange The orange color. |
const SBDTypeColor | red The red color. |
const SBDTypeColor | white The white color. |
const SBDTypeColor | yellow The yellow color. |
Public Functions#
Type | Name |
---|---|
SBDTypeColor () Constructs a color (1.0f, 1.0f, 1.0f, 1.0f) |
|
SBDTypeColor (float red, float green, float blue, float alpha=1.0f) Constructs a color (red, green, blue, alpha) |
|
SBDTypeColor (int red, int green, int blue, int alpha=255) Constructs a color (red, green, blue, alpha) |
|
SBDTypeColor (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255) Constructs a color (red, green, blue, alpha) |
|
SBDTypeColor (float * color) Constructs a color (color[0], color[1], color[2], color[3]) |
|
SBDTypeColor (const std::string & hexColor) Constructs a color from hex color. |
|
SBDTypeColor (const SBDTypeColor & color) Copy constructor. |
|
SBDTypeColor (SBDTypeColor && color) noexcept Move constructor. |
|
SB_DECLARE_DATA (SBDTypeColor) |
|
SBDTypeColor & | bound () Bounds the components within [0, 1]. |
SBDTypeColor | bounded () const Returns a bounded version of the color with components within [0, 1]. |
SBDTypeColor & | freeze () Mixes the color with the frozen color. |
SBDTypeColor | frozen () const Returns a frozen version of the color. |
float | getAlpha () const Sets the blue component, the value should be in the [0.0, 1.0] interval. |
int | getAlphaInt () const Returns the alpha component, the value is in the [0.0, 1.0] interval. |
float | getBlue () const Sets the green component, the value should be in the [0.0, 1.0] interval. |
int | getBlueInt () const Returns the blue component, the value is in the [0.0, 1.0] interval. |
const float * | getColor () const Sets the alpha component, the value should be in the [0.0, 1.0] interval. |
void | getColor (float * color) const Stores the four components as a float array with the size of 4. |
float | getGreen () const Sets the red component, the value should be in the [0.0, 1.0] interval. |
int | getGreenInt () const Returns the green component, the value is in the [0.0, 1.0] interval. |
float | getRed () const |
int | getRedInt () const Returns the red component, the value is in the [0.0, 1.0] interval. |
bool | isSerializable () const Returns true. |
bool | operator!= (const SBDTypeColor & color) const |
SBDTypeColor | operator* (float f) const Multiply all components by f , including opacity. |
SBDTypeColor | operator* (const SBDTypeColor & color) const Component-wise multiplication by color , including opacity. |
SBDTypeColor & | operator*= (float f) Multiply all components by f , including opacity. |
SBDTypeColor & | operator*= (const SBDTypeColor & color) Component-wise multiplication by color , including opacity. |
SBDTypeColor | operator+ (const SBDTypeColor & color) const Component-wise addition by color , including opacity. |
SBDTypeColor & | operator+= (const SBDTypeColor & color) Component-wise addition by color , including opacity. |
SBDTypeColor | operator- (const SBDTypeColor & color) const Component-wise subtraction by color , including opacity. |
SBDTypeColor & | operator-= (const SBDTypeColor & color) Component-wise subtraction by color , including opacity. |
SBDTypeColor & | operator= (const SBDTypeColor & color) Copy assignment. |
SBDTypeColor & | operator= (SBDTypeColor && color) noexcept Move assignment. |
bool | operator== (const SBDTypeColor & color) const |
float & | operator[] (int index) Returns a reference to component index . |
const float & | operator[] (int index) const Returns a reference to component index (const version) |
virtual void | print (unsigned int offset=0) const Prints the color. |
void | serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) const Serializes the color. |
void | setAlpha (int alpha) Returns the alpha component, the value is in the [0, 255] interval. |
void | setAlpha (float alpha) Sets the alpha component, the value should be in the [0, 255] interval. |
void | setBlue (int blue) Returns the blue component, the value is in the [0, 255] interval. |
void | setBlue (float blue) Sets the blue component, the value should be in the [0, 255] interval. |
void | setGreen (int green) Returns the green component, the value is in the [0, 255] interval. |
void | setGreen (float green) Sets the green component, the value should be in the [0, 255] interval. |
void | setRed (int red) Returns the red component, the value is in the [0, 255] interval. |
void | setRed (float red) Sets the red component, the value should be in the [0, 255] interval. |
double | toGrayscale () const Returns the grayscale representation of the color. |
std::string | toHex (bool includeAlpha=false) const Returns the hex representation of the color. |
virtual std::string | toPythonCode () const Returns the string representation of the object that can be used to reconstruct it in Python. |
void | unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) Unserializes the color. |
virtual | ~SBDTypeColor () Destructs the color. |
Public Static Functions#
Type | Name |
---|---|
void | CIELabfromCIEXYZ (float * lab, float * XYZ) Converts CIE XYZ D65/2° to CIE L*a*b*. |
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*. |
void | CIELabfromSRGB (float * lab, float * rgb) Converts color from standard RGB (sRGB) color space to CIE L*a*b* color space. |
void | CIELuvfromCIEXYZ (float * luv, float * XYZ) Converts CIE XYZ D65/2° to CIE L*u*v*. |
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*. |
void | CIEXYZfromCIELab (float * XYZ, float * lab) Converts CIE L*a*b* to CIE XYZ D65/2° |
void | CIEXYZfromCIELuv (float * XYZ, float * luv) Converts CIE L*u*v* to CIE XYZ D65/2° |
void | CIEXYZfromRGB (float * XYZ, float * rgb) Converts linear RGB to CIE XYZ with D65/2° standard illuminant. |
void | CIEXYZfromSRGB (float * XYZ, float * rgb) Converts device independent standard RGB (sRGB) to CIE XYZ with D65/2° standard illuminant. |
void | CIEuvfromCIEXYZ (float * uv, float * XYZ) Converts CIE XYZ D65/2° to u and v coordinates for the CIE Luv. |
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) |
void | HSVfromSRGB (float * hsv, float * rgb) Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value) |
void | RGBfromCIEXYZ (float * rgb, float * XYZ) Converts CIE XYZ with D65/2° standard illuminant to linear RGB. |
void | RGBfromSRGB (float * rgb, float * srgb) Converts standard RGB (sRGB) values to linear RGB values. |
void | SRGBfromCIELab (float * rgb, float * lab) Converts color from CIE L*a*b* color space to standard RGB (sRGB) color space. |
void | SRGBfromCIEXYZ (float * rgb, float * XYZ) Converts CIEXYZ with D65/2° standard illuminant to device independent standard RGB (sRGB) |
void | SRGBfromCylindricalCIELab (float * rgb, float * hcl) Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to standard RGB (sRGB) |
void | SRGBfromCylindricalCIELuv (float * rgb, float * hcl) Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to standard RGB (sRGB) |
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. |
void | SRGBfromHSV (float * rgb, float * hsv) Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor) |
void | SRGBfromRGB (float * srgb, float * rgb) Converts linear RGB values to standard RGB (sRGB) values. |
double | SRGBtoGrayscale (double r, double g, double b) Converts sRGB to grayscale. |
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) |
void | cylindricalCIELabfromSRGB (float * hcl, float * rgb) Converts standard RGB (sRGB) to CIE L*a*b* in cylindrical coordinates a.k.a. (CIE LCh_ab) |
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) |
void | cylindricalCIELuvfromSRGB (float * hcl, float * rgb) Converts standard RGB (sRGB) to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) |
void | darkenSRGBColor (float * rgb, float amount) Darkens the standard RGB (sRGB) color rgb by the amountamount . |
SBDTypeColor | fromHCL (float hue, float chroma, float luminance) Creates a color from a given HCL (CIE LCh_uv) color. |
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) |
SBDTypeColor | fromHSV (float hue, float saturation, float value) Creates a color from a given HSV color. |
void | fromHSV (float * color, float * hsv) Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor) |
void | lightenSRGBColor (float * rgb, float amount) Lightens the standard RGB (sRGB) color rgb by the amountamount . |
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) |
void | toHSV (float * hsv, float * color) Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value) |
Protected Attributes#
Type | Name |
---|---|
SBDTypeColorData * | dataPointer |
Detailed Description#
This class describes a color in SAMSON. Please refer to the Color schemes for more information.
Short name: SBColor
SBColor uses the standard RGB (sRGB).
Color conversions#
This class also provides static functions to transform colors between different color spaces:
- standard gamma-corrected RGB (sRGB)
- RGB
- HSV (hue, saturation, value)
- HCL (hue, chroma, luminance) - cylindrical representation of CIE L*u*v*, a.k.a. CIE LCh_uv
- CIE L*u*v*
- CIE L*a*b*
- CIE L*a*b* in cylindrical coordinates, a.k.a. CIE LCh_ab
- CIE XYZ with D65/2° standard illuminant.
To use color conversion function, pass two pointers to float arrays (with 3 values) in a function: the first one will contain the result, the 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];
SBColor::toHCL(color_in_HCL, color_in_sRGB);
Note:
The conversions might not always be exact. For example, a conversion from sRGB to HCL and then back from HCL to sRGB might result in values that might slightly differ from the original ones by some numerical error due to approximations in conversion functions and floating-point arithmetic.
See also: Color schemes, SBDPalette
Public Static Attributes Documentation#
variable black#
The black color.
variable blue#
The blue color.
variable cyan#
The cyan color.
variable defaultKeyframeColor#
The default keyframe color.
variable globalXAxis#
The global X axis color.
variable globalYAxis#
The global Y axis color.
variable globalZAxis#
The global Z axis color.
variable green#
The green color.
variable ice#
The frozen color.
variable localXAxis#
The local X axis color.
variable localYAxis#
The local Y axis color.
variable localZAxis#
The local Z axis color.
variable magenta#
The magenta color.
variable orange#
The orange color.
variable red#
The red color.
variable white#
The white color.
variable yellow#
The yellow color.
Public Functions Documentation#
function SBDTypeColor [1/8]#
Constructs a color (1.0f, 1.0f, 1.0f, 1.0f)
function SBDTypeColor [2/8]#
Constructs a color (red, green, blue, alpha)
function SBDTypeColor [3/8]#
Constructs a color (red, green, blue, alpha)
function SBDTypeColor [4/8]#
Constructs a color (red, green, blue, alpha)
SBDTypeColor::SBDTypeColor (
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha=255
)
function SBDTypeColor [5/8]#
Constructs a color (color[0], color[1], color[2], color[3])
function SBDTypeColor [6/8]#
Constructs a color from hex color.
Creates color based on the given hex color. The hex color can start with '#' or not and should contain a hex triplet (six-digit or eight-digit).
Examples:
function SBDTypeColor [7/8]#
Copy constructor.
function SBDTypeColor [8/8]#
Move constructor.
function SB_DECLARE_DATA#
function bound#
Bounds the components within [0, 1].
function bounded#
Returns a bounded version of the color with components within [0, 1].
function freeze#
Mixes the color with the frozen color.
function frozen#
Returns a frozen version of the color.
function getAlpha#
Sets the blue component, the value should be in the [0.0, 1.0] interval.
function getAlphaInt#
Returns the alpha component, the value is in the [0.0, 1.0] interval.
function getBlue#
Sets the green component, the value should be in the [0.0, 1.0] interval.
function getBlueInt#
Returns the blue component, the value is in the [0.0, 1.0] interval.
function getColor [1/2]#
Sets the alpha component, the value should be in the [0.0, 1.0] interval.
Returns a pointer to the color array (size of 4)
function getColor [2/2]#
Stores the four components as a float array with the size of 4.
function getGreen#
Sets the red component, the value should be in the [0.0, 1.0] interval.
function getGreenInt#
Returns the green component, the value is in the [0.0, 1.0] interval.
function getRed#
function getRedInt#
Returns the red component, the value is in the [0.0, 1.0] interval.
function isSerializable#
Returns true.
function operator!=#
function operator*#
Multiply all components by f
, including opacity.
function operator*#
Component-wise multiplication by color
, including opacity.
function operator*=#
Multiply all components by f
, including opacity.
function operator*=#
Component-wise multiplication by color
, including opacity.
function operator+#
Component-wise addition by color
, including opacity.
function operator+=#
Component-wise addition by color
, including opacity.
function operator-#
Component-wise subtraction by color
, including opacity.
function operator-=#
Component-wise subtraction by color
, including opacity.
function operator=#
Copy assignment.
function operator=#
Move assignment.
function operator==#
function operator[]#
Returns a reference to component index
.
function operator[]#
Returns a reference to component index
(const version)
function print#
Prints the color.
function serialize#
Serializes the color.
void SBDTypeColor::serialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) const
function setAlpha [1/2]#
Returns the alpha component, the value is in the [0, 255] interval.
function setAlpha [2/2]#
Sets the alpha component, the value should be in the [0, 255] interval.
function setBlue [1/2]#
Returns the blue component, the value is in the [0, 255] interval.
function setBlue [2/2]#
Sets the blue component, the value should be in the [0, 255] interval.
function setGreen [1/2]#
Returns the green component, the value is in the [0, 255] interval.
function setGreen [2/2]#
Sets the green component, the value should be in the [0, 255] interval.
function setRed [1/2]#
Returns the red component, the value is in the [0, 255] interval.
function setRed [2/2]#
Sets the red component, the value should be in the [0, 255] interval.
function toGrayscale#
Returns the grayscale representation of the color.
Converts the color to grayscale: Grayscale = 0.299 * R + 0.587 * G + 0.114 * B
function toHex#
Returns the hex representation of the color.
Converts the color to the hex color code that starts with '#'. Return a string with the hex triplet: six-digit or eight-digit if includeAlpha
is true.
function toPythonCode#
Returns the string representation of the object that can be used to reconstruct it in Python.
function unserialize#
Unserializes the color.
void SBDTypeColor::unserialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
)
function ~SBDTypeColor#
Destructs the color.
Public Static Functions Documentation#
function CIELabfromCIEXYZ#
Converts CIE XYZ D65/2° to CIE L*a*b*.
SBDTypeColor::CIELabfromCIEXYZ - Converts CIE XYZ D65/2° to CIE L*a*b*.
Parameters:
lab
- CIE L*a*b* coordinatesXYZ
- 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)
function CIELabfromCylindricalCIELab#
Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to CIE L*a*b*.
SBDTypeColor::CIELabfromCylindricalCIELab - Converts CIE L*a*b* in cylindrical coordinates (CIE LCh_ab) to CIE L*a*b*.
Parameters:
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
function CIELabfromSRGB#
Converts color from standard RGB (sRGB) color space to CIE L*a*b* color space.
SBDTypeColor::CIELabfromSRGB - Converts standard RGB (sRGB) to CIE L*a*b*.
Parameters:
lab
- L*a*b* coordinates in the CIE L*a*b* color spacergb
- standard RGB (sRGB)
function CIELuvfromCIEXYZ#
Converts CIE XYZ D65/2° to CIE L*u*v*.
SBDTypeColor::CIELuvfromCIEXYZ - Converts CIE XYZ D65/2° to CIE L*u*v*.
Parameters:
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).
function CIELuvfromCylindricalCIELuv#
Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to CIE L*u*v*.
SBDTypeColor::CIELuvfromCylindricalCIELuv - Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to CIE L*u*v*.
Parameters:
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
function CIEXYZfromCIELab#
Converts CIE L*a*b* to CIE XYZ D65/2°
SBDTypeColor::CIEXYZfromCIELab - Converts CIE L*a*b* to CIE XYZ D65/2°
Parameters:
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
function CIEXYZfromCIELuv#
Converts CIE L*u*v* to CIE XYZ D65/2°
SBDTypeColor::CIEXYZfromCIELuv - Converts CIE L*u*v* to CIE XYZ D65/2°
Parameters:
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.
function CIEXYZfromRGB#
Converts linear RGB to CIE XYZ with D65/2° standard illuminant.
SBDTypeColor::CIEXYZfromRGB - Converts linear RGB to CIE XYZ with D65/2° standard illuminant.
Parameters:
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).
function CIEXYZfromSRGB#
Converts device independent standard RGB (sRGB) to CIE XYZ with D65/2° standard illuminant.
SBDTypeColor::CIEXYZfromSRGB - Converts device independent standard RGB (sRGB) to CIE XYZ with D65/2° standard illuminant.
Parameters:
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).
function CIEuvfromCIEXYZ#
Converts CIE XYZ D65/2° to u and v coordinates for the CIE Luv.
SBDTypeColor::CIEuvfromCIEXYZ - An auxiliary function that computes u and v coordinates for the CIE Luv from CIE XYZ.
Parameters:
uv
- u and v valuesXYZ
- 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).
function HCLfromSRGB#
Converts standard RGB (sRGB) color to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)
SBDTypeColor::HCLfromSRGB - Converts standard RGB (sRGB) color to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)
Parameters:
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 ... 100rgb
- standard RGB (sRGB) color
function HSVfromSRGB#
Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)
SBDTypeColor::HSVfromSRGB - Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)
Parameters:
hsv
- hue, saturation, and valuergb
- standard RGB (sRGB) color
function RGBfromCIEXYZ#
Converts CIE XYZ with D65/2° standard illuminant to linear RGB.
SBDTypeColor::RGBfromCIEXYZ - Converts CIE XYZ with D65/2° standard illuminant to linear RGB.
Parameters:
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)
function RGBfromSRGB#
Converts standard RGB (sRGB) values to linear RGB values.
SBDTypeColor::RGBfromSRGB - Converts standard gamma-corrected RGB values to linear RGB values.
Parameters:
rgb
- linear RGBsrgb
- standard RGB (sRGB)
function SRGBfromCIELab#
Converts color from CIE L*a*b* color space to standard RGB (sRGB) color space.
SBDTypeColor::SRGBfromCIELab - Converts CIE L*a*b* to standard RGB (sRGB)
Parameters:
rgb
- standard RGB (sRGB)lab
- L*a*b* coordinates in the CIE L*a*b* color space
function SRGBfromCIEXYZ#
Converts CIEXYZ with D65/2° standard illuminant to device independent standard RGB (sRGB)
SBDTypeColor::SRGBfromCIEXYZ - Converts CIEXYZ with D65/2° standard illuminant to device independent standard RGB (sRGB)
Parameters:
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)
function SRGBfromCylindricalCIELab#
Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to standard RGB (sRGB)
SBDTypeColor::SRGBfromCylindricalCIELab - Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to standard RGB (sRGB)
Parameters:
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
function SRGBfromCylindricalCIELuv#
Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to standard RGB (sRGB)
SBDTypeColor::SRGBfromCylindricalCIELuv - Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to standard RGB (sRGB)
Parameters:
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
function SRGBfromHCL#
Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to standard RGB (sRGB) color.
SBDTypeColor::SRGBfromHCL - Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to standard RGB (sRGB) color.
Parameters:
rgb
- standard RGB (sRGB) colorhcl
- 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
function SRGBfromHSV#
Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)
SBDTypeColor::SRGBfromHSV - Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)
Parameters:
rgb
- standard RGB (sRGB) colorhsv
- hue, saturation, and value
function SRGBfromRGB#
Converts linear RGB values to standard RGB (sRGB) values.
SBDTypeColor::SRGBfromRGB - Converts linear RGB values to standard gamma-corrected RGB values.
Parameters:
srgb
- standard RGB (sRGB)rgb
- linear RGB
function SRGBtoGrayscale#
Converts sRGB to grayscale.
Convert sRGB to grayscale: Grayscale = 0.299 * R + 0.587 * G + 0.114 * B
function cylindricalCIELabfromCIELab#
Converts CIE L*a*b* to CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab)
SBDTypeColor::cylindricalCIELabfromCIELab - Converts CIE L*a*b* to CIE L*a*b* in cylindrical coordinates (CIE LCh_ab)
Parameters:
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 ... 100lab
- L*a*b* coordinates in the CIE L*a*b*
function cylindricalCIELabfromSRGB#
Converts standard RGB (sRGB) to CIE L*a*b* in cylindrical coordinates a.k.a. (CIE LCh_ab)
SBDTypeColor::cylindricalCIELabfromSRGB - Converts standard RGB (sRGB) to CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab)
Parameters:
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 ... 100rgb
- standard RGB (sRGB)
function cylindricalCIELuvfromCIELuv#
Converts CIE L*u*v* to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)
SBDTypeColor::cylindricalCIELuvfromCIELuv - Converts CIE L*u*v* to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)
Parameters:
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 ... 100luv
- L*u*v* coordinates in the CIE L*u*v*
function cylindricalCIELuvfromSRGB#
Converts standard RGB (sRGB) to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)
SBDTypeColor::cylindricalCIELuvfromSRGB - Converts standard RGB (sRGB) to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)
Parameters:
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 ... 100rgb
- standard RGB (sRGB)
function darkenSRGBColor#
Darkens the standard RGB (sRGB) color rgb
by the amountamount
.
function fromHCL [1/2]#
Creates a color from a given HCL (CIE LCh_uv) color.
function fromHCL [2/2]#
Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to sRGB color (as in SBColor)
SBDTypeColor::fromHCL - Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to sRGB color as in SBColor.
Parameters:
color
- sRGB color as in SBColorhcl
- 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
function fromHSV [1/2]#
Creates a color from a given HSV color.
function fromHSV [2/2]#
Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)
SBDTypeColor::fromHSV - Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)
Parameters:
color
- sRGB color as in SBColorhsv
- hue, saturation, and value
function lightenSRGBColor#
Lightens the standard RGB (sRGB) color rgb
by the amountamount
.
function toHCL#
Converts sRGB color (as in SBColor) to HCL (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)
SBDTypeColor::toHCL - Converts sRGB color as in SBColor to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)
Parameters:
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 ... 100color
- sRGB color as in SBColor
function toHSV#
Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)
SBDTypeColor::toHSV - Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)
Parameters:
hsv
- hue, saturation, and valuecolor
- sRGB color as in SBColor