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

Color Class Reference

Klasse die Operationen auf Farbwerten definiert, um ein einfaches rechnen mit Farben zu ermöglichen. More...

#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
 Addition zweier Farbwerte.

const Color operator * (const float &alpha) const
 Multiplikation eines Farbwertes mit einem Skalar.

const Color operator/ (const float &scalar) const
 Divisiion eines Farbwertes durch einen Skalar.

const Color operator= (const Color &col)
const Color operator+= (const Color &col)
rgb toRGB ()

Public Attributes

float r
float g
float b


Detailed Description

Klasse die Operationen auf Farbwerten definiert, um ein einfaches rechnen mit Farben zu ermöglichen.

Definition at line 16 of file color.h.


Constructor & Destructor Documentation

Color::Color   [inline]
 

Definition at line 20 of file color.h.

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

00020 { 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 23 of file color.h.

00023 {};


Member Function Documentation

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

Multiplikation eines Farbwertes mit einem Skalar.

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
 

Addition zweier Farbwerte.

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
 

Divisiion eines Farbwertes durch einen Skalar.

Definition at line 43 of file color.cpp.

References Color().

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

const Color Color::operator= const Color &    col
 

Definition at line 48 of file color.cpp.

References b, g, and r.

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

rgb Color::toRGB  
 

Definition at line 57 of file color.cpp.

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

Referenced by Raycaster::Raycast().

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


Member Data Documentation

float Color::b
 

Definition at line 18 of file color.h.

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

float Color::g
 

Definition at line 18 of file color.h.

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

float Color::r
 

Definition at line 18 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 30 21:35:44 2003 for 3DVis by doxygen1.3-rc2