Color.h

Go to the documentation of this file.
00001 //**********************************************************************
00002 //
00003 //  REGCOM: Regimental Command
00004 //  Copyright (C) 2008 Randi J. Relander
00005 //    <rjrelander@users.sourceforge.net>
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 3
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 //  
00017 //  You should have received a copy of the GNU General Public
00018 //  License along with this program.  If not, see 
00019 //  <http://www.gnu.org/licenses/>.
00020 //  
00021 //**********************************************************************
00022 
00023 #ifndef REGCOM_GUI_COLOR_H
00024 #define REGCOM_GUI_COLOR_H
00025 
00026 // SYSTEM INCLUDES
00027 #include <string>
00028 
00029 // LIBRARY INCLUDES
00030 #include "SDL.h"
00031 
00032 // NAMESPACES
00033 namespace regcom {
00034 namespace gui {
00035 
00037 //  CLASS: Color
00043 class Color
00044 {
00045 public:
00046 
00047     // PUBLIC METHODS
00048 
00050     Color() {}
00051 
00053     Color(Uint8 red, Uint8 green, Uint8 blue)
00054     { 
00055         m_Red = red; 
00056         m_Green = green; 
00057         m_Blue = blue; 
00058         m_Alpha = 255; 
00059     }
00060     
00062     Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha)
00063     { 
00064         m_Red = red; 
00065         m_Green = green; 
00066         m_Blue = blue; 
00067         m_Alpha = alpha; 
00068     }
00069     
00071     virtual ~Color() {}
00072 
00074     Uint32 MapRGB(const Surface& rSurface) const 
00075     { 
00076         return rSurface.MapRGB(m_Red, m_Green, m_Blue);
00077     }
00078 
00080     Uint32 MapRGBA(const Surface& rSurface) const 
00081     { 
00082         return rSurface.MapRGBA(m_Red, m_Green, m_Blue, m_Alpha);
00083     }
00084 
00085 private:
00086 
00087     // MEMBER VARIABLES
00088 
00090     Uint8 m_Red;
00091 
00093     Uint8 m_Green;
00094 
00096     Uint8 m_Blue;
00097 
00099     Uint8 m_Alpha;
00100 };
00101 
00102 } // namespace gui
00103 } // namespace regcom
00104 
00105 #endif