<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>sdlmm_color.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.8.1 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>sdlmm_color.h</h1><a href="sdlmm__color_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font> 00002 <font class="comment"> * SDLmm - a C++ wrapper for SDL and related libraries</font> 00003 <font class="comment"> * Copyright © 2001 David Hedbor <david@hedbor.org></font> 00004 <font class="comment"> * </font> 00005 <font class="comment"> * This program is free software; you can redistribute it and/or</font> 00006 <font class="comment"> * modify it under the terms of the GNU General Public License as</font> 00007 <font class="comment"> * published by the Free Software Foundation; either version 2 of the</font> 00008 <font class="comment"> * License, or (at your option) any later version.</font> 00009 <font class="comment"> * </font> 00010 <font class="comment"> * This program is distributed in the hope that it will be useful, but</font> 00011 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00012 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> 00013 <font class="comment"> * General Public License for more details.</font> 00014 <font class="comment"> * </font> 00015 <font class="comment"> * You should have received a copy of the GNU General Public License</font> 00016 <font class="comment"> * along with this program; if not, write to the Free Software</font> 00017 <font class="comment"> * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</font> 00018 <font class="comment"> *</font> 00019 <font class="comment"> */</font> 00020 00021 <font class="preprocessor">#ifndef SDLMM_COLOR_H</font> 00022 <font class="preprocessor"></font><font class="preprocessor">#define SDLMM_COLOR_H</font> 00023 <font class="preprocessor"></font> 00024 <font class="keyword">namespace </font>SDLmm { <a name="l00025"></a><a class="code" href="namespace__SDLmm.html#a0">00025</a> <font class="keyword">typedef</font> Uint32 Color; 00026 <a name="l00032"></a><a class="code" href="classSDLmm_1_1ColorRGB.html">00032</a> <font class="keyword">class </font>ColorRGB { 00033 <font class="keyword">public</font>: <a name="l00036"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#a0">00036</a> <a class="code" href="classSDLmm_1_1ColorRGB.html#a0">ColorRGB</a>() : r(0), g(0), b(0) { 00037 } 00038 00041 <a name="l00042"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#a1">00042</a> <a class="code" href="classSDLmm_1_1ColorRGB.html#a0">ColorRGB</a>(<font class="keyword">const</font> ColorRGB& color) : r(color.r), g(color.g), b(color.b) { 00043 } 00044 00046 <a name="l00051"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#a2">00051</a> <a class="code" href="classSDLmm_1_1ColorRGB.html#a0">ColorRGB</a>(Uint8 nr, Uint8 ng, Uint8 nb) : r(nr), g(ng), b(nb) { 00052 } 00053 <a name="l00055"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#a3">00055</a> ColorRGB& <a class="code" href="classSDLmm_1_1ColorRGB.html#a3">operator=</a>(<font class="keyword">const</font> ColorRGB& color)<font class="keyword"> </font>{ 00056 <font class="keywordflow">if</font>(<font class="keyword">this</font> != &color) 00057 { 00058 r = color.r; 00059 g = color.g; 00060 b = color.b; 00061 } 00062 <font class="keywordflow">return</font> *<font class="keyword">this</font>; 00063 } 00064 00066 <a name="l00069"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#a4">00069</a> <font class="keywordtype">bool</font> <a class="code" href="classSDLmm_1_1ColorRGB.html#a4">operator==</a>(<font class="keyword">const</font> ColorRGB& color)<font class="keyword"> const </font>{ 00070 <font class="keywordflow">return</font> ((r == color.r) && (g == color.g) && (b == color.b)); 00071 } 00072 <a name="l00073"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#m0">00073</a> Uint8 r; <a name="l00074"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#m1">00074</a> Uint8 g; <a name="l00075"></a><a class="code" href="classSDLmm_1_1ColorRGB.html#m2">00075</a> Uint8 b; 00076 }; 00077 <a name="l00083"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html">00083</a> <font class="keyword">class </font>ColorRGBA : <font class="keyword">public</font> ColorRGB { 00084 <font class="keyword">public</font>: <a name="l00087"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html#a0">00087</a> <a class="code" href="classSDLmm_1_1ColorRGBA.html#a0">ColorRGBA</a>() : ColorRGB(), a(0) { 00088 } 00089 00092 <a name="l00093"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html#a1">00093</a> <a class="code" href="classSDLmm_1_1ColorRGBA.html#a0">ColorRGBA</a>(<font class="keyword">const</font> ColorRGBA& color) : ColorRGB(color), a(color.a) { 00094 } 00095 00097 <a name="l00103"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html#a2">00103</a> <a class="code" href="classSDLmm_1_1ColorRGBA.html#a0">ColorRGBA</a>(Uint8 nr, Uint8 ng, Uint8 nb, Uint8 na) : ColorRGB(nr, ng, nb), a(na) { 00104 } 00105 <a name="l00107"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html#a3">00107</a> ColorRGBA& <a class="code" href="classSDLmm_1_1ColorRGBA.html#a3">operator=</a>(<font class="keyword">const</font> ColorRGBA& color)<font class="keyword"> </font>{ 00108 <font class="keywordflow">if</font>(<font class="keyword">this</font> != &color) 00109 { 00110 ColorRGB::operator=(color); 00111 a = color.a; 00112 } 00113 <font class="keywordflow">return</font> *<font class="keyword">this</font>; 00114 } 00115 00117 <a name="l00120"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html#a4">00120</a> <font class="keywordtype">bool</font> <a class="code" href="classSDLmm_1_1ColorRGBA.html#a4">operator==</a>(<font class="keyword">const</font> ColorRGBA& color)<font class="keyword"> const </font>{ 00121 <font class="keywordflow">return</font> (ColorRGB::operator==(color) && (a == color.a)); 00122 } 00123 <a name="l00124"></a><a class="code" href="classSDLmm_1_1ColorRGBA.html#m0">00124</a> Uint8 a; 00125 }; 00126 } 00127 00128 <font class="preprocessor">#endif // SDLMM_COLOR_H</font> 00129 <font class="preprocessor"></font> </pre></div><hr> <table cellspacing=10 cellpadding=0 border=0 width=100%> <tr valign=middle><td><font size=-1>Documentation automatically generated by <a href="http://www.stack.nl/~dimitri/doxygen/"><img border=0 align=center src="doxygen.gif" alt="doxygen"></a> written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>.</font></td> <td align=right><font size=-1>Project hosted at <br><a href="http://sourceforge.net"><img align=middle src="http://sourceforge.net/sflogo.php?group_id=25445&type=1" width="88" height="31" border="0" alt="Hosted by SourceForge"></a></font></td></tr></table>