<!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: csGradient 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 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 Pages</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="classes.html"><span>Alphabetical List</span></a></li> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <h1>csGradient Class Reference</h1><!-- doxytag: class="csGradient" --><!-- doxytag: inherits="scfImplementation1< csGradient, iGradient >" -->A simple color gradient. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="csgfx_2gradient_8h-source.html">csgfx/gradient.h</a>></code> <p> <div class="dynheader"> Inheritance diagram for csGradient:</div> <div class="dynsection"> <p><center><img src="classcsGradient__inherit__graph.png" border="0" usemap="#csGradient__inherit__map" alt="Inheritance graph"></center> <map name="csGradient__inherit__map"> <area shape="rect" href="classscfImplementation1.html" title="scfImplementation1\< csGradient, iGradient \>" alt="" coords="60,161,375,188"><area shape="rect" href="classscfImplementation.html" title="scfImplementation\< csGradient \>" alt="" coords="5,84,245,111"><area shape="rect" href="structiBase.html" title="This is the basic interface: all other interfaces should be derived from this one..." alt="" coords="271,7,327,33"><area shape="rect" href="structiGradient.html" title="A simple color gradient." alt="" coords="269,84,349,111"><area shape="rect" href="classCS_1_1Memory_1_1CustomAllocated.html" title="Class that overrides operator new/operator delete/etc." alt="" coords="15,7,236,33"></map> <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div> <p> <a href="classcsGradient-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 </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#7ccf78e9977a3460a2aba5f0f5631d3a">Clear</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Clear all shades. <a href="#7ccf78e9977a3460a2aba5f0f5631d3a"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#bb935eb0f035c8a906385c7612d33045">csGradient</a> (<a class="el" href="classcsColor4.html">csColor4</a> first, <a class="el" href="classcsColor4.html">csColor4</a> last)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct with <code>first</code> at position 0 and <code>last</code> at 1. <a href="#bb935eb0f035c8a906385c7612d33045"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#b317a3c05904c6dbedd83aeec55f4119">csGradient</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct an empty gradient. <a href="#b317a3c05904c6dbedd83aeec55f4119"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classcsPtr.html">csPtr</a>< <a class="el" href="structiGradientShades.html">iGradientShades</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#ed114a61ae277e86d93813e4698f22fb">GetShades</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the array of shades. <a href="#ed114a61ae277e86d93813e4698f22fb"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#9dfda0a87635f1cb1fbab56ff3b34af0">Render</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *pal, size_t count, float begin=0.0f, float end=1.0f) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolate the colors over a part of the gradient. <a href="#9dfda0a87635f1cb1fbab56ff3b34af0"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#cddbdec6030114e4e41919869ccd577f">Render</a> (<a class="el" href="structcsRGBcolor.html">csRGBcolor</a> *pal, size_t count, float begin=0.0f, float end=1.0f) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolate the colors over a part of the gradient. <a href="#cddbdec6030114e4e41919869ccd577f"></a><br></td></tr> <tr><td colspan="2"><div class="groupHeader"></div></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#5c509313a7c2efe2e3729e4d1bd144f5">AddShade</a> (const <a class="el" href="structcsGradientShade.html">csGradientShade</a> &shade)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Add a shade. <a href="#5c509313a7c2efe2e3729e4d1bd144f5"></a><br></td></tr> <tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classcsArray.html">csArray</a><br> < <a class="el" href="structcsGradientShade.html">csGradientShade</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classcsGradient.html#ea586d1f88b32ca13c608a5ee85c712f">shades</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">The entries in this gradient. <a href="#ea586d1f88b32ca13c608a5ee85c712f"></a><br></td></tr> <tr><td colspan="2"><br><h2>Classes</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structcsGradient_1_1scfGradientShadesArray.html">scfGradientShadesArray</a></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> A simple color gradient. <p> If you ever have worked with an image creation/manipulation program with a slightly higher niveau than Windows Paint then you probably know what this is.<p> Colors(here called 'shades') can be placed at arbitrary positions; although commonly a range of [0;1] is used, negative positions and positions larger than 1 are supported.<p> Shades contain actually two colors, a 'left' and 'right' one. You can think of this as, when approaching from one side, you'll get closer and closer to the respective color. If you step over a shade, you have the other color, but you're getting farther and farther from it (and towards the next color) when moving on. This feature can be used for sharp transitions; for smooth ones they are simply set to the same value.<p> For some examples see the <a class="el" href="structiGradient.html" title="A simple color gradient.">iGradient</a> documentation. <p>Definition at line <a class="el" href="csgfx_2gradient_8h-source.html#l00057">57</a> of file <a class="el" href="csgfx_2gradient_8h-source.html">gradient.h</a>.</p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="b317a3c05904c6dbedd83aeec55f4119"></a><!-- doxytag: member="csGradient::csGradient" ref="b317a3c05904c6dbedd83aeec55f4119" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">csGradient::csGradient </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Construct an empty gradient. <p> </div> </div><p> <a class="anchor" name="bb935eb0f035c8a906385c7612d33045"></a><!-- doxytag: member="csGradient::csGradient" ref="bb935eb0f035c8a906385c7612d33045" args="(csColor4 first, csColor4 last)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">csGradient::csGradient </td> <td>(</td> <td class="paramtype"><a class="el" href="classcsColor4.html">csColor4</a> </td> <td class="paramname"> <em>first</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classcsColor4.html">csColor4</a> </td> <td class="paramname"> <em>last</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Construct with <code>first</code> at position 0 and <code>last</code> at 1. <p> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="5c509313a7c2efe2e3729e4d1bd144f5"></a><!-- doxytag: member="csGradient::AddShade" ref="5c509313a7c2efe2e3729e4d1bd144f5" args="(const csGradientShade &shade)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void csGradient::AddShade </td> <td>(</td> <td class="paramtype">const <a class="el" href="structcsGradientShade.html">csGradientShade</a> & </td> <td class="paramname"> <em>shade</em> </td> <td> ) </td> <td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Add a shade. <p> Add a shade <p>Implements <a class="el" href="structiGradient.html#bafb739cac7eaf209c1a78ae5c62247b">iGradient</a>.</p> </div> </div><p> <a class="anchor" name="7ccf78e9977a3460a2aba5f0f5631d3a"></a><!-- doxytag: member="csGradient::Clear" ref="7ccf78e9977a3460a2aba5f0f5631d3a" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void csGradient::Clear </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Clear all shades. <p> <p>Implements <a class="el" href="structiGradient.html#9b881571bc707e5cd4f57d2f18d72880">iGradient</a>.</p> </div> </div><p> <a class="anchor" name="ed114a61ae277e86d93813e4698f22fb"></a><!-- doxytag: member="csGradient::GetShades" ref="ed114a61ae277e86d93813e4698f22fb" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classcsPtr.html">csPtr</a><<a class="el" href="structiGradientShades.html">iGradientShades</a>> csGradient::GetShades </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Get the array of shades. <p> <p>Implements <a class="el" href="structiGradient.html#ce86492d535820fadca55ceed2763cce">iGradient</a>.</p> </div> </div><p> <a class="anchor" name="9dfda0a87635f1cb1fbab56ff3b34af0"></a><!-- doxytag: member="csGradient::Render" ref="9dfda0a87635f1cb1fbab56ff3b34af0" args="(csRGBpixel *pal, size_t count, float begin=0.0f, float end=1.0f) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool csGradient::Render </td> <td>(</td> <td class="paramtype"><a class="el" href="structcsRGBpixel.html">csRGBpixel</a> * </td> <td class="paramname"> <em>pal</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>count</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float </td> <td class="paramname"> <em>begin</em> = <code>0.0f</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float </td> <td class="paramname"> <em>end</em> = <code>1.0f</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Interpolate the colors over a part of the gradient. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pal</em> </td><td>Array of <a class="el" href="structcsRGBpixel.html" title="An RGB pixel.">csRGBpixel</a> the gradient should be rendered to. </td></tr> <tr><td valign="top"></td><td valign="top"><em>count</em> </td><td>Number of <code>palette</code> entries to render. </td></tr> <tr><td valign="top"></td><td valign="top"><em>begin</em> </td><td>Start position. Can be anywhere in the gradient. </td></tr> <tr><td valign="top"></td><td valign="top"><em>end</em> </td><td>End position. Can be anywhere in the gradient.</td></tr> </table> </dl> <dl class="remark" compact><dt><b>Remarks:</b></dt><dd>At least 1 shade has to be present in the gradient to have this function succeed. <p> Makes heavy use of floating point calculations, so you might want to use this function in a precalc phase. <p> <code>begin</code> doesn't have to be smaller than <code>end</code>. <p> <code>begin</code> and <code>end</code> can both lie completely 'outside' the gradient (i.e. both smaller/large than the first resp. last shade's position.) </dd></dl> <p>Implements <a class="el" href="structiGradient.html#530367f8b90fae83bdda036474c17c54">iGradient</a>.</p> </div> </div><p> <a class="anchor" name="cddbdec6030114e4e41919869ccd577f"></a><!-- doxytag: member="csGradient::Render" ref="cddbdec6030114e4e41919869ccd577f" args="(csRGBcolor *pal, size_t count, float begin=0.0f, float end=1.0f) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool csGradient::Render </td> <td>(</td> <td class="paramtype"><a class="el" href="structcsRGBcolor.html">csRGBcolor</a> * </td> <td class="paramname"> <em>pal</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>count</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float </td> <td class="paramname"> <em>begin</em> = <code>0.0f</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float </td> <td class="paramname"> <em>end</em> = <code>1.0f</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Interpolate the colors over a part of the gradient. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pal</em> </td><td>Array of <a class="el" href="structcsRGBcolor.html" title="An RGB color.">csRGBcolor</a> the gradient should be rendered to. </td></tr> <tr><td valign="top"></td><td valign="top"><em>count</em> </td><td>Number of <code>palette</code> entries to render. </td></tr> <tr><td valign="top"></td><td valign="top"><em>begin</em> </td><td>Start position. Can be anywhere in the gradient. </td></tr> <tr><td valign="top"></td><td valign="top"><em>end</em> </td><td>End position. Can be anywhere in the gradient.</td></tr> </table> </dl> <dl class="remark" compact><dt><b>Remarks:</b></dt><dd>At least 1 shade has to be present in the gradient to have this function succeed. <p> Makes heavy use of floating point calculations, so you might want to use this function in a precalc phase. <p> <code>begin</code> doesn't have to be smaller than <code>end</code>. <p> <code>begin</code> and <code>end</code> can both lie completely 'outside' the gradient (i.e. both smaller/large than the first resp. last shade's position.) </dd></dl> <p>Implements <a class="el" href="structiGradient.html#8ebb11c93c33f6ff51d5f50109559903">iGradient</a>.</p> </div> </div><p> <hr><h2>Member Data Documentation</h2> <a class="anchor" name="ea586d1f88b32ca13c608a5ee85c712f"></a><!-- doxytag: member="csGradient::shades" ref="ea586d1f88b32ca13c608a5ee85c712f" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classcsArray.html">csArray</a><<a class="el" href="structcsGradientShade.html">csGradientShade</a>> <a class="el" href="classcsGradient.html#ea586d1f88b32ca13c608a5ee85c712f">csGradient::shades</a><code> [protected]</code> </td> </tr> </table> </div> <div class="memdoc"> <p> The entries in this gradient. <p> <p>Definition at line <a class="el" href="csgfx_2gradient_8h-source.html#l00062">62</a> of file <a class="el" href="csgfx_2gradient_8h-source.html">gradient.h</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following file:<ul> <li>csgfx/<a class="el" href="csgfx_2gradient_8h-source.html">gradient.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>