Chemical Data Processing Library C++ API - Version 1.1.1
|
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparency. More...
#include <Color.hpp>
Public Member Functions | |
Color () | |
Constructs and initializes a Color object with all RGBA components set to zero. More... | |
Color (double red, double green, double blue, double alpha=1.0) | |
Constructs and initializes a Color object with the RGBA components set to the specified values. More... | |
void | setRed (double red) |
Sets the value of the red color component to red. More... | |
double | getRed () const |
Returns the value of the red color component. More... | |
void | setGreen (double green) |
Sets the the value of green color component to green. More... | |
double | getGreen () const |
Returns the value of the green color component. More... | |
void | setBlue (double blue) |
Sets the value of the blue color component to blue. More... | |
double | getBlue () const |
Returns the value of the blue color component. More... | |
void | setAlpha (double alpha) |
Sets the value of the alpha component to alpha. More... | |
double | getAlpha () const |
Returns the value of the alpha component. More... | |
void | setRGBA (double red, double green, double blue, double alpha=1.0) |
Sets the values of the RGBA components to specified values. More... | |
bool | operator== (const Color &color) const |
Equality comparison operator. More... | |
bool | operator!= (const Color &color) const |
Inequality comparison operator. More... | |
Static Public Attributes | |
static const Color | BLACK |
A preinitialized Color instance for the color black. More... | |
static const Color | WHITE |
A preinitialized Color instance for the color white. More... | |
static const Color | RED |
A preinitialized Color instance for the color red. More... | |
static const Color | DARK_RED |
A preinitialized Color instance for the color dark red. More... | |
static const Color | GREEN |
A preinitialized Color instance for the color green. More... | |
static const Color | DARK_GREEN |
A preinitialized Color instance for the color dark green. More... | |
static const Color | BLUE |
A preinitialized Color instance for the color blue. More... | |
static const Color | DARK_BLUE |
A preinitialized Color instance for the color dark blue. More... | |
static const Color | CYAN |
A preinitialized Color instance for the color cyan. More... | |
static const Color | DARK_CYAN |
A preinitialized Color instance for the color dark cyan. More... | |
static const Color | MAGENTA |
A preinitialized Color instance for the color magenta. More... | |
static const Color | DARK_MAGENTA |
A preinitialized Color instance for the color dark magenta. More... | |
static const Color | YELLOW |
A preinitialized Color instance for the color yellow. More... | |
static const Color | DARK_YELLOW |
A preinitialized Color instance for the color dark yellow. More... | |
static const Color | GRAY |
A preinitialized Color instance for the color gray. More... | |
static const Color | LIGHT_GRAY |
A preinitialized Color instance for the color light gray. More... | |
static const Color | DARK_GRAY |
A preinitialized Color instance for the color dark gray. More... | |
static const Color | TRANSPARENT |
A preinitialized Color instance for a totally transparent (alpha = 0) black. More... | |
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparency.
Each component of the RGBA quadruplet is represented by a double precision floating-point value in the interval [0, 1], where 0 corresponds to the lowest (zero) intensity of a color component and the value 1 represents the highest intensity. Likewise, a value of 1 for the alpha-channel corresponds to complete opaqueness and 0 represents complete transparency.
CDPL::Vis::Color::Color | ( | ) |
Constructs and initializes a Color
object with all RGBA components set to zero.
Constructs and initializes a Color
object with the RGBA components set to the specified values.
Component values outside the interval [0, 1] are clamped to the nearest interval bound, i.e. 0 if the value is negative and 1 if the value is greater than one.
red | The value of the red color component. |
green | The value of the green color component. |
blue | The value of the blue color component. |
alpha | The value of the alpha component. |
void CDPL::Vis::Color::setRed | ( | double | red | ) |
Sets the value of the red color component to red.
If red is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if red is negative and 1 if red is greater than one.
red | The value of the red color component. |
double CDPL::Vis::Color::getRed | ( | ) | const |
Returns the value of the red color component.
void CDPL::Vis::Color::setGreen | ( | double | green | ) |
Sets the the value of green color component to green.
If green is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if green is negative and 1 if green is greater than one.
green | The value of the green color component. |
double CDPL::Vis::Color::getGreen | ( | ) | const |
Returns the value of the green color component.
void CDPL::Vis::Color::setBlue | ( | double | blue | ) |
Sets the value of the blue color component to blue.
If blue is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if blue is negative and 1 if blue is greater than one.
blue | The value of the blue color component. |
double CDPL::Vis::Color::getBlue | ( | ) | const |
Returns the value of the blue color component.
void CDPL::Vis::Color::setAlpha | ( | double | alpha | ) |
Sets the value of the alpha component to alpha.
If alpha is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if alpha is negative and 1 if alpha is greater than one.
alpha | The value of the alpha component. |
double CDPL::Vis::Color::getAlpha | ( | ) | const |
Returns the value of the alpha component.
Sets the values of the RGBA components to specified values.
Component values outside the interval [0, 1] are clamped to the nearest interval bound, i.e. 0 if the value is negative and 1 if the value is greater than one.
red | The value of the red color component. |
green | The value of the green color component. |
blue | The value of the blue color component. |
alpha | The value of the alpha component. |
Equality comparison operator.
color | The other Color object to be compared with. |
true
if all pairs of the RGBA components compare equal, false
otherwise. Inequality comparison operator.
The result is equivalent to !(*this == color)
.
color | The other Color object to be compared with. |
true
if at least one pair of the RGBA components compares non-equal, false
otherwise.
|
static |
A preinitialized Color
instance for the color black.
|
static |
A preinitialized Color
instance for the color white.
|
static |
A preinitialized Color
instance for the color red.
|
static |
A preinitialized Color
instance for the color dark red.
|
static |
A preinitialized Color
instance for the color green.
|
static |
A preinitialized Color
instance for the color dark green.
|
static |
A preinitialized Color
instance for the color blue.
|
static |
A preinitialized Color
instance for the color dark blue.
|
static |
A preinitialized Color
instance for the color cyan.
|
static |
A preinitialized Color
instance for the color dark cyan.
|
static |
A preinitialized Color
instance for the color magenta.
|
static |
A preinitialized Color
instance for the color dark magenta.
|
static |
A preinitialized Color
instance for the color yellow.
|
static |
A preinitialized Color
instance for the color dark yellow.
|
static |
A preinitialized Color
instance for the color gray.
|
static |
A preinitialized Color
instance for the color light gray.
|
static |
A preinitialized Color
instance for the color dark gray.
|
static |
A preinitialized Color
instance for a totally transparent (alpha = 0) black.