Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Color Class Reference

#include <color.h>

List of all members.

Public Methods

 Color ()
 Color (rgb col)
 Color (float rf, float gf, float bf)
 ~Color ()
const Color operator+ (const Color &col) const
const Color operator * (const float &alpha) const
const Color operator/ (const float &scalar) const
const Color operator= (const Color &col)
const Color operator+= (const Color &col)
rgb toRGB ()

Public Attributes

float r
float g
float b


Constructor & Destructor Documentation

Color::Color   [inline]
 

Definition at line 18 of file color.h.

Referenced by operator *(), operator+(), and operator/().

00018 { r = 0.0; g = 0.0; b = 0.0;};

Color::Color rgb    col
 

Definition at line 4 of file color.cpp.

References rgb::b, b, rgb::g, g, rgb::r, and r.

00005 {
00006         r = (float)col.r;
00007         g = (float)col.g;
00008         b = (float)col.b;
00009 }

Color::Color float    rf,
float    gf,
float    bf
 

Definition at line 11 of file color.cpp.

References b, g, and r.

00012 {
00013         if(rf > 255.0) rf = 255.0;
00014         if(gf > 255.0) gf = 255.0;
00015         if(bf > 255.0) bf = 255.0;
00016         if(rf < 0.0) rf = 0.0;
00017         if(gf < 0.0) gf = 0.0;
00018         if(bf < 0.0) bf = 0.0;
00019         r = rf;
00020         b = bf;
00021         g = gf;
00022 }

Color::~Color   [inline]
 

Definition at line 21 of file color.h.

00021 {};


Member Function Documentation

const Color Color::operator * const float &    alpha const
 

Definition at line 37 of file color.cpp.

References Color().

00038 {
00039         return Color(r * alpha, g * alpha, b * alpha);
00040 }

const Color Color::operator+ const Color &    col const
 

Definition at line 24 of file color.cpp.

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

00025 {
00026         return Color(r + col.r, g + col.g, b + col.b);
00027 }

const Color Color::operator+= const Color &    col
 

Definition at line 29 of file color.cpp.

References b, g, and r.

00030 {
00031         r += col.r;
00032         g += col.g;
00033         b += col.b;
00034         return *this;
00035 }

const Color Color::operator/ const float &    scalar const
 

Definition at line 42 of file color.cpp.

References Color().

00043 {
00044         return Color(r / scalar, g / scalar, b / scalar);
00045 }

const Color Color::operator= const Color &    col
 

Definition at line 47 of file color.cpp.

References b, g, and r.

00048 {
00049          r = col.r;
00050          g = col.g;
00051          b = col.b;
00052          return *this;
00053 }

rgb Color::toRGB  
 

Definition at line 56 of file color.cpp.

References b, rgb::b, g, rgb::g, r, and rgb::r.

Referenced by Perspective::Raycast(), and Raycaster::Raycast().

00057 {
00058         rgb col;
00059         col.b = (unsigned char) b;
00060         col.g = (unsigned char) g;
00061         col.r = (unsigned char) r;
00062         return col;
00063 }


Member Data Documentation

float Color::b
 

Definition at line 16 of file color.h.

Referenced by Color(), operator+(), operator+=(), operator=(), and toRGB().

float Color::g
 

Definition at line 16 of file color.h.

Referenced by Color(), operator+(), operator+=(), operator=(), and toRGB().

float Color::r
 

Definition at line 16 of file color.h.

Referenced by Color(), operator+(), operator+=(), operator=(), and toRGB().


The documentation for this class was generated from the following files:
Generated on Thu Jan 23 12:32:16 2003 by doxygen1.3-rc2