#include <BALL/VIEW/DATATYPE/colorRGBA.h>
Public Member Functions | |
Constructors | |
ColorRGBA () | |
ColorRGBA (const ColorRGBA &color) | |
ColorRGBA (const ColorHSV &color) | |
ColorRGBA (const char *value) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) | |
ColorRGBA (const String &value) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) | |
ColorRGBA (const ColorUnit &red_value, const ColorUnit &green_value, const ColorUnit &blue_value, const ColorUnit &alpha_value=(float) 1) | |
ColorRGBA (const QColor &color, const ColorUnit &alpha=(float) 1) | |
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) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
const ColorRGBA & | operator= (const char *value) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
void | get (char *value) const |
void | set (const String &value) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
const ColorRGBA & | operator= (const String &value) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
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 |
Private Member Functions | |
void | stringToRGBA_ (const String &s) throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
Private Attributes | |
ColorUnit | red_ |
ColorUnit | green_ |
ColorUnit | blue_ |
ColorUnit | alpha_ |
Friends | |
Class friends | |
- class ColorHSV | |
class | ColorHSV |
Storers | |
std::istream & | operator>> (std::istream &s, ColorRGBA &color) |
std::ostream & | operator<< (std::ostream &s, const ColorRGBA &color) |
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.
BALL::VIEW::ColorRGBA::ColorRGBA | ( | ) |
Default Constructor. Initialized with color black (red=0, green=0, blue=0, alpha=1).
BALL::VIEW::ColorRGBA::ColorRGBA | ( | const ColorRGBA & | color | ) |
Copy constructor.
BALL::VIEW::ColorRGBA::ColorRGBA | ( | const ColorHSV & | color | ) |
BALL::VIEW::ColorRGBA::ColorRGBA | ( | const char * | value | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
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.
value | the pointer to a string representing a color |
InvalidRange | if string length != 6 && string length != 8 | |
NotInHexFormat | if the string is not a valid hex format string |
BALL::VIEW::ColorRGBA::ColorRGBA | ( | const String & | value | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
Constructor with Parameter string. Same as constructor with parameter char*.
value | a string representing a color |
InvalidRange | if string length != 6 && string length != 8 | |
NotInHexFormat | if the string is not a valid hex format string |
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.
red_value | the red component. | |
green_value | the green component. | |
blue_value | the blue component. | |
alpha_value | the alpha component. Default value 1.0 |
Assignment from a QT QColor.
BALL::VIEW::ColorRGBA::~ColorRGBA | ( | ) |
Destructor.
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:
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.
s | output stream where to output the color of this colorRGBA | |
depth | the dumping depth |
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.
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 |
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.
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 |
void BALL::VIEW::ColorRGBA::get | ( | QColor & | color | ) | const |
Assign to a QT QColor.
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.
value | the string receiving the color in hex format |
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.
value | the pointer to string (at least 9 bytes long) |
void BALL::VIEW::ColorRGBA::get | ( | ColorHSV & | color | ) | const |
Copying to ColorHSV.
Referenced by BALL::VIEW::GeometricObject::getColor().
const ColorUnit& BALL::VIEW::ColorRGBA::getAlpha | ( | ) | const |
Non-mutable inspection of the alpha component. For further information see ColorUnit& getAlpha().
ColorUnit& BALL::VIEW::ColorRGBA::getAlpha | ( | ) |
const ColorUnit& BALL::VIEW::ColorRGBA::getBlue | ( | ) | const |
ColorUnit& BALL::VIEW::ColorRGBA::getBlue | ( | ) |
Mutable inspection of the blue component.
const ColorUnit& BALL::VIEW::ColorRGBA::getGreen | ( | ) | const |
Non-mutable inspection of the green component. For further information see ColorUnit& getGreen().
ColorUnit& BALL::VIEW::ColorRGBA::getGreen | ( | ) |
ColorRGBA BALL::VIEW::ColorRGBA::getInverseColor | ( | ) | const |
QColor BALL::VIEW::ColorRGBA::getQColor | ( | ) | const |
Get a QColor representing this color.
const ColorUnit& BALL::VIEW::ColorRGBA::getRed | ( | ) | const |
Non-mutable inspection of the red component.
ColorUnit& BALL::VIEW::ColorRGBA::getRed | ( | ) |
BALL::VIEW::ColorRGBA::operator String | ( | ) | const |
Conversion to string. This operator casts an instance of colorRGBA to the string type.
"00000000"-"FFFFFFFF"
. The string has the same format as the one given to the constructor. Smaller test. Smaller means that all components of this are smaller than all the components of color colorRGBA.
Smaller or equal test. Smaller or equal means that all components of this are smaller or equal than all the components of color colorRGBA.
const ColorRGBA& BALL::VIEW::ColorRGBA::operator= | ( | const String & | value | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
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.
value | the color represented by a string |
InvalidRange | if string length != 6 && string length != 8 | |
NotInHexFormat | if the string is not a valid hex format string |
const ColorRGBA& BALL::VIEW::ColorRGBA::operator= | ( | const char * | value | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
Assignment operator with char*. Calls set. See constructor for format description.
value | the color represented by a string |
InvalidRange | if string length != 6 && string length != 8 | |
NotInHexFormat | if the string is not a valid hex format string |
Assignment operator with ColorHSV. Calls set.
Assignment operator.
Equality test. Tests if color is equal to this colorRGBA.
Greater test. Greater means that all components of this are greater than all the components of color colorRGBA.
Greater or equal test. Greater or equal means that all components of this are greater or equal than all the components of color colorRGBA.
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.
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 |
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.
void BALL::VIEW::ColorRGBA::set | ( | const String & | value | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
Assign the color represented by a String. See constructor for format description.
value | the color represented by a string |
InvalidRange | if string length != 6 && string length != 8 | |
NotInHexFormat | if the string is not a valid hex format string |
void BALL::VIEW::ColorRGBA::set | ( | const char * | value | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) |
Assignment with char*. Assigns the color represented by the string value to this colorRGBA. See constructor for format description.
value | the color represented by a string |
InvalidRange | if string length != 6 && string length != 8 | |
NotInHexFormat | if the string is not a valid hex format string |
void BALL::VIEW::ColorRGBA::set | ( | const ColorRGBA & | color | ) |
Assignment.
color | the colorRGBA to be copied |
void BALL::VIEW::ColorRGBA::setAlpha | ( | const ColorUnit & | alpha_value | ) |
Changes the value of the alpha component.
alpha_value | the new alpha component of this colorRGBA |
void BALL::VIEW::ColorRGBA::setBlue | ( | const ColorUnit & | blue_value | ) |
Changes the value of the blue component.
blue_value | the new blue component of this colorRGBA |
void BALL::VIEW::ColorRGBA::setGreen | ( | const ColorUnit & | green_value | ) |
Changes the value of the green component.
green_value | the new green component of this colorRGBA |
void BALL::VIEW::ColorRGBA::setRed | ( | const ColorUnit & | red_value | ) |
Changes the value of the red component.
void BALL::VIEW::ColorRGBA::stringToRGBA_ | ( | const String & | s | ) | throw (Exception::InvalidRange, ColorUnit::NotInHexFormat) [private] |
void BALL::VIEW::ColorRGBA::swap | ( | ColorRGBA & | color | ) |
Swapping of colorRGBAs.
color | the colorRGBA being swapped with this colorRGBA |
friend class ColorHSV [friend] |
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.
s | output stream to where the color of this colorRGBA will be stored | |
color | the colorRGBA from which the color will be stored |
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.
s | input stream from where to restore the color of this colorRGBA | |
color | the colorRGBA to which the color will be restored |
ColorUnit BALL::VIEW::ColorRGBA::alpha_ [private] |
ColorUnit BALL::VIEW::ColorRGBA::blue_ [private] |
ColorUnit BALL::VIEW::ColorRGBA::green_ [private] |
ColorUnit BALL::VIEW::ColorRGBA::red_ [private] |