Web Analytics Made Easy - Statcounter
Skip to content

Class SBDTypeColor#

ClassList > 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.

SBDTypeColor const black;


variable blue#

The blue color.

SBDTypeColor const blue;


variable cyan#

The cyan color.

SBDTypeColor const cyan;


variable defaultKeyframeColor#

The default keyframe color.

SBDTypeColor const defaultKeyframeColor;


variable globalXAxis#

The global X axis color.

SBDTypeColor const globalXAxis;


variable globalYAxis#

The global Y axis color.

SBDTypeColor const globalYAxis;


variable globalZAxis#

The global Z axis color.

SBDTypeColor const globalZAxis;


variable green#

The green color.

SBDTypeColor const green;


variable ice#

The frozen color.

SBDTypeColor const ice;


variable localXAxis#

The local X axis color.

SBDTypeColor const localXAxis;


variable localYAxis#

The local Y axis color.

SBDTypeColor const localYAxis;


variable localZAxis#

The local Z axis color.

SBDTypeColor const localZAxis;


variable magenta#

The magenta color.

SBDTypeColor const magenta;


variable orange#

The orange color.

SBDTypeColor const orange;


variable red#

The red color.

SBDTypeColor const red;


variable white#

The white color.

SBDTypeColor const white;


variable yellow#

The yellow color.

SBDTypeColor const yellow;


Public Functions Documentation#

function SBDTypeColor [1/8]#

Constructs a color (1.0f, 1.0f, 1.0f, 1.0f)

SBDTypeColor::SBDTypeColor () 


function SBDTypeColor [2/8]#

Constructs a color (red, green, blue, alpha)

SBDTypeColor::SBDTypeColor (
    float red,
    float green,
    float blue,
    float alpha=1.0f
) 


function SBDTypeColor [3/8]#

Constructs a color (red, green, blue, alpha)

SBDTypeColor::SBDTypeColor (
    int red,
    int green,
    int blue,
    int alpha=255
) 


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])

SBDTypeColor::SBDTypeColor (
    float * color
) 


function SBDTypeColor [6/8]#

Constructs a color from hex color.

SBDTypeColor::SBDTypeColor (
    const std::string & hexColor
) 

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:

SBColor color1 = SBDTypeColor("#0099CC");
SBColor color2 = SBDTypeColor("0099CC");


function SBDTypeColor [7/8]#

Copy constructor.

SBDTypeColor::SBDTypeColor (
    const SBDTypeColor & color
) 


function SBDTypeColor [8/8]#

Move constructor.

SBDTypeColor::SBDTypeColor (
    SBDTypeColor && color
) noexcept


function SB_DECLARE_DATA#

SBDTypeColor::SB_DECLARE_DATA (
    SBDTypeColor
) 

function bound#

Bounds the components within [0, 1].

SBDTypeColor & SBDTypeColor::bound () 


function bounded#

Returns a bounded version of the color with components within [0, 1].

SBDTypeColor SBDTypeColor::bounded () const


function freeze#

Mixes the color with the frozen color.

SBDTypeColor & SBDTypeColor::freeze () 


function frozen#

Returns a frozen version of the color.

SBDTypeColor SBDTypeColor::frozen () const


function getAlpha#

Sets the blue component, the value should be in the [0.0, 1.0] interval.

float SBDTypeColor::getAlpha () const


function getAlphaInt#

Returns the alpha component, the value is in the [0.0, 1.0] interval.

int SBDTypeColor::getAlphaInt () const


function getBlue#

Sets the green component, the value should be in the [0.0, 1.0] interval.

float SBDTypeColor::getBlue () const


function getBlueInt#

Returns the blue component, the value is in the [0.0, 1.0] interval.

int SBDTypeColor::getBlueInt () const


function getColor [1/2]#

Sets the alpha component, the value should be in the [0.0, 1.0] interval.

const float * SBDTypeColor::getColor () const

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.

void SBDTypeColor::getColor (
    float * color
) const


function getGreen#

Sets the red component, the value should be in the [0.0, 1.0] interval.

float SBDTypeColor::getGreen () const


function getGreenInt#

Returns the green component, the value is in the [0.0, 1.0] interval.

int SBDTypeColor::getGreenInt () const


function getRed#

float SBDTypeColor::getRed () const

function getRedInt#

Returns the red component, the value is in the [0.0, 1.0] interval.

int SBDTypeColor::getRedInt () const


function isSerializable#

Returns true.

bool SBDTypeColor::isSerializable () const


function operator!=#

bool SBDTypeColor::operator!= (
    const SBDTypeColor & color
) const

function operator*#

Multiply all components by f , including opacity.

SBDTypeColor SBDTypeColor::operator* (
    float f
) const


function operator*#

Component-wise multiplication by color , including opacity.

SBDTypeColor SBDTypeColor::operator* (
    const SBDTypeColor & color
) const


function operator*=#

Multiply all components by f , including opacity.

SBDTypeColor & SBDTypeColor::operator*= (
    float f
) 


function operator*=#

Component-wise multiplication by color , including opacity.

SBDTypeColor & SBDTypeColor::operator*= (
    const SBDTypeColor & color
) 


function operator+#

Component-wise addition by color , including opacity.

SBDTypeColor SBDTypeColor::operator+ (
    const SBDTypeColor & color
) const


function operator+=#

Component-wise addition by color , including opacity.

SBDTypeColor & SBDTypeColor::operator+= (
    const SBDTypeColor & color
) 


function operator-#

Component-wise subtraction by color , including opacity.

SBDTypeColor SBDTypeColor::operator- (
    const SBDTypeColor & color
) const


function operator-=#

Component-wise subtraction by color , including opacity.

SBDTypeColor & SBDTypeColor::operator-= (
    const SBDTypeColor & color
) 


function operator=#

Copy assignment.

SBDTypeColor & SBDTypeColor::operator= (
    const SBDTypeColor & color
) 


function operator=#

Move assignment.

SBDTypeColor & SBDTypeColor::operator= (
    SBDTypeColor && color
) noexcept


function operator==#

bool SBDTypeColor::operator== (
    const SBDTypeColor & color
) const

function operator[]#

Returns a reference to component index .

float & SBDTypeColor::operator[] (
    int index
) 


function operator[]#

Returns a reference to component index (const version)

const float & SBDTypeColor::operator[] (
    int index
) const


function print#

Prints the color.

virtual void SBDTypeColor::print (
    unsigned int offset=0
) const


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.

void SBDTypeColor::setAlpha (
    int alpha
) 


function setAlpha [2/2]#

Sets the alpha component, the value should be in the [0, 255] interval.

void SBDTypeColor::setAlpha (
    float alpha
) 


function setBlue [1/2]#

Returns the blue component, the value is in the [0, 255] interval.

void SBDTypeColor::setBlue (
    int blue
) 


function setBlue [2/2]#

Sets the blue component, the value should be in the [0, 255] interval.

void SBDTypeColor::setBlue (
    float blue
) 


function setGreen [1/2]#

Returns the green component, the value is in the [0, 255] interval.

void SBDTypeColor::setGreen (
    int green
) 


function setGreen [2/2]#

Sets the green component, the value should be in the [0, 255] interval.

void SBDTypeColor::setGreen (
    float green
) 


function setRed [1/2]#

Returns the red component, the value is in the [0, 255] interval.

void SBDTypeColor::setRed (
    int red
) 


function setRed [2/2]#

Sets the red component, the value should be in the [0, 255] interval.

void SBDTypeColor::setRed (
    float red
) 


function toGrayscale#

Returns the grayscale representation of the color.

double SBDTypeColor::toGrayscale () const

Converts the color to grayscale: Grayscale = 0.299 * R + 0.587 * G + 0.114 * B


function toHex#

Returns the hex representation of the color.

std::string SBDTypeColor::toHex (
    bool includeAlpha=false
) const

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.

virtual std::string SBDTypeColor::toPythonCode () const


function unserialize#

Unserializes the color.

void SBDTypeColor::unserialize (
    SBCSerializer * serializer,
    const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) 


function ~SBDTypeColor#

Destructs the color.

virtual SBDTypeColor::~SBDTypeColor () 


Public Static Functions Documentation#

function CIELabfromCIEXYZ#

Converts CIE XYZ D65/2° to CIE L*a*b*.

static void SBDTypeColor::CIELabfromCIEXYZ (
    float * lab,
    float * XYZ
) 

SBDTypeColor::CIELabfromCIEXYZ - Converts CIE XYZ D65/2° to CIE L*a*b*.

Parameters:

  • 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)

function CIELabfromCylindricalCIELab#

Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to CIE L*a*b*.

static void SBDTypeColor::CIELabfromCylindricalCIELab (
    float * lab,
    float * hcl
) 

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.

static void SBDTypeColor::CIELabfromSRGB (
    float * lab,
    float * rgb
) 

SBDTypeColor::CIELabfromSRGB - Converts standard RGB (sRGB) to CIE L*a*b*.

Parameters:

  • lab - L*a*b* coordinates in the CIE L*a*b* color space
  • rgb - standard RGB (sRGB)

function CIELuvfromCIEXYZ#

Converts CIE XYZ D65/2° to CIE L*u*v*.

static void SBDTypeColor::CIELuvfromCIEXYZ (
    float * luv,
    float * XYZ
) 

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*.

static void SBDTypeColor::CIELuvfromCylindricalCIELuv (
    float * luv,
    float * hcl
) 

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°

static void SBDTypeColor::CIEXYZfromCIELab (
    float * XYZ,
    float * lab
) 

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°

static void SBDTypeColor::CIEXYZfromCIELuv (
    float * XYZ,
    float * luv
) 

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.

static void SBDTypeColor::CIEXYZfromRGB (
    float * XYZ,
    float * rgb
) 

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.

static void SBDTypeColor::CIEXYZfromSRGB (
    float * XYZ,
    float * rgb
) 

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.

static void SBDTypeColor::CIEuvfromCIEXYZ (
    float * uv,
    float * XYZ
) 

SBDTypeColor::CIEuvfromCIEXYZ - An auxiliary function that computes u and v coordinates for the CIE Luv from CIE XYZ.

Parameters:

  • uv - u and v values
  • 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 HCLfromSRGB#

Converts standard RGB (sRGB) color to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)

static void SBDTypeColor::HCLfromSRGB (
    float * hcl,
    float * rgb
) 

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 ... 100
  • rgb - standard RGB (sRGB) color

function HSVfromSRGB#

Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)

static void SBDTypeColor::HSVfromSRGB (
    float * hsv,
    float * rgb
) 

SBDTypeColor::HSVfromSRGB - Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)

Parameters:

  • hsv - hue, saturation, and value
  • rgb - standard RGB (sRGB) color

function RGBfromCIEXYZ#

Converts CIE XYZ with D65/2° standard illuminant to linear RGB.

static void SBDTypeColor::RGBfromCIEXYZ (
    float * rgb,
    float * XYZ
) 

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.

static void SBDTypeColor::RGBfromSRGB (
    float * rgb,
    float * srgb
) 

SBDTypeColor::RGBfromSRGB - Converts standard gamma-corrected RGB values to linear RGB values.

Parameters:

  • rgb - linear RGB
  • srgb - standard RGB (sRGB)

function SRGBfromCIELab#

Converts color from CIE L*a*b* color space to standard RGB (sRGB) color space.

static void SBDTypeColor::SRGBfromCIELab (
    float * rgb,
    float * lab
) 

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)

static void SBDTypeColor::SRGBfromCIEXYZ (
    float * rgb,
    float * XYZ
) 

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)

static void SBDTypeColor::SRGBfromCylindricalCIELab (
    float * rgb,
    float * hcl
) 

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)

static void SBDTypeColor::SRGBfromCylindricalCIELuv (
    float * rgb,
    float * hcl
) 

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.

static void SBDTypeColor::SRGBfromHCL (
    float * rgb,
    float * hcl
) 

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) 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

function SRGBfromHSV#

Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)

static void SBDTypeColor::SRGBfromHSV (
    float * rgb,
    float * hsv
) 

SBDTypeColor::SRGBfromHSV - Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)

Parameters:

  • rgb - standard RGB (sRGB) color
  • hsv - hue, saturation, and value

function SRGBfromRGB#

Converts linear RGB values to standard RGB (sRGB) values.

static void SBDTypeColor::SRGBfromRGB (
    float * srgb,
    float * rgb
) 

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.

static double SBDTypeColor::SRGBtoGrayscale (
    double r,
    double g,
    double b
) 

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)

static void SBDTypeColor::cylindricalCIELabfromCIELab (
    float * hcl,
    float * lab
) 

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 ... 100
  • lab - 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)

static void SBDTypeColor::cylindricalCIELabfromSRGB (
    float * hcl,
    float * rgb
) 

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 ... 100
  • rgb - standard RGB (sRGB)

function cylindricalCIELuvfromCIELuv#

Converts CIE L*u*v* to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)

static void SBDTypeColor::cylindricalCIELuvfromCIELuv (
    float * hcl,
    float * luv
) 

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 ... 100
  • luv - 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)

static void SBDTypeColor::cylindricalCIELuvfromSRGB (
    float * hcl,
    float * rgb
) 

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 ... 100
  • rgb - standard RGB (sRGB)

function darkenSRGBColor#

Darkens the standard RGB (sRGB) color rgb by the amountamount .

static void SBDTypeColor::darkenSRGBColor (
    float * rgb,
    float amount
) 


function fromHCL [1/2]#

Creates a color from a given HCL (CIE LCh_uv) color.

static SBDTypeColor SBDTypeColor::fromHCL (
    float hue,
    float chroma,
    float luminance
) 


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)

static void SBDTypeColor::fromHCL (
    float * color,
    float * hcl
) 

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 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

function fromHSV [1/2]#

Creates a color from a given HSV color.

static SBDTypeColor SBDTypeColor::fromHSV (
    float hue,
    float saturation,
    float value
) 


function fromHSV [2/2]#

Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)

static void SBDTypeColor::fromHSV (
    float * color,
    float * hsv
) 

SBDTypeColor::fromHSV - Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)

Parameters:

  • color - sRGB color as in SBColor
  • hsv - hue, saturation, and value

function lightenSRGBColor#

Lightens the standard RGB (sRGB) color rgb by the amountamount .

static void SBDTypeColor::lightenSRGBColor (
    float * rgb,
    float amount
) 


function toHCL#

Converts sRGB color (as in SBColor) to HCL (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)

static void SBDTypeColor::toHCL (
    float * hcl,
    float * color
) 

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 ... 100
  • color - sRGB color as in SBColor

function toHSV#

Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)

static void SBDTypeColor::toHSV (
    float * hsv,
    float * color
) 

SBDTypeColor::toHSV - Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)

Parameters:

  • hsv - hue, saturation, and value
  • color - sRGB color as in SBColor

Protected Attributes Documentation#

variable dataPointer#

SBDTypeColorData* dataPointer;