Web Analytics Made Easy - Statcounter
Skip to content

Class SBDPaletteQualitative#

ClassList > SBDPaletteQualitative

The SBDPaletteQualitative class is a base class for qualitative color palettes.More...

  • #include <SBDPaletteQualitative.hpp>

Inherits the following classes: SBDPalette

Inherited by the following classes: SBDPaletteQualitativeHCL

Public Types inherited from SBDPalette#

See SBDPalette

Type Name
enum PaletteType

Public Functions#

Type Name
SBDPaletteQualitative ()
Default constructor.
SBDPaletteQualitative (int hue1, int hue2, int chroma=50, int luminance=70, std::string name=std::string(""), bool reverse=false)
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 document.
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 () 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 document.
virtual ~SBDPaletteQualitative ()

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
Non-equality 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 ()

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#

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 palette is constructed in a 3D color coordinate space with coordinates named h, c, and l, where the coordinate h can have an arbitrary value, and coordinates c and l are constant:

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

Coordinate h can designate e.g. hue (as in HCL, HSV, HSL color spaces).

Coordinate c can designate e.g. chroma (as in HCL color space) or saturation (as in HSV, HSL color spaces).

Coordinate l can designate e.g. luminance (as in HCL color space), lightning (as in HSL color space), or another value (as in HSV color space).

Short name: SBPaletteQualitative

Public Functions Documentation#

function SBDPaletteQualitative [1/3]#

Default constructor.

SBDPaletteQualitative::SBDPaletteQualitative () 


function SBDPaletteQualitative [2/3]#

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

function SBDPaletteQualitative [3/3]#

Copy constructor.

SBDPaletteQualitative::SBDPaletteQualitative (
    const SBDPaletteQualitative & otherColorPalette
) 


function clone#

Clones the color palette.

virtual SBDPaletteQualitative * SBDPaletteQualitative::clone () override const

Implements SBDPalette::clone


function getChroma#

Returns the value for the second coordinate.

int SBDPaletteQualitative::getChroma () const


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 SBDPaletteQualitative::getColor (
    float * color,
    float value
) override const

Implements SBDPalette::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 SBDPaletteQualitative::getColorInPaletteColorSpace (
    float * color,
    float value
) override const

SBDPaletteQualitative::getColorInPaletteColorSpace - Computes color coordinates color in this palette's color space for the given intensity value value.

Parameters:

  • color - an array for color coordinates with the size greater than or equal to 3.
  • value - an intensity value based on which the resulting color is computed, the intensity value should be in range [0.0, 1.0] where 1 corresponds to the full intensity.

Implements SBDPalette::getColorInPaletteColorSpace


function getHue1#

Returns the starting value for the first coordinate.

int SBDPaletteQualitative::getHue1 () const


function getHue2#

Returns the end value for the first coordinate.

int SBDPaletteQualitative::getHue2 () const


function getLuminance#

Returns the value for the third coordinate.

int SBDPaletteQualitative::getLuminance () const


function getType#

Returns the type of the color palette.

virtual PaletteType SBDPaletteQualitative::getType () override const

Implements SBDPalette::getType


function isEqual#

Returns whether this palette is equal to other .

virtual bool SBDPaletteQualitative::isEqual (
    const SBDPalette & other
) override const

Implements SBDPalette::isEqual


function isSerializable#

Returns true.

virtual bool SBDPaletteQualitative::isSerializable () override const

Implements SBDPalette::isSerializable


function serialize#

Serializes the document.

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

Implements SBDPalette::serialize


function setChroma#

Sets the value for the second coordinate.

void SBDPaletteQualitative::setChroma (
    int chroma
) 


function setHue#

Sets the parameters for the first coordinate.

void SBDPaletteQualitative::setHue (
    int hue1,
    int hue2
) 


function setHue1#

Sets the starting value for the first coordinate.

void SBDPaletteQualitative::setHue1 (
    int hue1
) 


function setHue2#

Sets the end value for the first coordinate.

void SBDPaletteQualitative::setHue2 (
    int hue2
) 


function setLuminance#

Sets the value for the third coordinate.

void SBDPaletteQualitative::setLuminance (
    int luminance
) 


function toPythonCode#

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

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

Implements SBDPalette::toPythonCode


function unserialize#

Unserializes the document.

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

Implements SBDPalette::unserialize


function ~SBDPaletteQualitative#

virtual SBDPaletteQualitative::~SBDPaletteQualitative () 

Protected Attributes Documentation#

variable chroma#

The value of the second coordinate.

int chroma;


variable hue1#

The starting value for the first coordinate.

int hue1;


variable hue2#

The end value for the first coordinate.

int hue2;


variable luminance#

The value of the third coordinate.

int luminance;