AnimatLab  2
Test
StdUtils::CStdColor Class Reference

Standard color class. More...

#include <StdColor.h>

+ Collaboration diagram for StdUtils::CStdColor:

Public Member Functions

 CStdColor ()
 Default constructor. More...
 
 CStdColor (float fltMaxRange)
 Constructor with maximum range. More...
 
 CStdColor (float valr, float valg, float valb, float vala, float fltMaxRange)
 Constructor. More...
 
void a (float fltA, bool bThrowError=true)
 Sets the alpha value of the color. More...
 
float a ()
 Gets the alpha value of the color. More...
 
void b (float fltB, bool bThrowError=true)
 Sets the blue value of the color. More...
 
float b ()
 Gets the blue value of the color. More...
 
void ClearNearZero (float fltTolerance=1e-5f)
 Clears the near zero described by fltTolerance. More...
 
void g (float fltG, bool bThrowError=true)
 Sets the green value of the color. More...
 
float g ()
 Gets the green value of the color. More...
 
void Load (CStdXml &oXml, std::string strParamName, bool bThrowError=true)
 Loads the color. More...
 
void Load (std::string strXml, std::string strParamName, bool bThrowError=true)
 Loads the color. More...
 
double Magnitude ()
 Gets the magnitude of the color. More...
 
void Normalize ()
 Normalizes the color. More...
 
bool operator!= (const CStdColor &oPoint)
 != casting operator. More...
 
CStdColor operator* (const float fltVal)
 
  • casting operator.
More...
 
void operator*= (const float fltVal)
 *= casting operator. More...
 
CStdColor operator+ (const CStdColor &oPoint)
 
  • casting operator.
More...
 
CStdColor operator+ (const float fltVal)
 
  • casting operator.
More...
 
void operator+= (const CStdColor &oPoint)
 += casting operator. More...
 
void operator+= (const float fltVal)
 += casting operator. More...
 
CStdColor operator- (const CStdColor &oPoint)
 
  • casting operator.
More...
 
CStdColor operator- (const float fltVal)
 
  • casting operator.
More...
 
void operator-= (const CStdColor &oPoint)
 -= casting operator. More...
 
void operator-= (const float fltVal)
 -= casting operator. More...
 
CStdColor operator/ (const float fltVal)
 / casting operator. More...
 
void operator/= (const float fltVal)
 /= casting operator. More...
 
void operator= (const CStdColor &oPoint)
 = casting operator. More...
 
bool operator== (const CStdColor &oPoint)
 == casting operator. More...
 
float operator[] (const int iIndex)
 [] casting operator. More...
 
void r (float fltR, bool bThrowError=true)
 Sets the red value of the color. More...
 
float r ()
 Gets the red value of the color. More...
 
void Set (float R, float G, float B, float A)
 Sets the color values. More...
 

Protected Attributes

float m_fltA
 The alpha component of the color.
 
float m_fltB
 The blue component of the color.
 
float m_fltG
 The green component of the color.
 
float m_fltMaxRange
 some colors are 0-255, others are 0-1. This specifies the max range for these colors
 
float m_fltR
 The red component of the color.
 

Detailed Description

Standard color class.

Author
dcofer
Date
5/3/2011

Definition at line 22 of file StdColor.h.

Constructor & Destructor Documentation

StdUtils::CStdColor::CStdColor ( )

Default constructor.

Author
dcofer
Date
5/3/2011

Definition at line 13 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

StdUtils::CStdColor::CStdColor ( float  fltMaxRange)

Constructor with maximum range.

Author
dcofer
Date
5/3/2011
Parameters
fltMaxRangeThe maximum range used for color values.

Definition at line 23 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

StdUtils::CStdColor::CStdColor ( float  valr,
float  valg,
float  valb,
float  vala,
float  fltMaxRange 
)

Constructor.

Author
dcofer
Date
5/3/2011
Parameters
valrThe red value.
valgThe green value.
valbThe blue value.
valaThe alpha value.
fltMaxRangeThe maximum range for the color values.

Definition at line 32 of file StdColor.cpp.

References a(), b(), g(), m_fltMaxRange, and r().

+ Here is the call graph for this function:

Member Function Documentation

void StdUtils::CStdColor::a ( float  fltA,
bool  bThrowError = true 
)

Sets the alpha value of the color.

Author
dcofer
Date
5/3/2011
Parameters
fltAThe new alpha value.
bThrowErrortrue to throw error if there is a problem.

Definition at line 126 of file StdColor.cpp.

References m_fltA, and StdUtils::Std_InValidRange().

Referenced by AnimatSim::Environment::ConstraintLimit::Alpha(), and AnimatSim::Simulator::SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float StdUtils::CStdColor::a ( )

Gets the alpha value of the color.

Author
dcofer
Date
5/3/2011
Returns
color value.

Definition at line 140 of file StdColor.cpp.

References m_fltA.

Referenced by CStdColor(), Load(), and Set().

+ Here is the caller graph for this function:

void StdUtils::CStdColor::b ( float  fltB,
bool  bThrowError = true 
)

Sets the blue value of the color.

Author
dcofer
Date
5/3/2011
Parameters
fltBThe new blue value.
bThrowErrortrue to throw error if there is a problem.

Definition at line 101 of file StdColor.cpp.

References m_fltB, and StdUtils::Std_InValidRange().

Referenced by AnimatSim::Simulator::SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float StdUtils::CStdColor::b ( )

Gets the blue value of the color.

Author
dcofer
Date
5/3/2011
Returns
color value.

Definition at line 115 of file StdColor.cpp.

References m_fltB.

Referenced by CStdColor(), Load(), and Set().

+ Here is the caller graph for this function:

void StdUtils::CStdColor::ClearNearZero ( float  fltTolerance = 1e-5f)

Clears the near zero described by fltTolerance.

This method checks each value to see if it is less than m_fltA give tolerance. If it is then it just sets it to zero.

Author
dcofer
Date
5/3/2011
Parameters
fltToleranceThe tolerance.

Definition at line 490 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

void StdUtils::CStdColor::g ( float  fltG,
bool  bThrowError = true 
)

Sets the green value of the color.

Author
dcofer
Date
5/3/2011
Parameters
fltGThe new green value.
bThrowErrortrue to throw error if there is a problem.

Definition at line 76 of file StdColor.cpp.

References m_fltG, and StdUtils::Std_InValidRange().

Referenced by AnimatSim::Simulator::SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float StdUtils::CStdColor::g ( )

Gets the green value of the color.

Author
dcofer
Date
5/3/2011
Returns
color value.

Definition at line 90 of file StdColor.cpp.

References m_fltG.

Referenced by CStdColor(), Load(), and Set().

+ Here is the caller graph for this function:

void StdUtils::CStdColor::Load ( CStdXml oXml,
std::string  strParamName,
bool  bThrowError = true 
)

Loads the color.

Author
dcofer
Date
5/3/2011
Parameters
[in,out]oXmlThe xml used to load data.
strParamNameName of the string parameter.
bThrowErrortrue to throw error if there is a problem.

Definition at line 540 of file StdColor.cpp.

References a(), b(), StdUtils::CStdXml::FindChildElement(), g(), StdUtils::CStdXml::GetAttribFloat(), StdUtils::CStdXml::IntoChildElement(), StdUtils::CStdXml::OutOfElem(), and r().

Referenced by AnimatSim::Environment::MovableItem::Ambient(), AnimatSim::Simulator::BackgroundColor(), AnimatSim::Environment::ConstraintLimit::Color(), AnimatSim::Environment::MovableItem::Diffuse(), Load(), AnimatSim::Simulator::LoadEnvironment(), and AnimatSim::Environment::MovableItem::Specular().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void StdUtils::CStdColor::Load ( std::string  strXml,
std::string  strParamName,
bool  bThrowError = true 
)

Loads the color.

Author
dcofer
Date
5/3/2011
Parameters
strXmlThe xml used to load data.
strParamNameName of the std::string parameter.
bThrowErrortrue to throw error if there is a problem.

Definition at line 566 of file StdColor.cpp.

References StdUtils::CStdXml::Deserialize(), StdUtils::CStdXml::FindChildElement(), StdUtils::CStdXml::FindElement(), and Load().

+ Here is the call graph for this function:

double StdUtils::CStdColor::Magnitude ( )

Gets the magnitude of the color.

Author
dcofer
Date
5/3/2011
Returns
Magnitude.

Definition at line 449 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

Referenced by Normalize().

+ Here is the caller graph for this function:

void StdUtils::CStdColor::Normalize ( )

Normalizes the color.

Author
dcofer
Date
5/3/2011

Definition at line 458 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltR, and Magnitude().

+ Here is the call graph for this function:

bool StdUtils::CStdColor::operator!= ( const CStdColor oPoint)

!= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.
Returns
The result of the operation.

Definition at line 188 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

CStdColor StdUtils::CStdColor::operator* ( const float  fltVal)

  • casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.
Returns
The result of the operation.

Definition at line 406 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

void StdUtils::CStdColor::operator*= ( const float  fltVal)

*= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.

Definition at line 325 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

CStdColor StdUtils::CStdColor::operator+ ( const CStdColor oPoint)

  • casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.
Returns
The result of the operation.

Definition at line 253 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

CStdColor StdUtils::CStdColor::operator+ ( const float  fltVal)

  • casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.
Returns
The result of the operation.

Definition at line 364 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

void StdUtils::CStdColor::operator+= ( const CStdColor oPoint)

+= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.

Definition at line 219 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

void StdUtils::CStdColor::operator+= ( const float  fltVal)

+= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.

Definition at line 293 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

CStdColor StdUtils::CStdColor::operator- ( const CStdColor oPoint)

  • casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.
Returns
The result of the operation.

Definition at line 274 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

CStdColor StdUtils::CStdColor::operator- ( const float  fltVal)

  • casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.
Returns
The result of the operation.

Definition at line 385 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

void StdUtils::CStdColor::operator-= ( const CStdColor oPoint)

-= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.

Definition at line 235 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

void StdUtils::CStdColor::operator-= ( const float  fltVal)

-= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.

Definition at line 309 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

CStdColor StdUtils::CStdColor::operator/ ( const float  fltVal)

/ casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.
Returns
The result of the operation.

Definition at line 427 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, m_fltMaxRange, and m_fltR.

void StdUtils::CStdColor::operator/= ( const float  fltVal)

/= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
fltValThe value.

Definition at line 341 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

void StdUtils::CStdColor::operator= ( const CStdColor oPoint)

= casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.

Definition at line 203 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

bool StdUtils::CStdColor::operator== ( const CStdColor oPoint)

== casting operator.

Author
dcofer
Date
5/3/2011
Parameters
oPointThe point.
Returns
The result of the operation.

Definition at line 171 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

float StdUtils::CStdColor::operator[] ( const int  iIndex)

[] casting operator.

Author
dcofer
Date
5/3/2011
Parameters
iIndexZero-based index of the.
Returns
The result of the operation.

Definition at line 512 of file StdColor.cpp.

References m_fltA, m_fltB, m_fltG, and m_fltR.

void StdUtils::CStdColor::r ( float  fltR,
bool  bThrowError = true 
)

Sets the red value of the color.

Author
dcofer
Date
5/3/2011
Parameters
fltRThe new red value.
bThrowErrortrue to throw error if there is a problem.

Definition at line 51 of file StdColor.cpp.

References m_fltR, and StdUtils::Std_InValidRange().

Referenced by AnimatSim::Simulator::SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float StdUtils::CStdColor::r ( )

Gets the red value of the color.

Author
dcofer
Date
5/3/2011
Returns
color value.

Definition at line 65 of file StdColor.cpp.

References m_fltR.

Referenced by CStdColor(), Load(), and Set().

+ Here is the caller graph for this function:

void StdUtils::CStdColor::Set ( float  R,
float  G,
float  B,
float  A 
)

Sets the color values.

Author
dcofer
Date
5/3/2011
Parameters
RThe red value.
GThe green value.
BThe blue value.
AThe alpha value.

Definition at line 153 of file StdColor.cpp.

References a(), b(), g(), and r().

Referenced by AnimatSim::Environment::ConstraintLimit::Color(), AnimatSim::Environment::MovableItem::MovableItem(), and AnimatSim::Simulator::Simulator().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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