Main Page | Class Hierarchy | Class List | File List | Class Members

aedColor.h

00001 
00002 /*
00003  * The aedColor class
00004  * This class contains color values used by every widget
00005  * Initial design by Eduardo B. Fonseca <ebf@aedsolucoes.com.br>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library 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 GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the Free
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 #ifndef AEDCOLOR_H
00024 #define AEDCOLOR_H
00025 
00026 #include "dllmacros.h"
00027 #include <iostream>
00028 using namespace std;
00029 
00030 class DLLEXPORT aedColor
00031 {
00032   public:
00033     aedColor(Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a)
00034     {
00035         r = _r;
00036         g = _g;
00037         b = _b;
00038         a = _a;
00039     }
00040     aedColor()
00041     {
00042     }
00043     void setR(Uint8 c)
00044     {
00045         r = c;
00046     }
00047     void setG(Uint8 c)
00048     {
00049         g = c;
00050     }
00051     void setB(Uint8 c)
00052     {
00053         b = c;
00054     }
00055     void setA(Uint8 c)
00056     {
00057         a = c;
00058     }
00059     Uint8 getR(void)
00060     {
00061         return r;
00062     }
00063     Uint8 getG(void)
00064     {
00065         return g;
00066     }
00067     Uint8 getB(void)
00068     {
00069         return b;
00070     }
00071     Uint8 getA(void)
00072     {
00073         return a;
00074     }
00075     void dumpAll(void)
00076     {
00077         cout << "R: " << (int) r << endl;
00078         cout << "G: " << (int) g << endl;
00079         cout << "B: " << (int) b << endl;
00080         cout << "A: " << (int) a << endl;
00081     }
00082     void setAllColors(Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a)
00083     {
00084         r = _r;
00085         g = _g;
00086         b = _b;
00087         a = _a;
00088     }
00089     Uint32 getUint32(SDL_Surface * surface)
00090     {
00091         return SDL_MapRGBA(surface->format, r, g, b, a);
00092     }
00093     operator  SDL_Color() const
00094     {
00095         SDL_Color c;
00096           c.r = r;
00097           c.g = g;
00098           c.b = b;
00099           c.unused = a;
00100           return c;
00101     }
00102   private:
00103       Uint8 r, g, b, a;
00104 };
00105 
00106 #endif

Generated on Mon Mar 1 19:56:18 2004 for aedGUI by doxygen 1.3.6