Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/color.h

00001 /***************************************************************************
00002  *            color.h
00003  *
00004  *  Wed Sep  8 21:07:14 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024  
00025 #ifndef _COLOR_H
00026 #define _COLOR_H
00027 
00028 #ifdef WIN32
00029 #include <windows.h>
00030 #endif
00031 #include "build.h"
00032 
00033 namespace ngn
00034 {
00035         namespace core
00036         {
00037                 
00045                 template <class T> class NGN_API Color
00046                 {
00047                         public:
00048                                 
00049                                 Color()
00050                                 {
00051                                         r = g =b = 1;
00052                                 };
00053                                 Color( T red, T green, T blue )
00054                                 {
00055                                         r = red;
00056                                         g = green;
00057                                         b = blue;
00058                                 };
00059                                 Color( const Color& other )
00060                                 {
00061                                         r = other.r;
00062                                         g = other.g;
00063                                         b = other.b;
00064                                 };
00065                                 virtual ~Color()
00066                                 {
00067                                         
00068                                 };
00069                         
00070                                 bool operator==( const Color& other )
00071                                 {
00072                                         if( r != other.r || g !=other.g || b!=other.b )
00073                                                 return false;
00074                                         else 
00075                                         return true;
00076                                 };
00077                                 bool operator!=( const Color& other )
00078                                 {
00079                                         if( r != other.r && g !=other.g && b!=other.b )
00080                                                 return true;
00081                                         else 
00082                                         return false;   
00083                                 };
00084                         
00085                                 T r,g,b;
00086         
00087                 };
00088                 
00089                 typedef Color<float> NGN_API Colorf;
00090                 typedef Color<int> NGN_API Colori;
00091                 
00092                 
00093         }//core
00094 }//ngn
00095 #endif /* _COLOR_H */

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1