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

Color.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_UTILS_COLOR_H 00012 #define OPENCAL_UTILS_COLOR_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 00017 /* 00018 #ifdef USE_QT 00019 #include <qcolor.h> 00020 #endif // USE_QT 00021 */ 00022 00023 00024 namespace OpenCAL 00025 { 00026 namespace Utils 00027 { 00031 00032 class OPENCAL_API Color 00033 { 00034 private: 00035 // Member variables 00036 float m_values[4]; 00037 00038 public: 00039 // Static colors (on seperate lines, otherwise the msvc++ compiler doesn't work) 00040 static Color white; 00041 static Color black; 00042 static Color red; 00043 static Color blue; 00044 static Color green; 00045 static Color yellow; 00046 00047 public: 00048 // Constructors and destructor 00049 Color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f); 00050 Color(float *values); 00051 Color(const Color &source); 00052 virtual ~Color(); 00053 00054 // Get functions 00055 float *get() { return m_values; } 00056 float getR() const { return m_values[0]; } 00057 float getG() const { return m_values[1]; } 00058 float getB() const { return m_values[2]; } 00059 float getA() const { return m_values[3]; } 00060 00061 // Set functions 00062 void set(float r, float g, float b, float a = 1.0f); 00063 void set(float *values); 00064 void setR(float r) { m_values[0] = r; } 00065 void setG(float g) { m_values[1] = g; } 00066 void setB(float b) { m_values[2] = b; } 00067 void setA(float a) { m_values[3] = a; } 00068 00069 // Operators 00070 Color operator/(float factor) const; 00071 00072 // Cast operators 00073 operator const float *() const { return m_values; } 00074 00075 /* 00076 #ifdef USE_QT 00077 // Cast to a QT color 00078 operator QColor() const; 00079 #endif // USE_QT 00080 */ 00081 }; 00082 } 00083 } 00084 00085 #endif // ifndef OPENCAL_UTILS_COLOR_H

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8