dms::Color

The Color class represents an RGBA color value. It can is derived from Vector4, and just adds a couple color-specific features. Classes that use colors (i.e. Material) treat them as Vector4s, so explicit use of the Color class is not required.

Source Code

Class Specification

#include <dms/Color.h>

Color(void);
Color(GLfloat r,GLfloat g,GLfloat b,GLfloat a);
void apply(void) const;

static const Color White;
static const Color Black;
static const Color Red;
static const Color Green;
static const Color Blue;
static const Color Cyan;
static const Color Magenta;
static const Color Yellow;
static const Color Grey10;
static const Color Grey20;
static const Color Grey30;
static const Color Grey40;
static const Color Grey50;
static const Color Grey60;
static const Color Grey70;
static const Color Grey80;
static const Color Grey90;

Description

Color(void)
Color(GLfloat r,GLfloat g,GLfloat b,GLfloat a)

The default constructor (with no arguments) creates the color (0,0,0,1) - black, with a solid alpha.

void apply(void) const

apply() calls glColor4fv with the color vector as its argument. e.g.:

Color purple(1, 0, 0.5, 1);
purple.apply();
static const Color White
etc.

The constant variables define a set of standard colors. The colors and their values are as follows:

White (1, 1, 1, 1)
Black (0, 0, 0, 1)
Red (1, 0, 0, 1)
Green (0, 1, 0, 1)
Blue (0, 0, 1, 1)
Cyan (0, 1, 1, 1)
Magenta (1, 0, 1, 1)
Yellow (1, 1, 0, 1)
Grey10 (.1, .1, .1, 1)
Grey20 (.2, .2, .2, 1)
Grey30 (.3, .3, .3, 1)
Grey40 (.4, .4, .4, 1)
Grey50 (.5, .5, .5, 1)
Grey60 (.6, .6, .6, 1)
Grey70 (.7, .7, .7, 1)
Grey80 (.8, .8, .8, 1)
Grey90 (.9, .9, .9, 1)