BALL  1.5.0
List of all members

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

Public Member Functions

Constructors
 ColorHSV ()
 
 ColorHSV (const ColorHSV &color)
 
 ColorHSV (const ColorRGBA &color)
 
 ColorHSV (const char *value)
 
 ColorHSV (const String &value)
 
 ColorHSV (const ColorUnitHue &hue, const ColorUnit &saturation, const ColorUnit &value)
 
Destructors
virtual ~ColorHSV ()
 
virtual void clear ()
 
Converters
 operator String () const
 
Assignment
void set (const ColorHSV &color)
 
const ColorHSVoperator= (const ColorHSV &color)
 
void set (const ColorRGBA &color)
 
const ColorHSVoperator= (const ColorRGBA &color)
 
void get (ColorRGBA &color) const
 
void set (const char *value)
 
const ColorHSVoperator= (const char *value)
 
void get (char *value) const
 
void set (const String &value)
 
const ColorHSVoperator= (const String &value)
 
void get (String &value) const
 
void swap (ColorHSV &color)
 
Accessors: inspectors and mutators
void setHue (const ColorUnitHue &hue)
 
ColorUnitHuegetHue ()
 
const ColorUnitHuegetHue () const
 
void setSaturation (const ColorUnit &saturation)
 
ColorUnitgetSaturation ()
 
const ColorUnitgetSaturation () const
 
void setValue (const ColorUnit &value)
 
ColorUnitgetValue ()
 
const ColorUnitgetValue () const
 
void set (const ColorUnitHue &hue, const ColorUnit &saturation, const ColorUnit &value)
 
void get (ColorUnitHue &hue, ColorUnit &saturation, ColorUnit &value) const
 
Predicates
bool operator== (const ColorHSV &color) const
 
bool operator!= (const ColorHSV &color) const
 
bool operator< (const ColorHSV &color) const
 
bool operator<= (const ColorHSV &color) const
 
bool operator> (const ColorHSV &color) const
 
bool operator>= (const ColorHSV &color) const
 
debuggers and diagnostics
virtual void dump (std::ostream &s=std::cout, Size depth=0) const
 

Friends

Class friends
class ColorRGBA
 
Storers
std::istream & operator>> (std::istream &s, ColorHSV &color)
 
std::ostream & operator<< (std::ostream &s, const ColorHSV &color)
 

Detailed Description

ColorHSV class. An instance of ColorHSV represents a color consisting of the components hue, saturation and value. The components staturation and values are ColorUnit 's. The component hue is of class type ColorUnitHue . See description of these classes for further informations concerning type conversions.

Definition at line 42 of file colorHSV.h.

Constructor & Destructor Documentation

◆ ColorHSV() [1/6]

BALL::VIEW::ColorHSV::ColorHSV ( )

Default Constructor. Constructs new colorHSV. Initialized with color black (hue=0, saturation=0, value=0).

Returns
ColorHSV new constructed colorHSV

◆ ColorHSV() [2/6]

BALL::VIEW::ColorHSV::ColorHSV ( const ColorHSV color)

Copy constructor.

◆ ColorHSV() [3/6]

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

Constructor with ColorRGBA.

◆ ColorHSV() [4/6]

BALL::VIEW::ColorHSV::ColorHSV ( const char *  value)

Constructor with parameter char*. Constructs new colorHSV 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 7 characters depending whether the hue component is 2 or 3 bytes long. See ColorUnitHue and ColorUnit for information concerning to string format.

Parameters
valuethe pointer to a string representing a color
Exceptions
InvalidRangeif string length != 6 && string length != 7
NotInHexFormatif the string is not a valid hex format string
Returns
ColorHSV new constructed colorHSV
See also
ColorUnit
ColorUnitHue

◆ ColorHSV() [5/6]

BALL::VIEW::ColorHSV::ColorHSV ( const String value)

Constructor with Parameter string. Constructs new ColorHSV by initialising its value with a string representing a color value in hex format. The length of the string can either be 6 or 7 characters depending whether the hue component is 2 or 3 bytes long. See ColorUnitHue and ColorUnit for information concerning to string format.

Parameters
valuea string representing a color
Exceptions
InvalidRangeif string length != 6 && string length != 7
NotInHexFormatif the string is not a valid hex format string

◆ ColorHSV() [6/6]

BALL::VIEW::ColorHSV::ColorHSV ( const ColorUnitHue hue,
const ColorUnit saturation,
const ColorUnit value 
)

Detailed component initializing constructor.

Parameters
huethe hue component. See ColorUnitHue
saturationthe staturation component. See ColorUnit
valuethe value component. See ColorUnit
Returns
ColorHSV new constructed colorHSV

◆ ~ColorHSV()

virtual BALL::VIEW::ColorHSV::~ColorHSV ( )
virtual

Destructor.

Member Function Documentation

◆ clear()

virtual void BALL::VIEW::ColorHSV::clear ( )
virtual

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

  • hue component is zero (0)
  • staturation component is zero (0)
  • value component is zero (0)

◆ dump()

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

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

Parameters
soutput stream where to output the color of this colorHSV
depththe dumping depth

◆ get() [1/4]

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

Copying to ColorRGBA. Calls set. The color of the colorRGBA color is initialized to the color of this colorHSV.

Parameters
colorthe colorRGBA to be assigned to

◆ get() [2/4]

void BALL::VIEW::ColorHSV::get ( char *  value) const

Copying to char*. Calls set. The string value is initialized to the color of this colorHSV. At least 8 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 8 bytes long)
See also
set

◆ get() [3/4]

void BALL::VIEW::ColorHSV::get ( String value) const

Copying to string. Calls set. The string value is initialized to the color of this colorHSV. The format of the string is the same as the one given to the constructor.

Parameters
valuethe string receiving the color in hex format

◆ get() [4/4]

void BALL::VIEW::ColorHSV::get ( ColorUnitHue hue,
ColorUnit saturation,
ColorUnit value 
) const

Inspection of the colorHSV's components.

◆ getHue() [1/2]

ColorUnitHue& BALL::VIEW::ColorHSV::getHue ( )

Mutable inspection of the hue component. Accesses the mutual reference of the hue component of this colorHSV. See ColorUnitHue for further information concerning type conversion.

Returns
ColorUnitHue& mutable reference to the hue component of this colorHSV
See also
setHue
ColorUnitHue

◆ getHue() [2/2]

const ColorUnitHue& BALL::VIEW::ColorHSV::getHue ( ) const

Non-mutable inspection of the hue component. For further information see ColorUnitHue& getHue().

◆ getSaturation() [1/2]

ColorUnit& BALL::VIEW::ColorHSV::getSaturation ( )

Mutable inspection of the saturation component.

See also
setSaturation

◆ getSaturation() [2/2]

const ColorUnit& BALL::VIEW::ColorHSV::getSaturation ( ) const

Non-mutable inspection of the saturation component.

◆ getValue() [1/2]

ColorUnit& BALL::VIEW::ColorHSV::getValue ( )

Mutable inspection of the value component.

◆ getValue() [2/2]

const ColorUnit& BALL::VIEW::ColorHSV::getValue ( ) const

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

◆ operator String()

BALL::VIEW::ColorHSV::operator String ( ) const

Conversion to string.

Returns
a string with hex format. See constructor for information concerning the string format

◆ operator!=()

bool BALL::VIEW::ColorHSV::operator!= ( const ColorHSV color) const

Unequality test.

◆ operator<()

bool BALL::VIEW::ColorHSV::operator< ( const ColorHSV color) const

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

◆ operator<=()

bool BALL::VIEW::ColorHSV::operator<= ( const ColorHSV 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 colorHSV.

◆ operator=() [1/4]

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

Assignment operator. Calls set.

◆ operator=() [2/4]

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

Assignment operator with ColorRGBA. Assigns the colorRGBA color to this colorHSV. Calls set. The color of this is initialized to the color of the colorRGBA color.

Parameters
colorthe colorRGBA to be copied
Returns
ColorHSV& constant reference of this colorHSV
See also
set

◆ operator=() [3/4]

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

Assignment operator with char*. 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 != 7
NotInHexFormatif the string is not a valid hex format string

◆ operator=() [4/4]

const ColorHSV& BALL::VIEW::ColorHSV::operator= ( const String value)

Assignment operator with string. Assigns the color represented by the string value to this colorHSV. Calls set. See constructor for format description.

Parameters
valuethe color represented by a string
Exceptions
InvalidRangeif string length != 6 && string length != 7
NotInHexFormatif the string is not a valid hex format string

◆ operator==()

bool BALL::VIEW::ColorHSV::operator== ( const ColorHSV color) const

Equality test.

◆ operator>()

bool BALL::VIEW::ColorHSV::operator> ( const ColorHSV color) const

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

◆ operator>=()

bool BALL::VIEW::ColorHSV::operator>= ( const ColorHSV 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 colorHSV.

◆ set() [1/5]

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

Assignment.

◆ set() [2/5]

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

Assignment with ColorRGBA. The color of this is initialized to the color of the colorRGBA color.

◆ set() [3/5]

void BALL::VIEW::ColorHSV::set ( const char *  value)

Assignment with char*. 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 != 7
NotInHexFormatif the string is not a valid hex format string

◆ set() [4/5]

void BALL::VIEW::ColorHSV::set ( const String value)

Assignment with string. Assigns the color represented by the string value to this colorHSV. 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 != 7
NotInHexFormatif the string is not a valid hex format string

◆ set() [5/5]

void BALL::VIEW::ColorHSV::set ( const ColorUnitHue hue,
const ColorUnit saturation,
const ColorUnit value 
)

Changes the values of the hue, saturation and value component.

◆ setHue()

void BALL::VIEW::ColorHSV::setHue ( const ColorUnitHue hue)

Changes the value of the hue component. Changes the value of of the hue component of this colorHSV to the value represented by the parameter hue. See ColorUnitHue for further information concerning the format.

Parameters
huethe new hue component of this colorHSV
See also
getHue
ColorUnitHue

◆ setSaturation()

void BALL::VIEW::ColorHSV::setSaturation ( const ColorUnit saturation)

Changes the value of the saturation component.

See also
getSaturation

◆ setValue()

void BALL::VIEW::ColorHSV::setValue ( const ColorUnit value)

Changes the value of the value component.

◆ swap()

void BALL::VIEW::ColorHSV::swap ( ColorHSV color)

Swapping of colorHSVs.

Friends And Related Function Documentation

◆ ColorRGBA

friend class ColorRGBA
friend

Definition at line 48 of file colorHSV.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const ColorHSV color 
)
friend

Friendly stream output. Writes colorHSV 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-360, 0-255, 0-255)'. This method is provided for convienience.

Parameters
soutput stream to where the color of this colorHSV will be stored
colorthe colorHSV from which the color will be stored

◆ operator>>

std::istream& operator>> ( std::istream &  s,
ColorHSV color 
)
friend

Friendly stream input. Reads colorHSV data from the input stream s and restore the color of this. The hue, saturation and value 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 colorHSV
colorthe colorHSV to which the color will be restored