Chemical Data Processing Library C++ API - Version 1.1.1
Public Member Functions | Static Public Attributes | List of all members
CDPL::Vis::Color Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Color() [1/2]

CDPL::Vis::Color::Color ( )

Constructs and initializes a Color object with all RGBA components set to zero.

◆ Color() [2/2]

CDPL::Vis::Color::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.

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.

Parameters
redThe value of the red color component.
greenThe value of the green color component.
blueThe value of the blue color component.
alphaThe value of the alpha component.

Member Function Documentation

◆ setRed()

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.

Parameters
redThe value of the red color component.

◆ getRed()

double CDPL::Vis::Color::getRed ( ) const

Returns the value of the red color component.

Returns
The value of the red color component.

◆ setGreen()

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.

Parameters
greenThe value of the green color component.

◆ getGreen()

double CDPL::Vis::Color::getGreen ( ) const

Returns the value of the green color component.

Returns
The value of the green color component.

◆ setBlue()

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.

Parameters
blueThe value of the blue color component.

◆ getBlue()

double CDPL::Vis::Color::getBlue ( ) const

Returns the value of the blue color component.

Returns
The value of the blue color component.

◆ setAlpha()

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.

Parameters
alphaThe value of the alpha component.

◆ getAlpha()

double CDPL::Vis::Color::getAlpha ( ) const

Returns the value of the alpha component.

Returns
The value of the alpha component.

◆ setRGBA()

void CDPL::Vis::Color::setRGBA ( double  red,
double  green,
double  blue,
double  alpha = 1.0 
)

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.

Parameters
redThe value of the red color component.
greenThe value of the green color component.
blueThe value of the blue color component.
alphaThe value of the alpha component.

◆ operator==()

bool CDPL::Vis::Color::operator== ( const Color color) const

Equality comparison operator.

Parameters
colorThe other Color object to be compared with.
Returns
true if all pairs of the RGBA components compare equal, false otherwise.

◆ operator!=()

bool CDPL::Vis::Color::operator!= ( const Color color) const

Inequality comparison operator.

The result is equivalent to !(*this == color).

Parameters
colorThe other Color object to be compared with.
Returns
true if at least one pair of the RGBA components compares non-equal, false otherwise.

Member Data Documentation

◆ BLACK

const Color CDPL::Vis::Color::BLACK
static

A preinitialized Color instance for the color black.

◆ WHITE

const Color CDPL::Vis::Color::WHITE
static

A preinitialized Color instance for the color white.

◆ RED

const Color CDPL::Vis::Color::RED
static

A preinitialized Color instance for the color red.

◆ DARK_RED

const Color CDPL::Vis::Color::DARK_RED
static

A preinitialized Color instance for the color dark red.

◆ GREEN

const Color CDPL::Vis::Color::GREEN
static

A preinitialized Color instance for the color green.

◆ DARK_GREEN

const Color CDPL::Vis::Color::DARK_GREEN
static

A preinitialized Color instance for the color dark green.

◆ BLUE

const Color CDPL::Vis::Color::BLUE
static

A preinitialized Color instance for the color blue.

◆ DARK_BLUE

const Color CDPL::Vis::Color::DARK_BLUE
static

A preinitialized Color instance for the color dark blue.

◆ CYAN

const Color CDPL::Vis::Color::CYAN
static

A preinitialized Color instance for the color cyan.

◆ DARK_CYAN

const Color CDPL::Vis::Color::DARK_CYAN
static

A preinitialized Color instance for the color dark cyan.

◆ MAGENTA

const Color CDPL::Vis::Color::MAGENTA
static

A preinitialized Color instance for the color magenta.

◆ DARK_MAGENTA

const Color CDPL::Vis::Color::DARK_MAGENTA
static

A preinitialized Color instance for the color dark magenta.

◆ YELLOW

const Color CDPL::Vis::Color::YELLOW
static

A preinitialized Color instance for the color yellow.

◆ DARK_YELLOW

const Color CDPL::Vis::Color::DARK_YELLOW
static

A preinitialized Color instance for the color dark yellow.

◆ GRAY

const Color CDPL::Vis::Color::GRAY
static

A preinitialized Color instance for the color gray.

◆ LIGHT_GRAY

const Color CDPL::Vis::Color::LIGHT_GRAY
static

A preinitialized Color instance for the color light gray.

◆ DARK_GRAY

const Color CDPL::Vis::Color::DARK_GRAY
static

A preinitialized Color instance for the color dark gray.

◆ TRANSPARENT

const Color CDPL::Vis::Color::TRANSPARENT
static

A preinitialized Color instance for a totally transparent (alpha = 0) black.


The documentation for this class was generated from the following file: