Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

VPColor Class Reference

RGBA color representation. More...

#include <vpcolor.h>

List of all members.

Public Member Functions

 VPColor ()
 Creates a black, opaque color.
 VPColor (const VPColor &color)
 VPColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
void SetR (unsigned char r)
void SetG (unsigned char g)
void SetB (unsigned char b)
void SetA (unsigned char a)
void SetRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
unsigned char GetR () const
unsigned char GetG () const
unsigned char GetB () const
unsigned char GetA () const
void GetRGBA (unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) const
void Get (float rgbaVec[4]) const
 Returns RGBA componts as a vector of floats.
VPColoroperator= (const VPColor &color)
VPColor operator+ (const VPColor &color) const
VPColor operator- (const VPColor &color) const
bool operator== (const VPColor &color) const
bool operator!= (const VPColor &color) const
void GetScaled (float escalar, float result[4]) const
 Multiplies RGB components, keeps A component.
void GetScaled (float escalar, VPColor *result) const
 Multiplies RGB components, keeps A component.

Static Public Member Functions

static const VPColorBLACK ()
 Black opaque color.
static const VPColorRED ()
 Red opaque color.
static const VPColorGREEN ()
 Green opaque color.
static const VPColorBLUE ()
 Blue opaque color.
static const VPColorWHITE ()
 White opaque color.
static VPColor RANDOM ()
 Returns a randomly chosen color.

Friends

std::ostream & operator<< (std::ostream &output, const VPColor &c)


Detailed Description

RGBA color representation.

Definition at line 15 of file vpcolor.h.


Constructor & Destructor Documentation

VPColor::VPColor  ) 
 

Creates a black, opaque color.

Definition at line 31 of file vpcolor.cpp.

VPColor::VPColor const VPColor color  ) 
 

Definition at line 46 of file vpcolor.cpp.

References rgba.

VPColor::VPColor unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255
 

Definition at line 38 of file vpcolor.cpp.


Member Function Documentation

const VPColor & VPColor::BLACK  )  [static]
 

Black opaque color.

Definition at line 53 of file vpcolor.cpp.

Referenced by VPScene::VPScene().

const VPColor & VPColor::BLUE  )  [static]
 

Blue opaque color.

Definition at line 68 of file vpcolor.cpp.

References blue.

Referenced by VPMaterial::PLASTIC_BLUE().

void VPColor::Get float  rgbaVec[4]  )  const
 

Returns RGBA componts as a vector of floats.

Definition at line 106 of file vpcolor.cpp.

Referenced by VPMaterial::DrawOGL().

unsigned char VPColor::GetA  )  const [inline]
 

Definition at line 30 of file vpcolor.h.

unsigned char VPColor::GetB  )  const [inline]
 

Definition at line 29 of file vpcolor.h.

unsigned char VPColor::GetG  )  const [inline]
 

Definition at line 28 of file vpcolor.h.

unsigned char VPColor::GetR  )  const [inline]
 

Definition at line 27 of file vpcolor.h.

void VPColor::GetRGBA unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a
const
 

Definition at line 98 of file vpcolor.cpp.

void VPColor::GetScaled float  escalar,
VPColor result
const
 

Multiplies RGB components, keeps A component.

Use this method to make a color darker, by multipling it by a number in the range 0..1.

Parameters:
escalar [in] Number to multiply against RGB components. Should be in the range 0..1 in order to garantee that the result is in the range 0..1. No checking on the range is done.
result [out] Result of multiplication as VPColor. Components should be in the range 0..1, but no clamping is done.

Definition at line 155 of file vpcolor.cpp.

References rgba.

void VPColor::GetScaled float  escalar,
float  result[4]
const
 

Multiplies RGB components, keeps A component.

Use this method to make a color darker, by multipling it by a number in the range 0..1.

Parameters:
escalar [in] Number to multiply against RGB components. Should be in the range 0..1 in order to garantee that the result is in the range 0..1. No checking on the range is done.
result [out] Result of multiplication as RGBA float vector. Components should be in the range 0..1, but no clamping is done.

Definition at line 146 of file vpcolor.cpp.

Referenced by VPScene::DrawOGL(), VPLight::DrawOGL(), and VPMaterial::VPMaterial().

const VPColor & VPColor::GREEN  )  [static]
 

Green opaque color.

Definition at line 63 of file vpcolor.cpp.

References green.

Referenced by VPMaterial::PLASTIC_GREEN().

bool VPColor::operator!= const VPColor color  )  const
 

Definition at line 139 of file vpcolor.cpp.

References rgba.

VPColor VPColor::operator+ const VPColor color  )  const
 

Definition at line 120 of file vpcolor.cpp.

References rgba.

VPColor VPColor::operator- const VPColor color  )  const
 

Definition at line 126 of file vpcolor.cpp.

References rgba.

VPColor & VPColor::operator= const VPColor color  ) 
 

Definition at line 112 of file vpcolor.cpp.

References rgba.

bool VPColor::operator== const VPColor color  )  const
 

Definition at line 132 of file vpcolor.cpp.

References rgba.

VPColor VPColor::RANDOM  )  [static]
 

Returns a randomly chosen color.

You may want to initialize the random number generator with something like: srand(static_cast<unsigned int>(time(NULL))) before generating random colors.

Definition at line 78 of file vpcolor.cpp.

References SetA(), SetB(), SetG(), and SetR().

const VPColor & VPColor::RED  )  [static]
 

Red opaque color.

Definition at line 58 of file vpcolor.cpp.

References red.

Referenced by VPMaterial::PLASTIC_RED().

void VPColor::SetA unsigned char  a  )  [inline]
 

Definition at line 25 of file vpcolor.h.

Referenced by RANDOM().

void VPColor::SetB unsigned char  b  )  [inline]
 

Definition at line 24 of file vpcolor.h.

Referenced by RANDOM().

void VPColor::SetG unsigned char  g  )  [inline]
 

Definition at line 23 of file vpcolor.h.

Referenced by RANDOM().

void VPColor::SetR unsigned char  r  )  [inline]
 

Definition at line 22 of file vpcolor.h.

Referenced by RANDOM().

void VPColor::SetRGBA unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a
 

Definition at line 91 of file vpcolor.cpp.

Referenced by VPLight::VPLight().

const VPColor & VPColor::WHITE  )  [static]
 

White opaque color.

Definition at line 73 of file vpcolor.cpp.

Referenced by VPLight::BRIGHT_AMBIENT(), and VPLight::SUN().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  output,
const VPColor c
[friend]
 


The documentation for this class was generated from the following files:
Generated on Tue Sep 6 10:00:13 2005 for VPAT by  doxygen 1.4.4