Sophie

Sophie

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

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: csColorQuantizer Class 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 class="current"><a href="classes.html"><span>Classes</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<div class="tabs">
  <ul>
    <li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  </ul>
</div>
<h1>csColorQuantizer Class Reference<br>
<small>
[<a class="el" href="group__gfx.html">Graphics</a>]</small>
</h1><!-- doxytag: class="csColorQuantizer" -->Color quantizer.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="quantize_8h-source.html">csgfx/quantize.h</a>&gt;</code>
<p>

<p>
<a href="classcsColorQuantizer-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member 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="classcsColorQuantizer.html#a99aba3acc8f79e6c867d71d77778f39">Begin</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Begin quantization.  <a href="#a99aba3acc8f79e6c867d71d77778f39"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#5b129e8522810832a77ae9c415ef76b9">Bias</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *colors, int count, int weight)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Bias the color histogram towards given colors (weight = 0..100).  <a href="#5b129e8522810832a77ae9c415ef76b9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#cc124c95457499d948e427b174083323">Count</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *image, int pixels, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *transp=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Count the colors in a image and update the color histogram.  <a href="#cc124c95457499d948e427b174083323"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#49d60c8a4d264fd6410499fab38618ec">csColorQuantizer</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct a new quantizer object.  <a href="#49d60c8a4d264fd6410499fab38618ec"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#9749bf308670ef122aa1d9a4ee95c186">DoRGB</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *image, int pixels, int pixperline, <a class="el" href="group__util.html#gdde6aaee8457bee49c2a92621fe22b79">uint8</a> *&amp;outimage, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&amp;outpalette, int &amp;maxcolors, bool dither)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Quantize a RGB image into a paletted image.  <a href="#9749bf308670ef122aa1d9a4ee95c186"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#9174b689fa185583f1bbc4be4d0512f9">End</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Finish quantization.  <a href="#9174b689fa185583f1bbc4be4d0512f9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7">Palette</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&amp;outpalette, int &amp;maxcolors, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *transp=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compute the optimal palette for all images passed to QuantizeCount().  <a href="#44e180da2038e1116c5022a59f5faed7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#3a362b950a4f573a8db19a0419f73fd5">Remap</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *image, int pixels, <a class="el" href="group__util.html#gdde6aaee8457bee49c2a92621fe22b79">uint8</a> *&amp;outimage, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *transp=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remap a image to the palette computed by <a class="el" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7" title="Compute the optimal palette for all images passed to QuantizeCount().">Palette()</a>.  <a href="#3a362b950a4f573a8db19a0419f73fd5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#31300ceea4f021472f9209c4d75ea42b">RemapDither</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *image, int pixels, int pixperline, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *palette, int colors, <a class="el" href="group__util.html#gdde6aaee8457bee49c2a92621fe22b79">uint8</a> *&amp;outimage, <a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *transp=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Same but apply Floyd-Steinberg dithering for nicer (but slower) results.  <a href="#31300ceea4f021472f9209c4d75ea42b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#19e4ae4e4f8053ed6bf6fba1995b2d94">~csColorQuantizer</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destruct and cleanup.  <a href="#19e4ae4e4f8053ed6bf6fba1995b2d94"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="91ce807a34273beb4a3f93fae8416ece"></a><!-- doxytag: member="csColorQuantizer::csColorBox" ref="91ce807a34273beb4a3f93fae8416ece" args="" -->
struct&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcsColorQuantizer.html#91ce807a34273beb4a3f93fae8416ece">csColorBox</a></td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Color quantizer. 
<p>
The algorithm presented here is a variation of well-known and widely-used Heckbert quantization algorithm. It works in the following way: first, we build a 3-D histogram that describes which colors and how many times the corresponding colors were used. Since we deal with RGB images, all possible colors counts to 256^3 = 16777216 colors, too much to keep in memory. Because of this, we ignore several lowest bits from each color component, taking into consideration human eye's sensivity to different color components we take 5 bits for R, 6 bits for G and 4 bits for B. This summary reduces to 32*64*16 = 32768 histogram cells, which is a reasonable size for an dynamically-allocated array. <p>
Next, we take the entire color box and split it into subboxes. The split happens along the longest of R,G,B axis into half (and taking again into account eye sensivity). After which we take again the biggest box, and split it again and so on until we have that much boxes how much colors we want. Then we assign to each box a color index, and compute the median RGB value for each box. <p>
To keep memory requirements in reasonable bounds, we scale down R/G/B components to 5/6/4 bits respectively. This produces results that are different from those we'll get with, say, 6/7/6 resolution but its a quite suitable solution, for a quality vs speed choice. I've tried 5/6/5 as well as 6/6/4 and its really hard to say they are better - the results are definitely different but it's hard to say they are really better. <p>
WARNING: If the sum of R+G+B bits exceeds 16, you will a need special case for big endian machines for the INDEX_B macro (see below). With big-endian machines the B component starts at bit 8, thus the right shift counter becomes negative. Probably the best solution is to add an #if B_BIT + 8 - HIST_B_BITS - HIST_G_BITS - HIST_R_BITS &lt; 0.<p>
<b>Quantizing</b><br>
 The following routines can be used to split the quantization process into small steps. First, you should call <a class="el" href="classcsColorQuantizer.html#a99aba3acc8f79e6c867d71d77778f39" title="Begin quantization.">Begin()</a>. This will allocate some memory for color histogram and also do some other maintenance work. Then you call Count () as much times as you want, to count the frequencies of colors. This is a quite fast operation, thus you can use it, for example, to compute a optimal palette for a large number of images (for example, software 3D renderer uses it for computing the optimal palette in paletted modes, by passing every texture to <a class="el" href="classcsColorQuantizer.html#cc124c95457499d948e427b174083323" title="Count the colors in a image and update the color histogram.">Count()</a>). <p>
When you're finished with images, call <a class="el" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7" title="Compute the optimal palette for all images passed to QuantizeCount().">Palette()</a>. This will compute the optimal palette. If you need just that, you can call <a class="el" href="classcsColorQuantizer.html#9174b689fa185583f1bbc4be4d0512f9" title="Finish quantization.">End()</a> and you're done. If you need to remap all those textures to the optimal palette, you can call <a class="el" href="classcsColorQuantizer.html#3a362b950a4f573a8db19a0419f73fd5" title="Remap a image to the palette computed by Palette().">Remap()</a> as much times as you wish. Finally you anyway should call <a class="el" href="classcsColorQuantizer.html#9174b689fa185583f1bbc4be4d0512f9" title="Finish quantization.">End()</a> to free all the memory used by quantizer. <p>
Now, a typical quantization sequence could look like this: <div class="fragment"><pre class="fragment"> <a class="code" href="classcsColorQuantizer.html#a99aba3acc8f79e6c867d71d77778f39" title="Begin quantization.">Begin</a> ();

    <a class="code" href="classcsColorQuantizer.html#cc124c95457499d948e427b174083323" title="Count the colors in a image and update the color histogram.">Count</a> (image, pixels);
   <a class="code" href="classcsColorQuantizer.html#cc124c95457499d948e427b174083323" title="Count the colors in a image and update the color histogram.">Count</a> (...);
   ...

   <span class="keywordtype">int</span> maxcolors = 256;
   <a class="code" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7" title="Compute the optimal palette for all images passed to QuantizeCount().">Palette</a> (outpalette, maxcolors);
   <span class="comment">// now maxcolors contains the actual number of palette entries</span>

   <a class="code" href="classcsColorQuantizer.html#3a362b950a4f573a8db19a0419f73fd5" title="Remap a image to the palette computed by Palette().">Remap</a> (image, pixels, outimage);
   <a class="code" href="classcsColorQuantizer.html#3a362b950a4f573a8db19a0419f73fd5" title="Remap a image to the palette computed by Palette().">Remap</a> (...);
   ...

 <a class="code" href="classcsColorQuantizer.html#9174b689fa185583f1bbc4be4d0512f9" title="Finish quantization.">End</a> ();
</pre></div> The quantizer itself keeps track of its current state, and will silently ignore invalid calls. For example, if you call <a class="el" href="classcsColorQuantizer.html#3a362b950a4f573a8db19a0419f73fd5" title="Remap a image to the palette computed by Palette().">Remap()</a> right after calling <a class="el" href="classcsColorQuantizer.html#a99aba3acc8f79e6c867d71d77778f39" title="Begin quantization.">Begin()</a> nothing will happen. You still can call <a class="el" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7" title="Compute the optimal palette for all images passed to QuantizeCount().">Palette()</a> right after <a class="el" href="classcsColorQuantizer.html#a99aba3acc8f79e6c867d71d77778f39" title="Begin quantization.">Begin()</a>, and you will get the expected black (or let's call it `empty') palette. <p>
The Bias routine can be used to introduce a bias inside the currently open color histogram towards given colors. The "weight" parameter shows how important those colors are (0 - not at all, 100 - very). This can be used to bias the resulting palette towards some hard-coded values, for example you may want to use it to create a relatively uniform palette that is somewhat biased towards the colors contained in some picture(s). <p>
Some routines accept an additional parameter (<a class="el" href="structcsRGBpixel.html" title="An RGB pixel.">csRGBpixel</a> *transp). If it is 0, nothing special is performed. If it is non-0, it should point to an valid <a class="el" href="structcsRGBpixel.html" title="An RGB pixel.">csRGBpixel</a> object; the color of that pixel will be treated in a special way: <a class="el" href="classcsColorQuantizer.html#cc124c95457499d948e427b174083323" title="Count the colors in a image and update the color histogram.">Count()</a> will ignore pixels of that color, <a class="el" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7" title="Compute the optimal palette for all images passed to QuantizeCount().">Palette()</a> will allocate color index 0 for that color, and Remap will map all such pixel values to index 0. 
<p>Definition at line <a class="el" href="quantize_8h-source.html#l00129">129</a> of file <a class="el" href="quantize_8h-source.html">quantize.h</a>.</p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="49d60c8a4d264fd6410499fab38618ec"></a><!-- doxytag: member="csColorQuantizer::csColorQuantizer" ref="49d60c8a4d264fd6410499fab38618ec" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">csColorQuantizer::csColorQuantizer           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Construct a new quantizer object. 
<p>

</div>
</div><p>
<a class="anchor" name="19e4ae4e4f8053ed6bf6fba1995b2d94"></a><!-- doxytag: member="csColorQuantizer::~csColorQuantizer" ref="19e4ae4e4f8053ed6bf6fba1995b2d94" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">csColorQuantizer::~csColorQuantizer           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Destruct and cleanup. 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a99aba3acc8f79e6c867d71d77778f39"></a><!-- doxytag: member="csColorQuantizer::Begin" ref="a99aba3acc8f79e6c867d71d77778f39" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::Begin           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Begin quantization. 
<p>

</div>
</div><p>
<a class="anchor" name="5b129e8522810832a77ae9c415ef76b9"></a><!-- doxytag: member="csColorQuantizer::Bias" ref="5b129e8522810832a77ae9c415ef76b9" args="(csRGBpixel *colors, int count, int weight)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::Bias           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&nbsp;</td>
          <td class="paramname"> <em>colors</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>weight</em></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>
Bias the color histogram towards given colors (weight = 0..100). 
<p>

</div>
</div><p>
<a class="anchor" name="cc124c95457499d948e427b174083323"></a><!-- doxytag: member="csColorQuantizer::Count" ref="cc124c95457499d948e427b174083323" args="(csRGBpixel *image, int pixels, csRGBpixel *transp=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::Count           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&nbsp;</td>
          <td class="paramname"> <em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pixels</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>transp</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>
Count the colors in a image and update the color histogram. 
<p>

</div>
</div><p>
<a class="anchor" name="9749bf308670ef122aa1d9a4ee95c186"></a><!-- doxytag: member="csColorQuantizer::DoRGB" ref="9749bf308670ef122aa1d9a4ee95c186" args="(csRGBpixel *image, int pixels, int pixperline, uint8 *&amp;outimage, csRGBpixel *&amp;outpalette, int &amp;maxcolors, bool dither)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::DoRGB           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&nbsp;</td>
          <td class="paramname"> <em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pixels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pixperline</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>outimage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&amp;&nbsp;</td>
          <td class="paramname"> <em>outpalette</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>maxcolors</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>dither</em></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>
Quantize a RGB image into a paletted image. 
<p>
This is a relatively expensive operation, in both CPU and memory resources terms. It is pretty fast though (more than 3.200.000 pixels/sec on a relatively weak P5/166) for what it does. It uses a variation of well-known Heckbert quantization algorithm. The side bonus after quantization is that the palette is ordered in most-used-first fashion. If outimage is 0, it is allocated. If outpalette is 0, it is allocated as well. If it is non-0, the routine supposes that the storage the pointers point to has enough size to store resulting image and palette (the size of resulting image is exactly "pixels" bytes, the size of resulting palette is palsize colors). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>image</em>&nbsp;</td><td>input image </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pixels</em>&nbsp;</td><td>number of pixels in input image </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>pixperline</em>&nbsp;</td><td>number of pixels in one line </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>outimage</em>&nbsp;</td><td>output image (allocated if 0) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>outpalette</em>&nbsp;</td><td>output palette (allocated if 0) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>maxcolors</em>&nbsp;</td><td>maximal number of colors in output palette (actual number of colors on return) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>dither</em>&nbsp;</td><td>Use/do not use Floyd-Steinberg dithering </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="9174b689fa185583f1bbc4be4d0512f9"></a><!-- doxytag: member="csColorQuantizer::End" ref="9174b689fa185583f1bbc4be4d0512f9" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::End           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Finish quantization. 
<p>

</div>
</div><p>
<a class="anchor" name="44e180da2038e1116c5022a59f5faed7"></a><!-- doxytag: member="csColorQuantizer::Palette" ref="44e180da2038e1116c5022a59f5faed7" args="(csRGBpixel *&amp;outpalette, int &amp;maxcolors, csRGBpixel *transp=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::Palette           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&amp;&nbsp;</td>
          <td class="paramname"> <em>outpalette</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>maxcolors</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>transp</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 the optimal palette for all images passed to QuantizeCount(). 
<p>

</div>
</div><p>
<a class="anchor" name="3a362b950a4f573a8db19a0419f73fd5"></a><!-- doxytag: member="csColorQuantizer::Remap" ref="3a362b950a4f573a8db19a0419f73fd5" args="(csRGBpixel *image, int pixels, uint8 *&amp;outimage, csRGBpixel *transp=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::Remap           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&nbsp;</td>
          <td class="paramname"> <em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pixels</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>outimage</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>transp</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>
Remap a image to the palette computed by <a class="el" href="classcsColorQuantizer.html#44e180da2038e1116c5022a59f5faed7" title="Compute the optimal palette for all images passed to QuantizeCount().">Palette()</a>. 
<p>

</div>
</div><p>
<a class="anchor" name="31300ceea4f021472f9209c4d75ea42b"></a><!-- doxytag: member="csColorQuantizer::RemapDither" ref="31300ceea4f021472f9209c4d75ea42b" args="(csRGBpixel *image, int pixels, int pixperline, csRGBpixel *palette, int colors, uint8 *&amp;outimage, csRGBpixel *transp=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void csColorQuantizer::RemapDither           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *&nbsp;</td>
          <td class="paramname"> <em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pixels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pixperline</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>palette</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></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="group__util.html#gdde6aaee8457bee49c2a92621fe22b79">uint8</a> *&amp;&nbsp;</td>
          <td class="paramname"> <em>outimage</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>transp</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>
Same but apply Floyd-Steinberg dithering for nicer (but slower) results. 
<p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>csgfx/<a class="el" href="quantize_8h-source.html">quantize.h</a></ul>
<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>