Web Analytics Made Easy - Statcounter
Skip to content

Class SBDPaletteQualitativeHCL#

ClassList > SBDPaletteQualitativeHCL

The SBDPaletteQualitativeHCL class is a class for the qualitative HCL (Hue-Chroma-Luminance) color palette.More...

  • #include <SBDPaletteQualitativeHCL.hpp>

Inherits the following classes: SBDPaletteQualitative

Public Types inherited from SBDPalette#

See SBDPalette

Type Name
enum PaletteType
The three different types of palettes - qualitative, sequential, and diverging - are all constructed by combining three different types of trajectories (constant, linear, triangular) for the three different coordinates in the given color space (e.h.: hue H, chroma C, luminance L)

Public Functions#

Type Name
SBDPaletteQualitativeHCL ()
Default constructor.
SBDPaletteQualitativeHCL (int hue1, int hue2, int chroma=50, int luminance=70, std::string name=std::string(""), bool reverse=false)
Builds a qualitative HCL palette with the given parameters.
SBDPaletteQualitativeHCL (const SBDPaletteQualitativeHCL & otherColorPalette)
Copy constructor.
virtual SBDPaletteQualitativeHCL * clone () override const
Clones the color palette.
virtual void getColor (float * color, float value) override const
Computes sRGB color color based on this palette for the given intensity valuevalue which should be in the range [0.0, 1.0].
virtual void getColorInPaletteColorSpace (float * color, float value) override const
Computes color coordinates color in this palette's color space for the given intensity valuevalue which should be in the range [0.0, 1.0].
virtual bool isSerializable () override const
Returns true __
virtual void serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber & classVersionNumber=SBVersionNumber(1, 0, 0)) override const
Serializes the palette.
virtual std::string toPythonCode () override const
Returns the string representation of the object that can be used to reconstruct it in Python.
virtual void unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber & classVersionNumber=SBVersionNumber(1, 0, 0)) override
Unserializes the palette.
virtual ~SBDPaletteQualitativeHCL ()
Destructor.

Public Functions inherited from SBDPaletteQualitative#

See SBDPaletteQualitative

Type Name
SBDPaletteQualitative ()
Default constructor.
SBDPaletteQualitative (int hue1, int hue2, int chroma=50, int luminance=70, std::string name=std::string(""), bool reverse=false)
Builds a qualitative palette with the given parameters.
SBDPaletteQualitative (const SBDPaletteQualitative & otherColorPalette)
Copy constructor.
virtual SBDPaletteQualitative * clone () override const
Clones the color palette.
int getChroma () const
Returns the value for the second coordinate.
virtual void getColor (float * color, float value) override const
Computes sRGB color color based on this palette for the given intensity valuevalue which should be in the range [0.0, 1.0].
virtual void getColorInPaletteColorSpace (float * color, float value) override const
Computes color coordinates color in this palette's color space for the given intensity valuevalue which should be in the range [0.0, 1.0].
int getHue1 () const
Returns the starting value for the first coordinate.
int getHue2 () const
Returns the end value for the first coordinate.
int getLuminance () const
Returns the value for the third coordinate.
virtual PaletteType getType () override const
Returns the type of the color palette.
virtual bool isEqual (const SBDPalette & other) override const
Returns whether this palette is equal to other .
virtual bool isSerializable () override const
Returns true __
virtual void serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber & classVersionNumber=SBVersionNumber(1, 0, 0)) override const
Serializes the palette.
void setChroma (int chroma)
Sets the value for the second coordinate.
void setHue (int hue1, int hue2)
Sets the parameters for the first coordinate.
void setHue1 (int hue1)
Sets the starting value for the first coordinate.
void setHue2 (int hue2)
Sets the end value for the first coordinate.
void setLuminance (int luminance)
Sets the value for the third coordinate.
virtual std::string toPythonCode () override const
Returns the string representation of the object that can be used to reconstruct it in Python.
virtual void unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber & classVersionNumber=SBVersionNumber(1, 0, 0)) override
Unserializes the palette.
virtual ~SBDPaletteQualitative ()
Destructor.

Public Functions inherited from SBDPalette#

See SBDPalette

Type Name
SBDPalette ()
Default constructor for HSV color palette.
SBDPalette (bool reverse)
Constructor for HSV color palette with reverse flag.
virtual SBDPalette * clone () const
Clones the palette.
SBColor getColor (float value) const
Returns SBColor based on the palette and an intensity value value .
virtual void getColor (float * color, float value) const
Computes RGB color color based on the palette and an intensity valuevalue which should be in the range [0.0, 1.0].
virtual void getColorInPaletteColorSpace (float * color, float value) const
Computes color coordinates color in this palette's color space for the given intensity valuevalue which should be in the range [0.0, 1.0].
const std::string & getName () const
Returns the palette's name.
bool getReverseFlag () const
Returns the reverse flag - whether the color palette is mirrored or not.
virtual PaletteType getType () const
Returns the type of the color palette.
std::string getTypeString (bool humanReadable=false) const
Returns the string representation of the color palette type.
virtual bool isEqual (const SBDPalette & other) const
Returns whether this palette is equal to other .
virtual bool isSerializable () const
Returns true __
bool operator!= (const SBDPalette & other) const
Inequality operator.
bool operator== (const SBDPalette & other) const
Equality operator.
virtual void serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber & classVersionNumber=SBVersionNumber(1, 0, 0)) const
Serializes the document.
void setName (const std::string & name)
Sets the palette's name to name .
void setReverseFlag (bool b)
Sets the reverse flag - whether to mirror or not the color palette.
virtual std::string toPythonCode () const
Returns the string representation of the object that can be used to reconstruct it in Python.
virtual void unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber & classVersionNumber=SBVersionNumber(1, 0, 0))
Unserializes the document.
virtual ~SBDPalette ()
Destructor.

Public Static Functions inherited from SBDPalette#

See SBDPalette

Type Name
std::string getTypeString (PaletteType paletteType, bool humanReadable=false)
Returns the string representation of the color palette type paletteType .
float getValueAlongLinearTrajectory (float y1, float y2, float power, float x)
Returns a value along the "linear" trajectory.
float getValueAlongTriangularTrajectory (float y1, float ymax, float y2, float power, float x)
Returns a value along "triangular" trajectory.

Protected Attributes inherited from SBDPaletteQualitative#

See SBDPaletteQualitative

Type Name
int chroma
The value of the second coordinate.
int hue1
The starting value for the first coordinate.
int hue2
The end value for the first coordinate.
int luminance
The value of the third coordinate.

Protected Attributes inherited from SBDPalette#

See SBDPalette

Type Name
std::string * name
The palette's name.
bool reverseFlag
Reverse flag: if true, then the palette is reversed/mirrored.

Detailed Description#

A qualitative HCL palette is constructed in a 3D color coordinate space with coordinates named Hue, Chroma, and Luminance, where the coordinate Hue can have an arbitrary value, and coordinates Chroma and Luminance are constant:

  • hue = hue1 + i * (hue2 - hue1), where i is a value (of intensity) based on which the colorization should be done.
  • chroma is constant
  • luminance is constant

Short name: SBPaletteQualitativeHCL

Public Functions Documentation#

function SBDPaletteQualitativeHCL [1/3]#

Default constructor.

SBDPaletteQualitativeHCL::SBDPaletteQualitativeHCL () 

Constructs a qualitative HCL palette with default parameters: hue range 0-360, chroma 50, luminance 70.


function SBDPaletteQualitativeHCL [2/3]#

Builds a qualitative HCL palette with the given parameters.

SBDPaletteQualitativeHCL::SBDPaletteQualitativeHCL (
    int hue1,
    int hue2,
    int chroma=50,
    int luminance=70,
    std::string name=std::string(""),
    bool reverse=false
) 

Constructs a qualitative HCL palette with the specified parameters.

Parameters:

  • hue1 The starting hue value.
  • hue2 The ending hue value.
  • chroma The chroma (colorfulness) value, default 50.
  • luminance The luminance (lightness) value, default 70.
  • name Optional name for the palette.
  • reverse If true, the hue progression is reversed.

function SBDPaletteQualitativeHCL [3/3]#

Copy constructor.

SBDPaletteQualitativeHCL::SBDPaletteQualitativeHCL (
    const SBDPaletteQualitativeHCL & otherColorPalette
) 

Creates a new palette as a copy of otherColorPalette.

Parameters:

  • otherColorPalette The palette to copy.

function clone#

Clones the color palette.

virtual SBDPaletteQualitativeHCL * SBDPaletteQualitativeHCL::clone () override const

Creates a copy of this palette.

Returns:

A pointer to a new SBDPaletteQualitativeHCL object that is a copy of this palette.

Implements SBDPaletteQualitative::clone


function getColor#

Computes sRGB color color based on this palette for the given intensity valuevalue which should be in the range [0.0, 1.0].

virtual void SBDPaletteQualitativeHCL::getColor (
    float * color,
    float value
) override const

Computes the sRGB color for the given intensity value based on this palette.

The resulting color is written to color as three floating-point components (R, G, B).

Parameters:

  • color Output array to receive the sRGB color (size >= 3). Must not be null.
  • value Intensity value in the range [0.0, 1.0] that determines the color.

Implements SBDPaletteQualitative::getColor


function getColorInPaletteColorSpace#

Computes color coordinates color in this palette's color space for the given intensity valuevalue which should be in the range [0.0, 1.0].

virtual void SBDPaletteQualitativeHCL::getColorInPaletteColorSpace (
    float * color,
    float value
) override const

Computes color coordinates in the HCL color space for the given intensity value.

The output is stored in color, which must have space for at least three components.

Parameters:

  • color An array that receives the HCL color coordinates (size >= 3).
  • value The intensity value in the range [0.0, 1.0] that determines the color.

Implements SBDPaletteQualitative::getColorInPaletteColorSpace


function isSerializable#

Returns true __

virtual bool SBDPaletteQualitativeHCL::isSerializable () override const

Indicates whether the palette supports serialization.

Returns:

true if the palette can be serialized; otherwise false.

Implements SBDPaletteQualitative::isSerializable


function serialize#

Serializes the palette.

virtual void SBDPaletteQualitativeHCL::serialize (
    SBCSerializer * serializer,
    const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER,
    const SBVersionNumber & classVersionNumber=SBVersionNumber (1, 0, 0)
) override const

Serializes the palette to the provided serializer.

This method writes the palette data using the given SDK and class version numbers.

Parameters:

  • serializer Pointer to the serializer used to write the data.
  • sdkVersionNumber The version of the SDK to target.
  • classVersionNumber The version of the class format to use.

Implements SBDPaletteQualitative::serialize


function toPythonCode#

Returns the string representation of the object that can be used to reconstruct it in Python.

virtual std::string SBDPaletteQualitativeHCL::toPythonCode () override const

Returns a Python code string that can reconstruct this palette.

The returned string can be evaluated in Python to create an equivalent palette object.

Returns:

A string containing Python code for this palette.

Implements SBDPaletteQualitative::toPythonCode


function unserialize#

Unserializes the palette.

virtual void SBDPaletteQualitativeHCL::unserialize (
    SBCSerializer * serializer,
    const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER,
    const SBVersionNumber & classVersionNumber=SBVersionNumber (1, 0, 0)
) override

Deserializes the palette from the provided serializer.

This method reads the palette data using the given SDK and class version numbers.

Parameters:

  • serializer Pointer to the serializer used to read the data.
  • sdkVersionNumber The version of the SDK being used.
  • classVersionNumber The version of the class format being read.

Implements SBDPaletteQualitative::unserialize


function ~SBDPaletteQualitativeHCL#

Destructor.

virtual SBDPaletteQualitativeHCL::~SBDPaletteQualitativeHCL ()