BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Private Member Functions | Private Attributes
BALL::VIEW::ColorRGBA Class Reference

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

List of all members.

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 ColorRGBAoperator= (const ColorRGBA &color)
void set (const ColorHSV &color)
const ColorRGBAoperator= (const ColorHSV &color)
void get (ColorHSV &color) const
void set (const char *value)
const ColorRGBAoperator= (const char *value)
void get (char *value) const
void set (const String &value)
const ColorRGBAoperator= (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)
ColorUnitgetRed ()
const ColorUnitgetRed () const
void setGreen (const ColorUnit &green_value)
ColorUnitgetGreen ()
const ColorUnitgetGreen () const
void setBlue (const ColorUnit &blue_value)
ColorUnitgetBlue ()
const ColorUnitgetBlue () const
void setAlpha (const ColorUnit &alpha_value)
ColorUnitgetAlpha ()
const ColorUnitgetAlpha () 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)

Private Attributes

ColorUnit red_
ColorUnit green_
ColorUnit blue_
ColorUnit alpha_

Friends

Class friends
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

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

Copy constructor.

Constructor with ColorHSV.

See also:
ColorHSV
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:
valuethe pointer to a string representing a color
Exceptions:
InvalidRangeif string length != 6 && string length != 8
NotInHexFormatif the string is not a valid hex format string
Returns:
ColorRGBA new constructed colorRGBA

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

Parameters:
valuea string representing a color
Exceptions:
InvalidRangeif string length != 6 && string length != 8
NotInHexFormatif the string is not a valid hex format string
Returns:
ColorRGBA new constructed colorRGBA
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_valuethe red component.
green_valuethe green component.
blue_valuethe blue component.
alpha_valuethe alpha component. Default value 1.0
See also:
ColorUnit
BALL::VIEW::ColorRGBA::ColorRGBA ( const QColor &  color)

Assignment from a QT QColor.

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

Assignment from a QT QColor.

Destructor.


Member Function Documentation

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)
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:
soutput stream where to output the color of this colorRGBA
depththe dumping depth
See also:
ColorUnit::dump
void BALL::VIEW::ColorRGBA::get ( ColorHSV color) const

Copying to ColorHSV.

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:
valuethe pointer to string (at least 9 bytes long)
See also:
set
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:
valuethe string receiving the color in hex format
See also:
set
void BALL::VIEW::ColorRGBA::get ( QColor &  color) const

Assign to a QT QColor.

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_valuethe colorUnit receiving the red component of this colorRGBA
green_valuethe colorUnit receiving the green component of this colorRGBA
blue_valuethe colorUnit receiving the blue component of this colorRGBA
alpha_valuethe colorUnit receiving the alpha component of this colorRGBA
See also:
set
ColorUnit
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_valuethe colorUnit receiving the red component of this colorRGBA
green_valuethe colorUnit receiving the green component of this colorRGBA
blue_valuethe colorUnit receiving the blue component of this colorRGBA
See also:
set
ColorUnit

Mutable inspection of the alpha component.

Returns:
ColorUnit& mutable reference to the alpha component of this colorRGBA
See also:
setAlpha

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

Mutable inspection of the blue component.

See also:
setBlue

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

Mutable inspection of the green component.

Returns:
ColorUnit& mutable reference to the green component of this colorRGBA
See also:
setGreen

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

Get a QColor representing this color.

Mutable inspection of the red component.

Returns:
ColorUnit& mutable reference to the red component of this colorRGBA
See also:
setRed

Non-mutable inspection of the red component.

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
bool BALL::VIEW::ColorRGBA::operator!= ( const ColorRGBA color) const

Unequality test.

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.

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.

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

Assignment operator.

See also:
set
const ColorRGBA& BALL::VIEW::ColorRGBA::operator= ( const ColorHSV color)

Assignment operator with ColorHSV. Calls set.

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

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

Parameters:
valuethe color represented by a string
Exceptions:
InvalidRangeif string length != 6 && string length != 8
NotInHexFormatif the string is not a valid hex format string
Returns:
ColorRGBA& this colorRGBA
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:
valuethe color represented by a string
Exceptions:
InvalidRangeif string length != 6 && string length != 8
NotInHexFormatif the string is not a valid hex format string
Returns:
ColorRGBA& this colorRGBA
See also:
set
bool BALL::VIEW::ColorRGBA::operator== ( const ColorRGBA color) const

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

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.

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.

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

Assignment.

Parameters:
colorthe colorRGBA to be copied
void BALL::VIEW::ColorRGBA::set ( const ColorHSV color)

Assignment with ColorHSV.

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:
valuethe color represented by a string
Exceptions:
InvalidRangeif string length != 6 && string length != 8
NotInHexFormatif the string is not a valid hex format string
void BALL::VIEW::ColorRGBA::set ( const String value)

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

Parameters:
valuethe color represented by a string
Exceptions:
InvalidRangeif string length != 6 && string length != 8
NotInHexFormatif the string is not a valid hex format string
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 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_valuethe new red component of this colorRGBA
green_valuethe new green component of this colorRGBA
blue_valuethe new blue component of this colorRGBA
alpha_valuethe new alpha component of this colorRGBA. Default 1.0
See also:
get
ColorUnit
void BALL::VIEW::ColorRGBA::setAlpha ( const ColorUnit alpha_value)

Changes the value of the alpha component.

Parameters:
alpha_valuethe new alpha component of this colorRGBA
See also:
getAlpha
void BALL::VIEW::ColorRGBA::setBlue ( const ColorUnit blue_value)

Changes the value of the blue component.

Parameters:
blue_valuethe new blue component of this colorRGBA
See also:
getBlue
void BALL::VIEW::ColorRGBA::setGreen ( const ColorUnit green_value)

Changes the value of the green component.

Parameters:
green_valuethe new green component of this colorRGBA
See also:
getGreen
void BALL::VIEW::ColorRGBA::setRed ( const ColorUnit red_value)

Changes the value of the red component.

See also:
getRed
void BALL::VIEW::ColorRGBA::stringToRGBA_ ( const String s) [private]

Swapping of colorRGBAs.

Parameters:
colorthe colorRGBA being swapped with this colorRGBA

Friends And Related Function Documentation

friend class ColorHSV [friend]

Definition at line 36 of file colorRGBA.h.

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:
soutput stream to where the color of this colorRGBA will be stored
colorthe colorRGBA from which the color will be stored
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:
sinput stream from where to restore the color of this colorRGBA
colorthe colorRGBA to which the color will be restored

Member Data Documentation

Definition at line 429 of file colorRGBA.h.

Definition at line 428 of file colorRGBA.h.

Definition at line 427 of file colorRGBA.h.

Definition at line 426 of file colorRGBA.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines