VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
DtSdcColor Class Reference

DtSdcColor represents colors for Draw Control Objects. More...

List of all members.

Public Member Functions

 DtSdcColor ()
 Defaultconstructor.
 DtSdcColor (unsigned r, unsigned g, unsigned b, unsigned a=255)
 Parameterized constructor.
 DtSdcColor (const DtSdcColor &orig)
 Copy constructor.
DtSdcColor operator= (const DtSdcColor &orig)
 Assignment operator.
const unsigned & operator[] (int index) const
 const RGBA Component Accessor
unsigned & operator[] (int index)
 RGBA Component Accessor.
bool operator== (const DtSdcColor &rhs) const
 Equality operator.
bool operator!= (const DtSdcColor &rhs) const
 Inequality operator.
void setHSV (unsigned hue, double saturation, double value, unsigned alpha=255)
 Set via HSV.
unsigned red () const
 Red accessor.
void setRed (unsigned red)
 Red mutator.
unsigned green () const
 Green accessor.
void setGreen (unsigned green)
 Green mutator.
unsigned blue () const
 Blue accessor.
void setBlue (unsigned blue)
 Blue mutator.
unsigned hue () const
 Hue accessor.
void setHue (unsigned hue)
 Hue mutator.
double saturation () const
 Saturation accessor.
void setSaturation (double saturation)
 Saturation mutator.
double value () const
 Value accessor.
void setValue (double value)
 Value mutator.
unsigned alpha () const
 Alpha accessor.
void setAlpha (unsigned alpha)
 Alpha mutator.

Static Public Attributes

static const DtSdcColor DtSdcWhite
 Constant for the color White.
static const DtSdcColor DtSdcBlack
 Constant for the color Black.
static const DtSdcColor DtSdcRed
 Constant for the color Red.
static const DtSdcColor DtSdcGreen
 Constant for the color Green.
static const DtSdcColor DtSdcBlue
 Constant for the color Blue.
static const DtSdcColor DtSdcYellow
 Constant for the color Yellow.
static const DtSdcColor DtSdcPurple
 Constant for the color Purple.
static const DtSdcColor DtSdcOrange
 Constant for the color Orange.

Protected Member Functions

void toHSV ()
void fromHSV ()

Protected Attributes

unsigned myRed
unsigned myGreen
unsigned myBlue
unsigned myAlpha
unsigned myHue
double mySaturation
double myValue

Detailed Description

DtSdcColor represents colors for Draw Control Objects.

DtSdcColor is a container class that hold rgba values representing a color (and transparency). It also has methods to support working with HSV color representations, although colors are always represented as rgba values on the network.


Constructor & Destructor Documentation

Defaultconstructor.

DtSdcColor::DtSdcColor ( unsigned  r,
unsigned  g,
unsigned  b,
unsigned  a = 255 
)

Parameterized constructor.

Construct a color object with the specified red, green, blue and alpha values

Parameters:
rThe red component value, from 0 to 255
gThe green component value, from 0 to 255
bThe blue compoment value, from 0 to 255
aThe alpha (transparency) value, from 0 to 255

Copy constructor.


Member Function Documentation

DtSdcColor DtSdcColor::operator= ( const DtSdcColor orig)

Assignment operator.

const unsigned& DtSdcColor::operator[] ( int  index) const

const RGBA Component Accessor

Get a single rgba component value

Parameters:
index0 = red, 1 = green, 2 = blue, 3 = alpha
Returns:
The corresponding rgba component value
unsigned& DtSdcColor::operator[] ( int  index)

RGBA Component Accessor.

Get a single rgba component value

Parameters:
index0 = red, 1 = green, 2 = blue, 3 = alpha
Returns:
The corresponding rgba component value
bool DtSdcColor::operator== ( const DtSdcColor rhs) const

Equality operator.

bool DtSdcColor::operator!= ( const DtSdcColor rhs) const

Inequality operator.

void DtSdcColor::setHSV ( unsigned  hue,
double  saturation,
double  value,
unsigned  alpha = 255 
)

Set via HSV.

Set the rgba value using HSV(a) values

Parameters:
hueHue component, 0 to 360
saturationSaturation component, 0. to 1.
valueValue component, 0. to 1.
alphaAlpha (transparency) component, 0 to 255
unsigned DtSdcColor::red ( ) const

Red accessor.

Get the red component value

Returns:
The red component, 0 to 255
void DtSdcColor::setRed ( unsigned  red)

Red mutator.

Set the red component value

Parameters:
redThe red component, 0 to 255
unsigned DtSdcColor::green ( ) const

Green accessor.

Get the green component value

Returns:
The green component, 0 to 255
void DtSdcColor::setGreen ( unsigned  green)

Green mutator.

Set the green component value

Parameters:
greenThe green component, 0 to 255
unsigned DtSdcColor::blue ( ) const

Blue accessor.

Get the blue component value

Returns:
The blue component, 0 to 255
void DtSdcColor::setBlue ( unsigned  blue)

Blue mutator.

Set the blue component value

Parameters:
blueThe blue component, 0 to 255
unsigned DtSdcColor::hue ( ) const

Hue accessor.

Get the Hue associated with this color

Returns:
The Hue value, 0 to 360
void DtSdcColor::setHue ( unsigned  hue)

Hue mutator.

Change the color by setting its Hue

Parameters:
hueThe Hue value, 0 to 360
double DtSdcColor::saturation ( ) const

Saturation accessor.

Get the Saturation associated with this color

Returns:
The Saturation value, 0. to 1.
void DtSdcColor::setSaturation ( double  saturation)

Saturation mutator.

Change the color by modifying its saturation value

Parameters:
saturationThe Saturation value, 0. to 1.
double DtSdcColor::value ( ) const

Value accessor.

Get the (brightness) Value associated with this color

Returns:
The (brightness) Value, 0. to 1.
void DtSdcColor::setValue ( double  value)

Value mutator.

Change the color by modifying its (brightness) value

Parameters:
valueThe (brightness) value, 0. to 1.
unsigned DtSdcColor::alpha ( ) const

Alpha accessor.

Get the alpha (transparency) component value

Returns:
The alpha component, 0 to 255
void DtSdcColor::setAlpha ( unsigned  alpha)

Alpha mutator.

Set the alpha (transparency) component value

Parameters:
alphaThe alpha component, 0 to 255
void DtSdcColor::toHSV ( ) [protected]
void DtSdcColor::fromHSV ( ) [protected]

Member Data Documentation

Constant for the color White.

Constant for the color Black.

Constant for the color Red.

Constant for the color Green.

Constant for the color Blue.

Constant for the color Yellow.

Constant for the color Purple.

Constant for the color Orange.

unsigned DtSdcColor::myRed [protected]
unsigned DtSdcColor::myGreen [protected]
unsigned DtSdcColor::myBlue [protected]
unsigned DtSdcColor::myAlpha [protected]
unsigned DtSdcColor::myHue [protected]
double DtSdcColor::mySaturation [protected]
double DtSdcColor::myValue [protected]

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)