Web Analytics Made Easy - Statcounter
Skip to content

Class SBDPaletteSequential#

ClassList > SBDPaletteSequential

The SBDPaletteSequential class is a base class for sequential color palettes.More...

  • #include <SBDPaletteSequential.hpp>

Inherits the following classes: SBDPalette

Inherited by the following classes: SBDPaletteSequentialHCL

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
SBDPaletteSequential ()
Default constructor.
SBDPaletteSequential (int hue1, int hue2, int chroma1=50, int maximumChroma=50, int chroma2=50, int luminance1=70, int luminance2=70, float chromaPower=1.0f, float luminancePower=1.0f, std::string name=std::string(""), bool reverse=false)
Builds a sequential palette with the given parameters.
SBDPaletteSequential (const SBDPaletteSequential & otherColorPalette)
Copy constructor.
virtual SBDPaletteSequential * clone () override const
Clones the color palette.
int getChroma1 () const
Returns the starting value for the second coordinate.
int getChroma2 () const
Returns the end value for the second coordinate.
float getChromaPower () const
Returns the power of the intensity value for the computation of 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 getLuminance1 () const
Returns the starting value for the third coordinate.
int getLuminance2 () const
Returns the end value for the third coordinate.
float getLuminancePower () const
Returns the power of the intensity value for the computation of the third coordinate.
int getMaximumChroma () const
Returns the max value for the second coordinate for the triangular trajectory.
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 chroma1, int maximumChroma, int chroma2, float chromaPower=1.0f)
Sets the parameters for the second coordinate.
void setChroma1 (int chroma1)
Sets the starting value for the second coordinate.
void setChroma2 (int chroma2)
Sets the end value for the second coordinate.
void setChromaPower (float chromaPower)
Sets the power of the intensity value for the computation of the second coordinate, the power should be greater than 0.
void setHue (int hue1, int hue2)
Sets the starting and end values 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 luminance1, int luminance2, float luminancePower=1.0f)
Sets the parameters for the third coordinate.
void setLuminance1 (int luminance1)
Sets the starting value for the third coordinate.
void setLuminance2 (int luminance2)
Sets the end value for the third coordinate.
void setLuminancePower (float luminancePower)
Sets the power of the intensity value for the computation of the third coordinate, the power should be greater than 0.
void setMaximumChroma (int maximumChroma)
Sets the max value for the second coordinate for the triangular trajectory, if it is less the chroma1 or c2 then it is not used and the linear trajectory is computed.
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 ~SBDPaletteSequential ()
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#

Type Name
int chroma1
The starting value for the second coordinate.
int chroma2
The end value for the second coordinate.
float chromaPower
The power of the intensity value for the computation of the second coordinate, the power should be greater than 0.
int hue1
The starting value for the first coordinate.
int hue2
The end value for the first coordinate.
int luminance1
The starting value for the third coordinate.
int luminance2
The end value for the third coordinate.
float luminancePower
The power of the intensity value for the computation of the third coordinate, the power should be greater than 0.
int maximumChroma
The max value for the second coordinate for the triangular trajectory, if it is less the chroma1 or chroma2 then it is not used and the linear trajectory is computed.

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 sequential palette is constructed in a 3D color coordinate space with coordinates named h, c, and l, that are computed as follows:

  • h = hue1 + i * (hue2 - hue1)
  • if Cmax < chroma1 ormaximumChroma < chroma2 then c is computed based on a "linear" trajectory c = chroma1 + i^(chromaPower) * (chroma2 - chroma1), else it is computed based on the triangular trajectory (see SBDPalette::getValueAlongTriangularTrajectory)
  • l = luminance1 + i^(luminancePower) * (luminance2 - luminance1), where i is a value (of intensity) based on which the colorization should be done.

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), lighting (as in HSL color space), or another value (as in HSV color space).

Short name: SBPaletteSequential

Public Functions Documentation#

function SBDPaletteSequential [1/3]#

Default constructor.

SBDPaletteSequential::SBDPaletteSequential () 

Constructs a sequential palette with default parameters.

The palette is initialized with hue range [0, 360], chroma values of 50, luminance values of 70, an empty name, and the reverse flag set to false.


function SBDPaletteSequential [2/3]#

Builds a sequential palette with the given parameters.

SBDPaletteSequential::SBDPaletteSequential (
    int hue1,
    int hue2,
    int chroma1=50,
    int maximumChroma=50,
    int chroma2=50,
    int luminance1=70,
    int luminance2=70,
    float chromaPower=1.0f,
    float luminancePower=1.0f,
    std::string name=std::string(""),
    bool reverse=false
) 

Constructs a sequential palette with the specified parameters.

Parameters:

  • hue1 Starting hue value.
  • hue2 Ending hue value.
  • chroma1 Starting chroma value.
  • maximumChroma Maximum chroma value for the triangular trajectory.
  • chroma2 Ending chroma value.
  • luminance1 Starting luminance value.
  • luminance2 Ending luminance value.
  • chromaPower Power applied to chroma interpolation.
  • luminancePower Power applied to luminance interpolation.
  • name Optional name for the palette.
  • reverse If true, the intensity values are reversed.

function SBDPaletteSequential [3/3]#

Copy constructor.

SBDPaletteSequential::SBDPaletteSequential (
    const SBDPaletteSequential & otherColorPalette
) 

Creates a new sequential palette as a copy of another palette.

Parameters:

  • otherColorPalette The palette to copy.

function clone#

Clones the color palette.

virtual SBDPaletteSequential * SBDPaletteSequential::clone () override const

Creates a deep copy of this palette.

Returns:

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

Implements SBDPalette::clone


function getChroma1#

Returns the starting value for the second coordinate.

int SBDPaletteSequential::getChroma1 () const

Returns the starting chroma value.

Returns:

The chroma1 value.


function getChroma2#

Returns the end value for the second coordinate.

int SBDPaletteSequential::getChroma2 () const

Returns the ending chroma value.

Returns:

The chroma2 value.


function getChromaPower#

Returns the power of the intensity value for the computation of the second coordinate.

float SBDPaletteSequential::getChromaPower () const

Returns the power applied to chroma interpolation.

Returns:

The chromaPower value.


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

Computes the sRGB color for a given intensity value using this palette.

Parameters:

  • color Output array (size >= 3) that receives the computed sRGB color components.
  • value Intensity value in the range [0.0, 1.0] determining the position in the palette.

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

Computes the color coordinates in the palette's color space for a given intensity value.

Parameters:

  • color Output array (size >= 3) that receives the computed color coordinates (e.g., HCL).
  • value Intensity value in the range [0.0, 1.0] determining the position in the palette.

Implements SBDPalette::getColorInPaletteColorSpace


function getHue1#

Returns the starting value for the first coordinate.

int SBDPaletteSequential::getHue1 () const

Returns the starting hue value.

Returns:

The hue1 value.


function getHue2#

Returns the end value for the first coordinate.

int SBDPaletteSequential::getHue2 () const

Returns the ending hue value.

Returns:

The hue2 value.


function getLuminance1#

Returns the starting value for the third coordinate.

int SBDPaletteSequential::getLuminance1 () const

Returns the starting luminance value.

Returns:

The luminance1 value.


function getLuminance2#

Returns the end value for the third coordinate.

int SBDPaletteSequential::getLuminance2 () const

Returns the ending luminance value.

Returns:

The luminance2 value.


function getLuminancePower#

Returns the power of the intensity value for the computation of the third coordinate.

float SBDPaletteSequential::getLuminancePower () const

Returns the power applied to luminance interpolation.

Returns:

The luminancePower value.


function getMaximumChroma#

Returns the max value for the second coordinate for the triangular trajectory.

int SBDPaletteSequential::getMaximumChroma () const

Returns the maximum chroma value used for the triangular trajectory.

Returns:

The maximumChroma value.


function getType#

Returns the type of the color palette.

virtual PaletteType SBDPaletteSequential::getType () override const

Retrieves the type of the palette.

Returns:

The palette type, which is PaletteType::Sequential.

Implements SBDPalette::getType


function isEqual#

Returns whether this palette is equal to other .

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

Determines whether this palette is equal to another palette.

Parameters:

  • other The palette to compare with.

Returns:

true if the palettes have identical parameters; otherwise false.

Implements SBDPalette::isEqual


function isSerializable#

Returns true __

virtual bool SBDPaletteSequential::isSerializable () override const

Indicates whether the palette supports serialization.

Returns:

true, indicating the palette is serializable.

Implements SBDPalette::isSerializable


function serialize#

Serializes the palette.

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

Serializes the palette's data to the given serializer.

Parameters:

  • serializer Pointer to the serializer used for writing the palette data.
  • sdkVersionNumber The SDK version number, used for compatibility checks.
  • classVersionNumber The class version number, used for compatibility checks.

Implements SBDPalette::serialize


function setChroma#

Sets the parameters for the second coordinate.

void SBDPaletteSequential::setChroma (
    int chroma1,
    int maximumChroma,
    int chroma2,
    float chromaPower=1.0f
) 

Sets the chroma parameters for the palette.

Parameters:

  • chroma1 Starting chroma value.
  • maximumChroma Maximum chroma for the triangular trajectory.
  • chroma2 Ending chroma value.
  • chromaPower Power applied to chroma interpolation.

function setChroma1#

Sets the starting value for the second coordinate.

void SBDPaletteSequential::setChroma1 (
    int chroma1
) 

Sets the starting chroma value.

Parameters:

  • chroma1 The chroma value to set as the start.

function setChroma2#

Sets the end value for the second coordinate.

void SBDPaletteSequential::setChroma2 (
    int chroma2
) 

Sets the ending chroma value.

Parameters:

  • chroma2 The chroma value to set as the end.

function setChromaPower#

Sets the power of the intensity value for the computation of the second coordinate, the power should be greater than 0.

void SBDPaletteSequential::setChromaPower (
    float chromaPower
) 

Sets the power applied to chroma interpolation.

Parameters:

  • chromaPower The chroma power; values less than zero are clamped to zero.

function setHue#

Sets the starting and end values for the first coordinate.

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

Sets both the starting and ending hue values.

Parameters:

  • hue1 The starting hue value.
  • hue2 The ending hue value.

function setHue1#

Sets the starting value for the first coordinate.

void SBDPaletteSequential::setHue1 (
    int hue1
) 

Sets the starting hue value.

Parameters:

  • hue1 The hue value to set as the start of the hue range.

function setHue2#

Sets the end value for the first coordinate.

void SBDPaletteSequential::setHue2 (
    int hue2
) 

Sets the ending hue value.

Parameters:

  • hue2 The hue value to set as the end of the hue range.

function setLuminance#

Sets the parameters for the third coordinate.

void SBDPaletteSequential::setLuminance (
    int luminance1,
    int luminance2,
    float luminancePower=1.0f
) 

Sets the luminance parameters for the palette.

Parameters:

  • luminance1 Starting luminance value.
  • luminance2 Ending luminance value.
  • luminancePower Power applied to luminance interpolation.

function setLuminance1#

Sets the starting value for the third coordinate.

void SBDPaletteSequential::setLuminance1 (
    int luminance1
) 

Sets the starting luminance value.

Parameters:

  • luminance1 The starting luminance value.

function setLuminance2#

Sets the end value for the third coordinate.

void SBDPaletteSequential::setLuminance2 (
    int luminance2
) 

Sets the ending luminance value.

Parameters:

  • luminance2 The ending luminance value.

function setLuminancePower#

Sets the power of the intensity value for the computation of the third coordinate, the power should be greater than 0.

void SBDPaletteSequential::setLuminancePower (
    float luminancePower
) 

Sets the power applied to luminance interpolation.

Parameters:

  • luminancePower The luminance power; values less than zero are clamped to zero.

function setMaximumChroma#

Sets the max value for the second coordinate for the triangular trajectory, if it is less the chroma1 or c2 then it is not used and the linear trajectory is computed.

void SBDPaletteSequential::setMaximumChroma (
    int maximumChroma
) 

Sets the maximum chroma value used for the triangular trajectory.

Parameters:

  • maximumChroma The maximum chroma value.

function toPythonCode#

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

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

Generates a Python code representation of the palette.

Returns:

A string containing Python code that can be used to reconstruct this palette.

Implements SBDPalette::toPythonCode


function unserialize#

Unserializes the palette.

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

Deserializes the palette's data from the given serializer.

Parameters:

  • serializer Pointer to the serializer used for reading the palette data.
  • sdkVersionNumber The SDK version number, used for compatibility checks.
  • classVersionNumber The class version number, used for compatibility checks.

Implements SBDPalette::unserialize


function ~SBDPaletteSequential#

Destructor.

virtual SBDPaletteSequential::~SBDPaletteSequential () 


Protected Attributes Documentation#

variable chroma1#

The starting value for the second coordinate.

int SBDPaletteSequential::chroma1;


variable chroma2#

The end value for the second coordinate.

int SBDPaletteSequential::chroma2;


variable chromaPower#

The power of the intensity value for the computation of the second coordinate, the power should be greater than 0.

float SBDPaletteSequential::chromaPower;


variable hue1#

The starting value for the first coordinate.

int SBDPaletteSequential::hue1;


variable hue2#

The end value for the first coordinate.

int SBDPaletteSequential::hue2;


variable luminance1#

The starting value for the third coordinate.

int SBDPaletteSequential::luminance1;


variable luminance2#

The end value for the third coordinate.

int SBDPaletteSequential::luminance2;


variable luminancePower#

The power of the intensity value for the computation of the third coordinate, the power should be greater than 0.

float SBDPaletteSequential::luminancePower;


variable maximumChroma#

The max value for the second coordinate for the triangular trajectory, if it is less the chroma1 or chroma2 then it is not used and the linear trajectory is computed.

int SBDPaletteSequential::maximumChroma;