TonicTones
Src/Api/Color.h
00001 //      Color.h
00002 //      
00003 //      Copyright 2010 Jérémy Laumon <jeremy.laumon@gmail.com>
00004 //      
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 2 of the License, or
00008 //      (at your option) any later version.
00009 //      
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //      
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program; if not, write to the Free Software
00017 //      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018 //      MA 02110-1301, USA.
00019 
00020 
00021 #ifndef COLOR_H
00022 #define COLOR_H
00023 
00024 #include <QtGui>
00025 
00026 class Color
00027 {
00028 public:
00029     Color();
00030     Color(float f1, float f2, float f3);
00031     
00032     Color& operator =(const QVector3D& vect);
00033     
00034     Color operator *(float f) const;
00035     
00036     QVector3D toVect() const;
00037     
00038     float& operator [](int i)
00039     {
00040         return val[i];
00041     }
00042 
00043     const float& operator [](int i) const
00044     {
00045         return val[i];
00046     }
00047     
00048     Color clamp() const;
00049     
00050     void set(float f1, float f2, float f3)
00051     {
00052         val[0] = f1;
00053         val[1] = f2;
00054         val[2] = f3;
00055     }
00056     
00057 private:
00058     float val[3];
00059    
00060 };
00061 
00062 #endif
 All Classes Functions Variables