Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 1891

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!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>Crystal Space 1.2.1: csgfx/inv_cmap.h File Reference (Crystal Space 1.2.1 Public API Reference)</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="head">
 <tr height="59">
  <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td>
  <td class="head"><h2>Public API Reference</h2></td>
 </tr>
 <tr height="11">
  <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td>
 </tr>
</table>
<div class="content">
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>csgfx/inv_cmap.h File Reference</h1>Compute an inverse colormap. <a href="#_details">More...</a>
<p>
<code>#include &quot;csextern.h&quot;</code><br>
<code>#include &quot;<a class="el" href="rgbpixel_8h-source.html">rgbpixel.h</a>&quot;</code><br>

<p>
<a href="inv__cmap_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="inv__cmap_8h.html#99836a24c4badc2aab116648dc3ffd58">csInverseColormap</a> (int colors, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *colormap, int rbits, int gbits, int bbits, <a class="el" href="group__util.html#gdde6aaee8457bee49c2a92621fe22b79">uint8</a> *&amp;rgbmap, <a class="el" href="group__util.html#g1134b580f8da4de94ca6b1de4d37975e">uint32</a> *dist_buf=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compute an inverse colormap efficiently.  <a href="#99836a24c4badc2aab116648dc3ffd58"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Compute an inverse colormap. 
<p>

<p>Definition in file <a class="el" href="inv__cmap_8h-source.html">inv_cmap.h</a>.</p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="99836a24c4badc2aab116648dc3ffd58"></a><!-- doxytag: member="inv_cmap.h::csInverseColormap" ref="99836a24c4badc2aab116648dc3ffd58" args="(int colors, csRGBpixel *colormap, int rbits, int gbits, int bbits, uint8 *&amp;rgbmap, uint32 *dist_buf=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csInverseColormap           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>colors</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&nbsp;</td>
          <td class="paramname"> <em>colormap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>rbits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>gbits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>bbits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__util.html#gdde6aaee8457bee49c2a92621fe22b79">uint8</a> *&amp;&nbsp;</td>
          <td class="paramname"> <em>rgbmap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__util.html#g1134b580f8da4de94ca6b1de4d37975e">uint32</a> *&nbsp;</td>
          <td class="paramname"> <em>dist_buf</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Compute an inverse colormap efficiently. 
<p>
<pre>Inputs:
 	colors:		Number of colors in the forward colormap.
 	colormap:	The forward colormap.
      rbits, gbits, bbits:
 			Number of quantization bits.  The inverse
 			colormap will have N=(2^rbits)*(2^gbits)*(2^bbits)
                      entries.
 	dist_buf:	An array of N long integers to be used as scratch
 			space. If 0, the dist_buff will be allocated
                      and freed before exiting the routine.
 Outputs:
 	rgbmap:		The output inverse colormap.  The entry
 			rgbmap[(r&lt;&lt;(gbits+bbits)) + (g&lt;&lt;bbits) + b]
 			is the colormap entry that is closest to the
 			(quantized) color (r,g,b). If 0, it will be
                      allocated with "new uint8* []"
 Assumptions:
 	Quantization is performed by right shift (low order bits are
 	truncated).  Thus, the distance to a quantized color is
 	actually measured to the color at the center of the cell
 	(i.e., to r+.5, g+.5, b+.5, if (r,g,b) is a quantized color).
 Algorithm:
 	Uses a "distance buffer" algorithm:
 	The distance from each representative in the forward color map
 	to each point in the rgb space is computed.  If it is less
 	than the distance currently stored in dist_buf, then the
 	corresponding entry in rgbmap is replaced with the current
 	representative (and the dist_buf entry is replaced with the
 	new distance).</pre><p>
<pre> 	The distance computation uses an efficient incremental formulation.</pre><p>
<pre> 	Distances are computed "outward" from each color.  If the
 	colors are evenly distributed in color space, the expected
 	number of cells visited for color I is N^3/I.
 	Thus, the complexity of the algorithm is O(log(K) N^3),
 	where K = colors, and N = 2^bits.
 </pre> BUGBUG: For some unknown reason the routine generates colormaps shifted towards red if green is bigger than red (and vice versa, shifted to green if red is bigger). Thus it is adviced to use same resolution for R and G. If someone can find out why it happens, he is free to do it -- A.Z. 
</div>
</div><p>
<hr size="1"><address><small>Generated for Crystal Space 1.2.1 by 
<a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 
</small></address> </div></body> </html>