The SBDPaletteSequential class is a base class for sequential color palettes. More...
Constructors and destructors | |
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("")) | |
SBDPaletteSequential (const SBDPaletteSequential &otherColorPalette) | |
Copy constructor. | |
virtual | ~SBDPaletteSequential () |
Serialization | |
virtual bool | isSerializable () const override |
Returns true. | |
virtual void | serialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber &classVersionNumber=SBVersionNumber(1, 0, 0)) const override |
Serializes the document. | |
virtual void | unserialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER, const SBVersionNumber &classVersionNumber=SBVersionNumber(1, 0, 0)) override |
Unserializes the document. | |
Cloning | |
virtual SBDPaletteSequential * | clone () const override |
Clones the color palette. | |
Getter and setter functions | |
int | getHue1 () const |
Returns the starting value for the first coordinate. | |
void | setHue1 (int hue1) |
Sets the starting value for the first coordinate. | |
int | getHue2 () const |
Returns the end value for the first coordinate. | |
void | setHue2 (int hue2) |
Sets the end value for the first coordinate. | |
void | setHue (int hue1, int hue2) |
Sets the starting and end values for the first coordinate. | |
int | getChroma1 () const |
Returns the starting value for the second coordinate. | |
void | setChroma1 (int chroma1) |
Sets the starting value for the second coordinate. | |
int | getChroma2 () const |
Returns the end value for the second coordinate. | |
void | setChroma2 (int chroma2) |
Sets the end value for the second coordinate. | |
int | getMaximumChroma () const |
Returns the max value for the second coordinate for the triangular trajectory. | |
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. | |
float | getChromaPower () const |
Returns the power of the intensity value for the computation of 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 | setChroma (int chroma1, int maximumChroma, int chroma2, float chromaPower=1.0f) |
Sets the parameters for the second coordinate. | |
int | getLuminance1 () const |
Returns the starting value for the third coordinate. | |
void | setLuminance1 (int luminance1) |
Sets the starting value for the third coordinate. | |
int | getLuminance2 () const |
Returns the end value for the third coordinate. | |
void | setLuminance2 (int luminance2) |
Sets the end value for the third coordinate. | |
float | getLuminancePower () const |
Returns the power of the intensity value for the computation of 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 | setLuminance (int luminance1, int luminance2, float luminancePower=1.0f) |
Sets the parameters for the third coordinate. | |
Palette functions | |
virtual void | getColor (float *color, float value) const override |
Computes sRGB color color based on this palette for the given intensity value value which should be in the range [0.0, 1.0]. | |
virtual void | getColorInPaletteColorSpace (float *color, float value) const override |
Computes color coordinates color in this palette's color space for the given intensity value value which should be in the range [0.0, 1.0]. | |
Additional Inherited Members | |
Public Types inherited from SBDPalette | |
enum class | PaletteType { Custom , Qualitative , Sequential , Diverging , FlexibleDiverging } |
Public Member Functions inherited from SBDPalette | |
SBDPalette () | |
Default constructor. | |
virtual | ~SBDPalette () |
PaletteType | getType () const |
Returns the type of the color palette. | |
void | setType (SBDPalette::PaletteType paletteType) |
Sets the type of the color palette. | |
const std::string & | getName () const |
Returns the palette's name. | |
void | setName (const std::string &name) |
Sets the palette's name to name . | |
bool | getReverseFlag () const |
Returns the reverse flag - whether the color palette is mirrored or not. | |
void | setReverseFlag (bool b) |
Sets the reverse flag - whether to mirror or not the color palette. | |
SBColor | getColor (float value) const |
Returns SBColor based on the palette and an intensity value value . | |
Static Public Member Functions inherited from SBDPalette | |
static float | getValueAlongLinearTrajectory (float y1, float y2, float power, float x) |
Returns a value along the "linear" trajectory. | |
static float | getValueAlongTriangularTrajectory (float y1, float ymax, float y2, float power, float x) |
Returns a value along "triangular" trajectory. | |
Protected Attributes inherited from SBDPalette | |
PaletteType | paletteType |
The palette's type. | |
std::string * | name |
The palette's name. | |
bool | reverseFlag |
Reverse flag: if true, then the palette is reversed/mirrored. | |
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 or maximumChroma < 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), lightning (as in HSL color space), or another value (as in HSV color space).
|
overridevirtual |
Reimplemented from SBDPalette.
Reimplemented in SBDPaletteSequentialHCL.
|
overridevirtual |
Reimplemented from SBDPalette.
Reimplemented in SBDPaletteSequentialHCL.
|
overridevirtual |
SBDPaletteSequential::getColorInPaletteColorSpace - Computes color coordinates color
in this palette's color space for the given intensity value value
.
color | - an array for color coordinates (float[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. |
Reimplemented from SBDPalette.
Reimplemented in SBDPaletteSequentialHCL.
|
overridevirtual |
Reimplemented from SBDPalette.
Reimplemented in SBDPaletteSequentialHCL.
|
overridevirtual |
Reimplemented from SBDPalette.
Reimplemented in SBDPaletteSequentialHCL.
|
overridevirtual |
Reimplemented from SBDPalette.
Reimplemented in SBDPaletteSequentialHCL.