Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-release > by-pkgid > dabbad934aa2b21dfdf7cadba1bf877f > files > 34

libSDL_gfx-devel-2.0.22-1.mga1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SDL_gfx: SDL_gfxBlitFunc.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>SDL_gfxBlitFunc.h</h1><a href="_s_d_l__gfx_blit_func_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">SDL_gfxBlitFunc: custom blitters (part of SDL_gfx library)</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">LGPL (c) A. Schiffler</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">*/</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef _SDL_gfxBlitFunc_h</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_gfxBlitFunc_h</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="comment">/* Set up for C function definitions, even when using C++ */</span>
<a name="l00013"></a>00013 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="keyword">extern</span>    <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00015"></a>00015 <span class="preprocessor">#endif</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;SDL.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;SDL_video.h&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023         <span class="comment">/* ---- Function Prototypes */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#if defined(WIN32) || defined(WIN64)</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#  if defined(DLL_EXPORT) &amp;&amp; !defined(LIBSDL_GFX_DLL_IMPORT)</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#    define SDL_GFXBLITFUNC_SCOPE __declspec(dllexport)</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#  else</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#    ifdef LIBSDL_GFX_DLL_IMPORT</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#      define SDL_GFXBLITFUNC_SCOPE __declspec(dllimport)</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#    endif</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#  endif</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_GFXBLITFUNC_SCOPE</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#  define SDL_GFXBLITFUNC_SCOPE extern</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039         SDL_GFXBLITFUNC_SCOPE <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#ac51ff40d39f3dd0bd08116e8953960f8" title="Blitter for RGBA-&amp;gt;RGBA blits with alpha adjustment.">SDL_gfxBlitRGBA</a>(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041         SDL_GFXBLITFUNC_SCOPE <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a09a376775f9d8c933c7121e34fe5ecfc" title="Sets the alpha channel in a 32 bit surface.">SDL_gfxSetAlpha</a>(SDL_Surface * src, Uint8 a);
<a name="l00042"></a>00042 
<a name="l00043"></a>00043         SDL_GFXBLITFUNC_SCOPE <span class="keywordtype">int</span> <a class="code" href="_s_d_l__gfx_blit_func_8c.html#a4ece530dca0ae46b1f5a780f85371687" title="Multiply the alpha channel in a 32bit surface.">SDL_gfxMultiplyAlpha</a>(SDL_Surface * src, Uint8 a);
<a name="l00044"></a>00044 
<a name="l00045"></a>00045         <span class="comment">/* -------- Macros */</span>
<a name="l00046"></a>00046 
<a name="l00047"></a>00047         <span class="comment">/* Define SDL macros locally as a substitute for an #include &quot;SDL_blit.h&quot;, */</span>
<a name="l00048"></a>00048         <span class="comment">/* which doesn&#39;t work since the include file doesn&#39;t get installed.       */</span>
<a name="l00049"></a>00049 
<a name="l00053"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html">00053</a>         <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00054"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">00054</a>                 Uint8    *s_pixels;
<a name="l00055"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">00055</a>                 <span class="keywordtype">int</span>       s_width;
<a name="l00056"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">00056</a>                 <span class="keywordtype">int</span>       s_height;
<a name="l00057"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">00057</a>                 <span class="keywordtype">int</span>       s_skip;
<a name="l00058"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">00058</a>                 Uint8    *d_pixels;
<a name="l00059"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">00059</a>                 <span class="keywordtype">int</span>       d_width;
<a name="l00060"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">00060</a>                 <span class="keywordtype">int</span>       d_height;
<a name="l00061"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">00061</a>                 <span class="keywordtype">int</span>       d_skip;
<a name="l00062"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">00062</a>                 <span class="keywordtype">void</span>     *aux_data;
<a name="l00063"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">00063</a>                 SDL_PixelFormat *src;
<a name="l00064"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">00064</a>                 Uint8    *table;
<a name="l00065"></a><a class="code" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">00065</a>                 SDL_PixelFormat *dst;
<a name="l00066"></a>00066         } <a class="code" href="struct_s_d_l__gfx_blit_info.html" title="The structure passed to the low level blit functions.">SDL_gfxBlitInfo</a>;
<a name="l00067"></a>00067 
<a name="l00071"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#ae6b2c815be86ad92310efb40d4b0b30e">00071</a> <span class="preprocessor">#define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a)                             \</span>
<a name="l00072"></a>00072 <span class="preprocessor">        {                                                                       \</span>
<a name="l00073"></a>00073 <span class="preprocessor">        r = ((pixel&amp;fmt-&gt;Rmask)&gt;&gt;fmt-&gt;Rshift)&lt;&lt;fmt-&gt;Rloss;              \</span>
<a name="l00074"></a>00074 <span class="preprocessor">        g = ((pixel&amp;fmt-&gt;Gmask)&gt;&gt;fmt-&gt;Gshift)&lt;&lt;fmt-&gt;Gloss;              \</span>
<a name="l00075"></a>00075 <span class="preprocessor">        b = ((pixel&amp;fmt-&gt;Bmask)&gt;&gt;fmt-&gt;Bshift)&lt;&lt;fmt-&gt;Bloss;              \</span>
<a name="l00076"></a>00076 <span class="preprocessor">        a = ((pixel&amp;fmt-&gt;Amask)&gt;&gt;fmt-&gt;Ashift)&lt;&lt;fmt-&gt;Aloss;              \</span>
<a name="l00077"></a>00077 <span class="preprocessor">        }</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span>
<a name="l00082"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a874180f742c36ca537c247036f05c182">00082</a> <span class="preprocessor">#define GFX_DISEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a)                        \</span>
<a name="l00083"></a>00083 <span class="preprocessor">        do {                                                                       \</span>
<a name="l00084"></a>00084 <span class="preprocessor">        pixel = *((Uint32 *)(buf));                                        \</span>
<a name="l00085"></a>00085 <span class="preprocessor">        GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a);                       \</span>
<a name="l00086"></a>00086 <span class="preprocessor">        pixel &amp;= ~fmt-&gt;Amask;                                              \</span>
<a name="l00087"></a>00087 <span class="preprocessor">        } while(0)</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span>
<a name="l00092"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420">00092</a> <span class="preprocessor">#define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a)                             \</span>
<a name="l00093"></a>00093 <span class="preprocessor">        {                                                                       \</span>
<a name="l00094"></a>00094 <span class="preprocessor">        pixel = ((r&gt;&gt;fmt-&gt;Rloss)&lt;&lt;fmt-&gt;Rshift)|                         \</span>
<a name="l00095"></a>00095 <span class="preprocessor">        ((g&gt;&gt;fmt-&gt;Gloss)&lt;&lt;fmt-&gt;Gshift)|                         \</span>
<a name="l00096"></a>00096 <span class="preprocessor">        ((b&gt;&gt;fmt-&gt;Bloss)&lt;&lt;fmt-&gt;Bshift)|                         \</span>
<a name="l00097"></a>00097 <span class="preprocessor">        ((a&lt;&lt;fmt-&gt;Aloss)&lt;&lt;fmt-&gt;Ashift);                         \</span>
<a name="l00098"></a>00098 <span class="preprocessor">        }</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span>
<a name="l00103"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5">00103</a> <span class="preprocessor">#define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)                    \</span>
<a name="l00104"></a>00104 <span class="preprocessor">        {                                                                       \</span>
<a name="l00105"></a>00105 <span class="preprocessor">        Uint32 pixel;                                   \</span>
<a name="l00106"></a>00106 <span class="preprocessor">        \</span>
<a name="l00107"></a>00107 <span class="preprocessor">        GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);    \</span>
<a name="l00108"></a>00108 <span class="preprocessor">        *((Uint32 *)(buf)) = pixel;                     \</span>
<a name="l00109"></a>00109 <span class="preprocessor">        }</span>
<a name="l00110"></a>00110 <span class="preprocessor"></span>
<a name="l00114"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6">00114</a> <span class="preprocessor">#define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB)      \</span>
<a name="l00115"></a>00115 <span class="preprocessor">        do {                                            \</span>
<a name="l00116"></a>00116 <span class="preprocessor">        dR = (((sR-dR)*(A))/255)+dR;            \</span>
<a name="l00117"></a>00117 <span class="preprocessor">        dG = (((sG-dG)*(A))/255)+dG;            \</span>
<a name="l00118"></a>00118 <span class="preprocessor">        dB = (((sB-dB)*(A))/255)+dB;            \</span>
<a name="l00119"></a>00119 <span class="preprocessor">        } while(0)</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span>
<a name="l00126"></a><a class="code" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4">00126</a> <span class="preprocessor">#define GFX_DUFFS_LOOP4(pixel_copy_increment, width)                    \</span>
<a name="l00127"></a>00127 <span class="preprocessor">        { int n = (width+3)/4;                                                  \</span>
<a name="l00128"></a>00128 <span class="preprocessor">        switch (width &amp; 3) {                                            \</span>
<a name="l00129"></a>00129 <span class="preprocessor">        case 0: do {    pixel_copy_increment;                           \</span>
<a name="l00130"></a>00130 <span class="preprocessor">        case 3:         pixel_copy_increment;                           \</span>
<a name="l00131"></a>00131 <span class="preprocessor">        case 2:         pixel_copy_increment;                           \</span>
<a name="l00132"></a>00132 <span class="preprocessor">        case 1:         pixel_copy_increment;                           \</span>
<a name="l00133"></a>00133 <span class="preprocessor">        } while ( --n &gt; 0 );                                    \</span>
<a name="l00134"></a>00134 <span class="preprocessor">        }                                                               \</span>
<a name="l00135"></a>00135 <span class="preprocessor">        }</span>
<a name="l00136"></a>00136 <span class="preprocessor"></span>
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 
<a name="l00139"></a>00139         <span class="comment">/* Ends C function definitions when using C++ */</span>
<a name="l00140"></a>00140 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00141"></a>00141 <span class="preprocessor"></span>}
<a name="l00142"></a>00142 <span class="preprocessor">#endif</span>
<a name="l00143"></a>00143 <span class="preprocessor"></span>
<a name="l00144"></a>00144 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_gfxBlitFunc_h */</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>