<!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: iGradient Struct 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>iGradient Struct Reference</h1><!-- doxytag: class="iGradient" --><!-- doxytag: inherits="iBase" -->A simple color gradient. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="ivaria_2gradient_8h-source.html">ivaria/gradient.h</a>></code> <p> <div class="dynheader"> Inheritance diagram for iGradient:</div> <div class="dynsection"> <p><center><img src="structiGradient__inherit__graph.png" border="0" usemap="#iGradient__inherit__map" alt="Inheritance graph"></center> <map name="iGradient__inherit__map"> <area shape="rect" href="classscfImplementation1.html" title="scfImplementation1\< csGradient, iGradient \>" alt="" coords="5,161,320,188"><area shape="rect" href="structiBase.html" title="This is the basic interface: all other interfaces should be derived from this one..." alt="" coords="135,7,191,33"><area shape="rect" href="classcsGradient.html" title="A simple color gradient." alt="" coords="117,239,208,265"></map> <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div> <p> <a href="structiGradient-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">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="structiGradient.html#9b881571bc707e5cd4f57d2f18d72880">Clear</a> ()=0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Clear all shades. <a href="#9b881571bc707e5cd4f57d2f18d72880"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classcsPtr.html">csPtr</a><br> < <a class="el" href="structiGradientShades.html">iGradientShades</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="structiGradient.html#ce86492d535820fadca55ceed2763cce">GetShades</a> ()=0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the array of shades. <a href="#ce86492d535820fadca55ceed2763cce"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="structiGradient.html#530367f8b90fae83bdda036474c17c54">Render</a> (<a class="el" href="structcsRGBpixel.html">csRGBpixel</a> *pal, size_t count, float begin=0.0f, float end=1.0f) const =0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolate the colors over a part of the gradient. <a href="#530367f8b90fae83bdda036474c17c54"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="structiGradient.html#8ebb11c93c33f6ff51d5f50109559903">Render</a> (<a class="el" href="structcsRGBcolor.html">csRGBcolor</a> *pal, size_t count, float begin=0.0f, float end=1.0f) const =0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolate the colors over a part of the gradient. <a href="#8ebb11c93c33f6ff51d5f50109559903"></a><br></td></tr> <tr><td colspan="2"><div class="groupHeader"></div></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="structiGradient.html#bafb739cac7eaf209c1a78ae5c62247b">AddShade</a> (const <a class="el" href="structcsGradientShade.html">csGradientShade</a> &shade)=0</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Add a shade. <a href="#bafb739cac7eaf209c1a78ae5c62247b"></a><br></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> This interface is implemented by <a class="el" href="classcsGradient.html" title="A simple color gradient.">csGradient</a>.<p> Examples: <div class="fragment"><pre class="fragment"> <a class="code" href="classcsRef.html" title="A smart pointer.">csRef<iGradient></a> grad; <span class="comment">// Rainbow-ish</span> grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 0.0f, 0.0f, 1.0f), 0.0f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 1.0f, 0.0f, 1.0f), 0.2f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (0.0f, 1.0f, 0.0f, 1.0f), 0.4f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (0.0f, 1.0f, 1.0f, 1.0f), 0.6f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (0.0f, 0.0f, 1.0f, 1.0f), 0.8f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 0.0f, 1.0f, 1.0f), 1.0f); <span class="comment">// German flag</span> grad->Clear (); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (0.0f, 0.0f, 0.0f, 1.0f), 0.0f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (0.0f, 0.0f, 0.0f, 1.0f), <a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 0.0f, 0.0f, 1.0f), 0.33f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 0.0f, 0.0f, 1.0f), <a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 1.0f, 0.0f, 1.0f), 0.66f); grad->AddShade (<a class="code" href="classcsColor4.html" title="A class used to represent a color in RGBA space.">csColor4</a> (1.0f, 1.0f, 0.0f, 1.0f), 1.0f); </pre></div> <dl compact><dt><b><a class="el" href="todo.html#_todo000036">Todo:</a></b></dt><dd>More shade management (e.g. getting, deleting of single shades.) </dd></dl> <p>Definition at line <a class="el" href="ivaria_2gradient_8h-source.html#l00127">127</a> of file <a class="el" href="ivaria_2gradient_8h-source.html">gradient.h</a>.</p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="bafb739cac7eaf209c1a78ae5c62247b"></a><!-- doxytag: member="iGradient::AddShade" ref="bafb739cac7eaf209c1a78ae5c62247b" args="(const csGradientShade &shade)=0" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void iGradient::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> [pure virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Add a shade. <p> <p>Implemented in <a class="el" href="classcsGradient.html#5c509313a7c2efe2e3729e4d1bd144f5">csGradient</a>.</p> </div> </div><p> <a class="anchor" name="9b881571bc707e5cd4f57d2f18d72880"></a><!-- doxytag: member="iGradient::Clear" ref="9b881571bc707e5cd4f57d2f18d72880" args="()=0" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void iGradient::Clear </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [pure virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Clear all shades. <p> <p>Implemented in <a class="el" href="classcsGradient.html#7ccf78e9977a3460a2aba5f0f5631d3a">csGradient</a>.</p> </div> </div><p> <a class="anchor" name="ce86492d535820fadca55ceed2763cce"></a><!-- doxytag: member="iGradient::GetShades" ref="ce86492d535820fadca55ceed2763cce" args="()=0" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="classcsPtr.html">csPtr</a><<a class="el" href="structiGradientShades.html">iGradientShades</a>> iGradient::GetShades </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [pure virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Get the array of shades. <p> <p>Implemented in <a class="el" href="classcsGradient.html#ed114a61ae277e86d93813e4698f22fb">csGradient</a>.</p> </div> </div><p> <a class="anchor" name="530367f8b90fae83bdda036474c17c54"></a><!-- doxytag: member="iGradient::Render" ref="530367f8b90fae83bdda036474c17c54" args="(csRGBpixel *pal, size_t count, float begin=0.0f, float end=1.0f) const =0" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual bool iGradient::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> [pure 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>Implemented in <a class="el" href="classcsGradient.html#9dfda0a87635f1cb1fbab56ff3b34af0">csGradient</a>.</p> </div> </div><p> <a class="anchor" name="8ebb11c93c33f6ff51d5f50109559903"></a><!-- doxytag: member="iGradient::Render" ref="8ebb11c93c33f6ff51d5f50109559903" args="(csRGBcolor *pal, size_t count, float begin=0.0f, float end=1.0f) const =0" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual bool iGradient::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> [pure 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>Implemented in <a class="el" href="classcsGradient.html#cddbdec6030114e4e41919869ccd577f">csGradient</a>.</p> </div> </div><p> <hr>The documentation for this struct was generated from the following file:<ul> <li>ivaria/<a class="el" href="ivaria_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>