<!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_pixelformat.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_pixelformat.h</h1><a href="sdlmm__pixelformat_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font> 00002 <font class="comment"> * SDmm - 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 00022 <font class="preprocessor">#ifndef SDLMM_PIXELFORMAT_H</font> 00023 <font class="preprocessor"></font><font class="preprocessor">#define SDLMM_PIXELFORMAT_H</font> 00024 <font class="preprocessor"></font> 00025 <font class="preprocessor">#include "<a class="code" href="sdlmm__color_8h.html">sdlmm_color.h</a>"</font> 00026 00027 <font class="keyword">namespace </font>SDLmm { 00029 <a name="l00034"></a><a class="code" href="classSDLmm_1_1PixelFormat.html">00034</a> <font class="keyword">class </font>PixelFormat { 00035 <font class="keyword">protected</font>: <a name="l00037"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#n0">00037</a> SDL_PixelFormat *me; 00038 00039 <font class="keyword">public</font>: 00041 <a name="l00046"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a0">00046</a> <font class="keyword">explicit</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a0">PixelFormat</a>(SDL_PixelFormat *pixelformat): me(pixelformat) { } 00047 <a name="l00049"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a1">00049</a> <font class="keyword">virtual</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a1">~PixelFormat</a>()<font class="keyword"> </font>{ 00050 }; 00051 00053 00054 00055 <a name="l00056"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a2">00056</a> <font class="keywordtype">bool</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a2">valid</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me != 0; } 00057 <a name="l00059"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a3">00059</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a3">BitsPerPixel</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->BitsPerPixel; } <a name="l00060"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a4">00060</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a4">BytesPerPixel</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->BytesPerPixel; } <a name="l00061"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a5">00061</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a5">Rshift</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Rshift; } <a name="l00062"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a6">00062</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a6">Gshift</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Gshift; } <a name="l00063"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a7">00063</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a7">Bshift</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Bshift; } 00064 <a name="l00065"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a8">00065</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a8">Rloss</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Rloss; } <a name="l00066"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a9">00066</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a9">Gloss</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Gloss; } <a name="l00067"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a10">00067</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a10">Bloss</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Bloss; } <a name="l00068"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a11">00068</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a11">Aloss</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Aloss; } 00069 <a name="l00070"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a12">00070</a> Uint32 <a class="code" href="classSDLmm_1_1PixelFormat.html#a12">Rmask</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Rmask; } <a name="l00071"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a13">00071</a> Uint32 <a class="code" href="classSDLmm_1_1PixelFormat.html#a13">Gmask</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Gmask; } <a name="l00072"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a14">00072</a> Uint32 <a class="code" href="classSDLmm_1_1PixelFormat.html#a14">Bmask</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Bmask; } <a name="l00073"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a15">00073</a> Uint32 <a class="code" href="classSDLmm_1_1PixelFormat.html#a15">Amask</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->Amask; } 00074 <a name="l00075"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a16">00075</a> Color <a class="code" href="classSDLmm_1_1PixelFormat.html#a16">colorkey</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->colorkey; } <a name="l00076"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a17">00076</a> Uint8 <a class="code" href="classSDLmm_1_1PixelFormat.html#a17">alpha</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->alpha; } <a name="l00077"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a18">00077</a> SDL_Palette *<a class="code" href="classSDLmm_1_1PixelFormat.html#a18">palette</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> me->palette; } 00078 00080 00100 Color <a class="code" href="classSDLmm_1_1PixelFormat.html#a19">MapRGB</a>(Uint8 r, Uint8 g, Uint8 b) <font class="keyword">const</font>; 00101 <a name="l00102"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a20">00102</a> Color <a class="code" href="classSDLmm_1_1PixelFormat.html#a19">MapRGB</a>(<font class="keyword">const</font> ColorRGB& colorrgb)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a19">MapRGB</a>(colorrgb.r, colorrgb.g, colorrgb.b); } 00103 00105 00125 Color <a class="code" href="classSDLmm_1_1PixelFormat.html#a21">MapRGBA</a>(Uint8 r, Uint8 g, Uint8 b, Uint8 a) <font class="keyword">const</font>; 00126 <a name="l00127"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a22">00127</a> Color <a class="code" href="classSDLmm_1_1PixelFormat.html#a21">MapRGBA</a>(<font class="keyword">const</font> ColorRGBA& colorrgba)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a21">MapRGBA</a>(colorrgba.r, colorrgba.g, colorrgba.b, colorrgba.a); } 00128 00130 00142 <font class="keywordtype">void</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a23">GetRGB</a>(Color pixel, Uint8 &r, Uint8 &g, Uint8 &b) <font class="keyword">const</font>; 00143 <a name="l00144"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a24">00144</a> <font class="keyword">const</font> ColorRGB <a class="code" href="classSDLmm_1_1PixelFormat.html#a23">GetRGB</a>(Color pixel)<font class="keyword"> const</font> 00145 <font class="keyword"> </font>{ 00146 ColorRGB colorrgb; 00147 <a class="code" href="classSDLmm_1_1PixelFormat.html#a23">GetRGB</a>(pixel, colorrgb.r, colorrgb.g, colorrgb.b); 00148 <font class="keywordflow">return</font> colorrgb; 00149 } 00150 00152 00165 <font class="keywordtype">void</font> <a class="code" href="classSDLmm_1_1PixelFormat.html#a25">GetRGBA</a>(Color pixel, Uint8 &r, Uint8 &g, Uint8 &b, Uint8 &a) <font class="keyword">const</font>; 00166 <a name="l00167"></a><a class="code" href="classSDLmm_1_1PixelFormat.html#a26">00167</a> <font class="keyword">const</font> ColorRGBA <a class="code" href="classSDLmm_1_1PixelFormat.html#a25">GetRGBA</a>(Color pixel)<font class="keyword"> const</font> 00168 <font class="keyword"> </font>{ 00169 ColorRGBA colorrgba; 00170 <a class="code" href="classSDLmm_1_1PixelFormat.html#a25">GetRGBA</a>(pixel, colorrgba.r, colorrgba.g, colorrgba.b, colorrgba.a); 00171 <font class="keywordflow">return</font> colorrgba; 00172 } 00173 }; 00174 } 00175 00176 <font class="preprocessor">#endif // SDLMM_PIXELFORMAT_H</font> 00177 <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>