Loading...
Searching...
No Matches
BALL::VIEW::ColorRGBA Class Reference
Visualisation » Datatypes for the VIEW framework » Different color classes

`#include <BALL/VIEW/DATATYPE/colorRGBA.h>`

## Public Member Functions

Constructors
| ColorRGBA ()
| ColorRGBA (const ColorRGBA &color)
| ColorRGBA (const ColorHSV &color)
| ColorRGBA (const char *value)
| ColorRGBA (const String &value)
| ColorRGBA (const ColorUnit &red_value, const ColorUnit &green_value, const ColorUnit &blue_value, const ColorUnit &alpha_value=(float) 1)
| ColorRGBA (const QColor &color)
| Assignment from a QT QColor.
| ColorRGBA (const QColor &color, const ColorUnit &alpha)
| Assignment from a QT QColor.
Destructors
| ~ColorRGBA ()
void | clear ()
Converters
| operator String () const
Assignment methods
void | set (const ColorRGBA &color)
const ColorRGBA & | operator= (const ColorRGBA &color)
void | set (const ColorHSV &color)
const ColorRGBA & | operator= (const ColorHSV &color)
void | get (ColorHSV &color) const
void | set (const char *value)
const ColorRGBA & | operator= (const char *value)
void | get (char *value) const
void | set (const String &value)
const ColorRGBA & | operator= (const String &value)
void | get (String &value) const
void | get (QColor &color) const
| Assign to a QT QColor.
bool | set (const QColor &color)
QColor | getQColor () const
| Get a QColor representing this color.
void | swap (ColorRGBA &color)
Accessors: inspectors and mutators
void | setRed (const ColorUnit &red_value)
ColorUnit & | getRed ()
const ColorUnit & | getRed () const
void | setGreen (const ColorUnit &green_value)
ColorUnit & | getGreen ()
const ColorUnit & | getGreen () const
void | setBlue (const ColorUnit &blue_value)
ColorUnit & | getBlue ()
const ColorUnit & | getBlue () const
void | setAlpha (const ColorUnit &alpha_value)
ColorUnit & | getAlpha ()
const ColorUnit & | getAlpha () const
void | set (const ColorUnit &red_value, const ColorUnit &green_value, const ColorUnit &blue_value, const ColorUnit &alpha_value=(float) 1)
void | get (ColorUnit &red_value, ColorUnit &green_value, ColorUnit &blue_value, ColorUnit &alpha_value) const
void | get (ColorUnit &red_value, ColorUnit &green_value, ColorUnit &blue_value) const
ColorRGBA | getInverseColor () const
Predicates
bool | operator== (const ColorRGBA &color) const
bool | operator!= (const ColorRGBA &color) const
bool | operator< (const ColorRGBA &color) const
bool | operator<= (const ColorRGBA &color) const
bool | operator> (const ColorRGBA &color) const
bool | operator>= (const ColorRGBA &color) const
debuggers and diagnostics
void | dump (std::ostream &s=std::cout, Size depth=0) const

## Friends

Class friends

- class ColorHSV

class | ColorHSV

## Storers

BALL_VIEW_EXPORT std::istream & | operator>> (std::istream &s, ColorRGBA &color)
BALL_VIEW_EXPORT std::ostream & | operator<< (std::ostream &s, const ColorRGBA &color)

## Detailed Description

ColorRGBA class. An instance of ColorRGBA represents a color consisting of the components red, green, blue and alpha. The components are ColorUnit 's, which allow many types of input parameters. See description of this class for further informations.

Definition at line 31 of file colorRGBA.h.

## Constructor & Destructor Documentation

## ColorRGBA() [1/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( |  | ) |

Default Constructor. Initialized with color black (red=0, green=0, blue=0, alpha=1).

## ColorRGBA() [2/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const ColorRGBA & | color | ) |

Copy constructor.

## ColorRGBA() [3/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const ColorHSV & | color | ) |

Constructor with ColorHSV.

See also
  ColorHSV

## ColorRGBA() [4/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const char * | value | ) |

Constructor with Parameter char*. Constructs new colorRGBA by initialising its value with the given pointer to a string representing a color value in hex format. The length of the string can either be 6 or 8 characters depending whether the alpha component should be considered. If the string is only 6 characters long the alpha component will be set to 1.0.

Parameters

  value | the pointer to a string representing a color

Exceptions

  InvalidRange | if string length != 6 && string length != 8
  NotInHexFormat | if the string is not a valid hex format string

Returns
  ColorRGBA new constructed colorRGBA

## ColorRGBA() [5/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const String & | value | ) |

Constructor with Parameter string. Same as constructor with parameter char*.

Parameters

  value | a string representing a color

Exceptions

  InvalidRange | if string length != 6 && string length != 8
  NotInHexFormat | if the string is not a valid hex format string

Returns
  ColorRGBA new constructed colorRGBA

## ColorRGBA() [6/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const ColorUnit & | red_value,
|  | const ColorUnit & | green_value,
|  | const ColorUnit & | blue_value,
|  | const ColorUnit & | alpha_value = (float) 1 )

Detailed component initializing constructor.

Parameters

  red_value | the red component.
  green_value | the green component.
  blue_value | the blue component.
  alpha_value | the alpha component. Default value 1.0

See also
  ColorUnit

## ColorRGBA() [7/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const QColor & | color | ) |

Assignment from a QT QColor.

## ColorRGBA() [8/8]

BALL::VIEW::ColorRGBA::ColorRGBA | ( | const QColor & | color,
|  | const ColorUnit & | alpha )

Assignment from a QT QColor.

## ~ColorRGBA()

BALL::VIEW::ColorRGBA::~ColorRGBA | ( |  | ) |

Destructor.

## Member Function Documentation

## clear()

void BALL::VIEW::ColorRGBA::clear | ( |  | ) |

Explicit default initialization. Sets the color of this colorRGBA to the default color (black). The value of this colorRGBA is:

- red component is zero (0)
- green component is zero (0)
- blue component is zero (0)
- alpha component is 1 (1.0)

## dump()

void BALL::VIEW::ColorRGBA::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

Internal value dump. Dumps the current color of this colorRGBA to the output ostream s with dumping depth depth.

Parameters

  s | output stream where to output the color of this colorRGBA
  depth | the dumping depth

See also
  ColorUnit::dump

## get() [1/6]

void BALL::VIEW::ColorRGBA::get | ( | char * | value | ) | const

Copying to char*. Copies the color to the string represented by a pointer. Calls set. At least 9 bytes must be allocated for the string. The format of the string is the same as the one given to the constructor.

Parameters

  value | the pointer to string (at least 9 bytes long)

See also
  set

## get() [2/6]

void BALL::VIEW::ColorRGBA::get | ( | ColorHSV & | color | ) | const

Copying to ColorHSV.

## get() [3/6]

void BALL::VIEW::ColorRGBA::get | ( | ColorUnit & | red_value,
|  | ColorUnit & | green_value,
|  | ColorUnit & | blue_value ) const

Inspection of the colorRGBA's components. Accesses only the red, green and blue components of this colorRGBA by using ColorUnit's.

Parameters

  red_value | the colorUnit receiving the red component of this colorRGBA
  green_value | the colorUnit receiving the green component of this colorRGBA
  blue_value | the colorUnit receiving the blue component of this colorRGBA

See also
  set
  ColorUnit

## get() [4/6]

void BALL::VIEW::ColorRGBA::get | ( | ColorUnit & | red_value,
|  | ColorUnit & | green_value,
|  | ColorUnit & | blue_value,
|  | ColorUnit & | alpha_value ) const

Inspection of the colorRGBA's components. Accesses all the components of this colorRGBA by using ColorUnit's.

Parameters

  red_value | the colorUnit receiving the red component of this colorRGBA
  green_value | the colorUnit receiving the green component of this colorRGBA
  blue_value | the colorUnit receiving the blue component of this colorRGBA
  alpha_value | the colorUnit receiving the alpha component of this colorRGBA

See also
  set
  ColorUnit

## get() [5/6]

void BALL::VIEW::ColorRGBA::get | ( | QColor & | color | ) | const

Assign to a QT QColor.

## get() [6/6]

void BALL::VIEW::ColorRGBA::get | ( | String & | value | ) | const

Copying to string. Calls set. The format of the string is the same as the one given to the constructor.

Parameters

  value | the string receiving the color in hex format

See also
  set

## getAlpha() [1/2]

ColorUnit & BALL::VIEW::ColorRGBA::getAlpha | ( |  | ) |

Mutable inspection of the alpha component.

Returns
  ColorUnit& mutable reference to the alpha component of this colorRGBA

See also
  setAlpha

## getAlpha() [2/2]

const ColorUnit & BALL::VIEW::ColorRGBA::getAlpha | ( |  | ) | const

Non-mutable inspection of the alpha component. For further information see ColorUnit& getAlpha().

## getBlue() [1/2]

ColorUnit & BALL::VIEW::ColorRGBA::getBlue | ( |  | ) |

Mutable inspection of the blue component.

See also
  setBlue

## getBlue() [2/2]

const ColorUnit & BALL::VIEW::ColorRGBA::getBlue | ( |  | ) | const

Non-mutable inspection of the blue component. For further information see ColorUnit& getBlue()

## getGreen() [1/2]

ColorUnit & BALL::VIEW::ColorRGBA::getGreen | ( |  | ) |

Mutable inspection of the green component.

Returns
  ColorUnit& mutable reference to the green component of this colorRGBA

See also
  setGreen

## getGreen() [2/2]

const ColorUnit & BALL::VIEW::ColorRGBA::getGreen | ( |  | ) | const

Non-mutable inspection of the green component. For further information see ColorUnit& getGreen().

## getInverseColor()

ColorRGBA BALL::VIEW::ColorRGBA::getInverseColor | ( |  | ) | const

## getQColor()

QColor BALL::VIEW::ColorRGBA::getQColor | ( |  | ) | const

Get a QColor representing this color.

## getRed() [1/2]

ColorUnit & BALL::VIEW::ColorRGBA::getRed | ( |  | ) |

Mutable inspection of the red component.

Returns
  ColorUnit& mutable reference to the red component of this colorRGBA

See also
  setRed

## getRed() [2/2]

const ColorUnit & BALL::VIEW::ColorRGBA::getRed | ( |  | ) | const

Non-mutable inspection of the red component.

## operator String()

BALL::VIEW::ColorRGBA::operator String | ( |  | ) | const

Conversion to string. This operator casts an instance of colorRGBA to the string type.

Returns
  a string with hex format "00000000"-"FFFFFFFF". The string has the same format as the one given to the constructor.

See also
  ColorRGBA::ColorRGBA

## operator!=()

bool BALL::VIEW::ColorRGBA::operator!= | ( | const ColorRGBA & | color | ) | const

Unequality test.

## operator<()

bool BALL::VIEW::ColorRGBA::operator< | ( | const ColorRGBA & | color | ) | const

Smaller test. Smaller means that all components of this are smaller than all the components of color colorRGBA.

## operator<=()

bool BALL::VIEW::ColorRGBA::operator<= | ( | const ColorRGBA & | color | ) | const

Smaller or equal test. Smaller or equal means that all components of this are smaller or equal than all the components of color colorRGBA.

## operator=() [1/4]

const ColorRGBA & BALL::VIEW::ColorRGBA::operator= | ( | const char * | value | ) |

Assignment operator with char*. Calls set. See constructor for format description.

Parameters

  value | the color represented by a string

Exceptions

  InvalidRange | if string length != 6 && string length != 8
  NotInHexFormat | if the string is not a valid hex format string

Returns
  ColorRGBA& this colorRGBA

## operator=() [2/4]

const ColorRGBA & BALL::VIEW::ColorRGBA::operator= | ( | const ColorHSV & | color | ) |

Assignment operator with ColorHSV. Calls set.

## operator=() [3/4]

const ColorRGBA & BALL::VIEW::ColorRGBA::operator= | ( | const ColorRGBA & | color | ) |

Assignment operator.

See also
  set

## operator=() [4/4]

const ColorRGBA & BALL::VIEW::ColorRGBA::operator= | ( | const String & | value | ) |

Assign the color represented by the string value to this colorRGBA. Calls set. The color of this is initialized to the color represented by the string value. See constructor for format description.

Parameters

  value | the color represented by a string

Exceptions

  InvalidRange | if string length != 6 && string length != 8
  NotInHexFormat | if the string is not a valid hex format string

Returns
  ColorRGBA& this colorRGBA

See also
  set

## operator==()

bool BALL::VIEW::ColorRGBA::operator== | ( | const ColorRGBA & | color | ) | const

Equality test. Tests if color is equal to this colorRGBA.

## operator>()

bool BALL::VIEW::ColorRGBA::operator> | ( | const ColorRGBA & | color | ) | const

Greater test. Greater means that all components of this are greater than all the components of color colorRGBA.

## operator>=()

bool BALL::VIEW::ColorRGBA::operator>= | ( | const ColorRGBA & | color | ) | const

Greater or equal test. Greater or equal means that all components of this are greater or equal than all the components of color colorRGBA.

## set() [1/6]

void BALL::VIEW::ColorRGBA::set | ( | const char * | value | ) |

Assignment with char*. Assigns the color represented by the string value to this colorRGBA. See constructor for format description.

Parameters

  value | the color represented by a string

Exceptions

  InvalidRange | if string length != 6 && string length != 8
  NotInHexFormat | if the string is not a valid hex format string

## set() [2/6]

void BALL::VIEW::ColorRGBA::set | ( | const ColorHSV & | color | ) |

Assignment with ColorHSV.

## set() [3/6]

void BALL::VIEW::ColorRGBA::set | ( | const ColorRGBA & | color | ) |

Assignment.

Parameters

  color | the colorRGBA to be copied

## set() [4/6]

void BALL::VIEW::ColorRGBA::set | ( | const ColorUnit & | red_value,
|  | const ColorUnit & | green_value,
|  | const ColorUnit & | blue_value,
|  | const ColorUnit & | alpha_value = (float) 1 )

Changes the values of the red, green, blue and alpha component. Changes the values of of the red, green, blue and alpha component of this colorRGBA to the values represented by the parameters. See ColorUnit for further information concerning type conversions.

Parameters

  red_value | the new red component of this colorRGBA
  green_value | the new green component of this colorRGBA
  blue_value | the new blue component of this colorRGBA
  alpha_value | the new alpha component of this colorRGBA. Default 1.0

See also
  get
  ColorUnit

## set() [5/6]

bool BALL::VIEW::ColorRGBA::set | ( | const QColor & | color | ) |

Assign from a QT QColor. Aborts, if the QColor is invalid (see QColor::isValid()) and returns false. The alpha-value of this color is set to max.

## set() [6/6]

void BALL::VIEW::ColorRGBA::set | ( | const String & | value | ) |

Assign the color represented by a String. See constructor for format description.

Parameters

  value | the color represented by a string

Exceptions

  InvalidRange | if string length != 6 && string length != 8
  NotInHexFormat | if the string is not a valid hex format string

## setAlpha()

void BALL::VIEW::ColorRGBA::setAlpha | ( | const ColorUnit & | alpha_value | ) |

Changes the value of the alpha component.

Parameters

  alpha_value | the new alpha component of this colorRGBA

See also
  getAlpha

## setBlue()

void BALL::VIEW::ColorRGBA::setBlue | ( | const ColorUnit & | blue_value | ) |

Changes the value of the blue component.

Parameters

  blue_value | the new blue component of this colorRGBA

See also
  getBlue

## setGreen()

void BALL::VIEW::ColorRGBA::setGreen | ( | const ColorUnit & | green_value | ) |

Changes the value of the green component.

Parameters

  green_value | the new green component of this colorRGBA

See also
  getGreen

## setRed()

void BALL::VIEW::ColorRGBA::setRed | ( | const ColorUnit & | red_value | ) |

Changes the value of the red component.

See also
  getRed

## swap()

void BALL::VIEW::ColorRGBA::swap | ( | ColorRGBA & | color | ) |

Swapping of colorRGBAs.

Parameters

  color | the colorRGBA being swapped with this colorRGBA

## Friends And Related Symbol Documentation

## ColorHSV

friend class ColorHSV

friend

Definition at line 36 of file colorRGBA.h.

## operator<<

BALL_VIEW_EXPORT std::ostream & operator<< | ( | std::ostream & | s,
|  | const ColorRGBA & | color )

friend

Friendly stream output. Writes colorRGBA data to the output stream s and store the color of this. The color will be stored as an vector in integer format. The output will look like '(0-255, 0-255, 0-255, 0-255)'. This method is provided for convienience.

Parameters

  s | output stream to where the color of this colorRGBA will be stored
  color | the colorRGBA from which the color will be stored

## operator>>

BALL_VIEW_EXPORT std::istream & operator>> | ( | std::istream & | s,
|  | ColorRGBA & | color )

friend

Friendly stream input. Reads colorRGBA data from the input stream s and restore the color of this. The red, green, blue and alpha component are read as integers from the input stream. THe method expects an vector as written as the one by the output stream operator. This method is provided for convienience.

Parameters

  s | input stream from where to restore the color of this colorRGBA
  color | the colorRGBA to which the color will be restored