aedColor.h

Go to the documentation of this file.
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 //Removed by Daniel Aarno
00029 //using namespace std;
00030 
00031 class DLLEXPORT aedColor
00032 {
00033   public:
00034     aedColor(Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a)
00035     {
00036         r = _r;
00037         g = _g;
00038         b = _b;
00039         a = _a;
00040     }
00041     aedColor()
00042     {
00043     }
00044     void setR(Uint8 c)
00045     {
00046         r = c;
00047     }
00048     void setG(Uint8 c)
00049     {
00050         g = c;
00051     }
00052     void setB(Uint8 c)
00053     {
00054         b = c;
00055     }
00056     void setA(Uint8 c)
00057     {
00058         a = c;
00059     }
00060     Uint8 getR(void)
00061     {
00062         return r;
00063     }
00064     Uint8 getG(void)
00065     {
00066         return g;
00067     }
00068     Uint8 getB(void)
00069     {
00070         return b;
00071     }
00072     Uint8 getA(void)
00073     {
00074         return a;
00075     }
00076     void dumpAll(void)
00077     {
00078         std::cout << "R: " << (int) r << std::endl;
00079         std::cout << "G: " << (int) g << std::endl;
00080         std::cout << "B: " << (int) b << std::endl;
00081         std::cout << "A: " << (int) a << std::endl;
00082     }
00083     void setAllColors(Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a)
00084     {
00085         r = _r;
00086         g = _g;
00087         b = _b;
00088         a = _a;
00089     }
00090     Uint32 getUint32(SDL_Surface * surface)
00091     {
00092         return SDL_MapRGBA(surface->format, r, g, b, a);
00093     }
00094     operator  SDL_Color() const
00095     {
00096         SDL_Color c;
00097           c.r = r;
00098           c.g = g;
00099           c.b = b;
00100           c.unused = a;
00101           return c;
00102     }
00103   private:
00104       Uint8 r, g, b, a;
00105 };
00106 
00107 #endif

Generated on Sun Mar 11 15:33:23 2007 for MetalWarriors by  doxygen 1.4.7