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

color.cpp

Go to the documentation of this file.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-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 
00019 #include "3d.h"
00020 #include "color.h"
00021 
00022 Color::Color()
00023 {
00024         Zero();
00025 }
00026 
00027 Color::Color (float r,float g,float b,float a)
00028 {
00029         Set(r,g,b,a);
00030 }
00031 
00032 Color::Color (float rgba)
00033 {
00034 }
00035 void Color::Zero()
00036 {
00037         r=0;
00038         g=0;
00039         b=0;
00040         a=1;
00041         isEnable = FALSE;
00042 }
00043 
00044 void Color::operator=(Color &source)
00045 {
00046         r = source.r;
00047         g = source.g;
00048         b = source.b;
00049         a = source.a; 
00050         isEnable = source.isEnable;
00051 }
00052 
00053 void Color::operator=(float *source)
00054 {
00055         r = source[0];
00056         g = source[1];
00057         b = source[2];
00058         a = source[3]; 
00059         isEnable = TRUE;
00060 }
00061 
00062 void Color::SetNull()
00063 {
00064         Set(0,0,0,0);
00065 }
00066 
00067 void Color::SetFull()
00068 {
00069         Set(1,1,1,1);
00070 }
00071 
00072 void Color::Set(float _r,float _g,float _b)
00073 {
00074         r = _r;
00075         g = _g;
00076         b = _b;
00077         isEnable = TRUE;
00078 }
00079 
00080 void Color::Set(float _r,float _g,float _b,float _a)
00081 {
00082         r = _r;
00083         g = _g;
00084         b = _b;
00085         a = _a;
00086         isEnable = TRUE;
00087 }
00088 
00089 Color::operator float *() const 
00090 {
00091         return (float *)&value;
00092 }
00093 void Color::ToString (MyString &text)
00094 {
00095         text<<"[enable,r,g,b,a]: "<<isEnable<<" , "<<r<<" , "<<g<<" , "<<b<<" , "<<a;
00096 }

Generated on Fri Aug 20 19:19:43 2004 for 3d Controls by doxygen 1.3.6