Page principale | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Composants | Déclarations | Pages associées

color.h

Aller à la documentation de ce fichier.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_3D_COLOR_H
00024 #define INCLUDE_3D_COLOR_H
00025 
00032 class Color
00033 {
00034 public: 
00035         union
00036         {
00037                 float value[4];
00038                 struct 
00039                 {
00040                         float r;
00041                         float g;
00042                         float b;
00043                         float a;
00044                 };
00045         };
00046         BOOL isEnable;
00047 
00048 public:
00049         Color()
00050         {
00051                 Zero();
00052         }
00053 
00054         void Zero()
00055         {
00056                 r=0;
00057                 g=0;
00058                 b=0;
00059                 a=0;
00060                 isEnable = FALSE;
00061         }
00062 
00063         void operator=(Color &source)
00064         {
00065                 r = source.r;
00066                 g = source.g;
00067                 b = source.b;
00068                 a = source.a;
00069                 isEnable = source.isEnable;
00070         }
00071 
00072         void SetNull()
00073         {
00074                 Set(0,0,0,0);
00075         }
00076 
00077         void SetFull()
00078         {
00079                 Set(1,1,1,1);
00080         }
00081 
00082         void Set(float _r,float _g,float _b,float _a=0)
00083         {
00084                 r = _r;
00085                 g = _g;
00086                 b = _b;
00087                 a = _a;
00088                 isEnable = TRUE;
00089         }
00090 
00091         operator float *() const 
00092         {
00093                 return (float *)&value;
00094         }
00095         void ToString (MyString &text)
00096         {
00097                 text<<"[enable,r,g,b,a]: "<<isEnable<<" , "<<r<<" , "<<g<<" , "<<b<<" , "<<a;
00098         }
00099 };
00100 
00101 #endif

Généré le Thu Apr 8 18:52:12 2004 pour 3D Controls par doxygen 1.3.6