diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02513.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02513.html | 994 |
1 files changed, 994 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02513.html b/docs/doxygen/nel/a02513.html new file mode 100644 index 00000000..fdf57186 --- /dev/null +++ b/docs/doxygen/nel/a02513.html @@ -0,0 +1,994 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NL3D::CFastHLSModifier class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CFastHLSModifier Class Reference</h1><code>#include <<a class="el" href="a05707.html">fasthls_modifier.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Singleton. allow to apply HLS coloring as fast as possible (MMX...). <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05707.html#l00049">49</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</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><a class="el" href="a04558.html#a9">uint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a> (<a class="el" href="a04558.html#a9">uint16</a> colorIn, <a class="el" href="a04558.html#a7">uint8</a> dHue, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera1">convert</a> (<a class="el" href="a04558.html#a15">uint</a> H, <a class="el" href="a04558.html#a15">uint</a> L, <a class="el" href="a04558.html#a15">uint</a> S)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">convert a HLS (0..255) to a RGBA. <a href="#NL3D_1_1CFastHLSModifiera1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera2">convertDDSBitmap</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a14">sint</a> dl, <a class="el" href="a04558.html#a14">sint</a> ds)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">convert a DDS bitmap into another DDS, with HLS decal (0..255, -255..+255, -255..+255). <a href="#NL3D_1_1CFastHLSModifiera2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera3">convertRGBABitmap</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a14">sint</a> dl, <a class="el" href="a04558.html#a14">sint</a> ds)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255). <a href="#NL3D_1_1CFastHLSModifiera3"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02513.html">CFastHLSModifier</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiere0">getInstance</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">get the singleton <a href="#NL3D_1_1CFastHLSModifiere0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a> = 256 + }</td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierd0">CFastHLSModifier</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CFastHLSModifierd0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierd1">convertDDSBitmapDXTC1Or1A</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierd2">convertDDSBitmapDXTC3Or5</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02514.html">CHLSA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a> [65536]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr1">_HueTable</a> [HueTableSize]</td></tr> + +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02513.html">CFastHLSModifier</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a> = NULL</td></tr> + +</table> +<hr><h2>Member Enumeration Documentation</h2> +<a class="anchor" name="NL3D_1_1CFastHLSModifiery0" doxytag="NL3D::CFastHLSModifier::@11" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> anonymous enum<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +<dl compact><dt><b>Enumeration values: </b></dt><dd> +<table border=0 cellspacing=2 cellpadding=0> +<tr><td valign=top><em><a class="anchor" name="NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1" doxytag="HueTableSize" ></a>HueTableSize</em> </td><td> +</td></tr> +</table> +</dl> + +<p> +Definition at line <a class="el" href="a05707.html#l00078">78</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>. +<p> +<div class="fragment"><pre>00078 {<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a>= 256}; +</pre></div> </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CFastHLSModifierd0" doxytag="NL3D::CFastHLSModifier::CFastHLSModifier" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NL3D::CFastHLSModifier::CFastHLSModifier </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00047">47</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05707.html#l00085">_Color16ToHLS</a>, <a class="el" href="a05707.html#l00084">_HueTable</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::A</a>, <a class="el" href="a06339.html#l00686">NLMISC::CRGBA::buildFromHLS()</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06339.html#l00609">NLMISC::CRGBA::convertToHLS()</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::H</a>, <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::L</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::S</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06340.html#l00162">NLMISC::CRGBA::set565()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00048 { +00049 <a class="code" href="a04558.html#a15">uint</a> i; +00050 <span class="comment">// build the HueTable.</span> +00051 <span class="keywordflow">for</span>(i=0;i<<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a>;i++) +00052 { +00053 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr1">_HueTable</a>[i].<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2026_0">buildFromHLS</a>(360.0f*i/HueTableSize, 0.5f, 1); +00054 } +00055 <span class="comment">// build conversion from uint16 to HLS.</span> +00056 <span class="keywordflow">for</span>(i=0;i<65536;i++) +00057 { +00058 <a class="code" href="a03337.html">CRGBA</a> col; +00059 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAa15">set565</a>(i); +00060 <span class="keywordtype">float</span> h,<a class="code" href="a05373.html#a2">l</a>,<a class="code" href="a04223.html#a626">s</a>; +00061 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2026_1">convertToHLS</a>(h,l,s); +00062 h= (<span class="keywordtype">float</span>)floor(255*(h/360.f)+0.5f); +00063 <a class="code" href="a05373.html#a2">l</a>= (<span class="keywordtype">float</span>)floor(255*l+0.5f); +00064 <a class="code" href="a04223.html#a626">s</a>= (<span class="keywordtype">float</span>)floor(255*s+0.5f); +00065 <a class="code" href="a05378.html#a374">clamp</a>(h,0,255); +00066 <a class="code" href="a05378.html#a374">clamp</a>(l,0,255); +00067 <a class="code" href="a05378.html#a374">clamp</a>(s,0,255); +00068 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo1">H</a>= (<a class="code" href="a04558.html#a7">uint8</a>)h; +00069 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo2">L</a>= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05373.html#a2">l</a>; +00070 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo3">S</a>= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a04223.html#a626">s</a>; +00071 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo0">A</a>= 255; +00072 } +00073 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CFastHLSModifiera0" doxytag="NL3D::CFastHLSModifier::applyHLSMod" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> NL3D::CFastHLSModifier::applyHLSMod </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>colorIn</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>dHue</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>dLum</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>dSat</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +convert a uint16 color into the uint16 with HLS decal. WARNING: this code use MMX when possible, but doesn't call emms!!! It is User job to do it. dLum must be actually 0xFFFFFF00 + realDLum (where realDLum== -255..+255) dSat must be actually 0xFFFFFF00 + realDSat (where realDSat== -255..+255) +<p> +Definition at line <a class="el" href="a05706.html#l00110">110</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05707.html#l00085">_Color16ToHLS</a>, <a class="el" href="a05706.html#l00086">convert()</a>, <a class="el" href="a06340.html#l00154">NLMISC::CRGBA::get565()</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::H</a>, <a class="el" href="a06590.html#l00245">INT64_CONSTANT</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::L</a>, <a class="el" href="a05646.html#l00645">offset</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::S</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l00237">v</a>. +<p> +Referenced by <a class="el" href="a05790.html#l00545">NL3D::CHLSColorTexture::colorizeDXTCBlockRGB()</a>, <a class="el" href="a05706.html#l00252">convertDDSBitmapDXTC1Or1A()</a>, and <a class="el" href="a05706.html#l00354">convertDDSBitmapDXTC3Or5()</a>. +<p> +<div class="fragment"><pre>00111 { +00112 <span class="keyword">static</span> <a class="code" href="a04558.html#a13">uint64</a> mmBlank = 0; +00113 <span class="keyword">static</span> <a class="code" href="a04558.html#a13">uint64</a> mmOne = <a class="code" href="a05167.html#a5">INT64_CONSTANT</a>(0x00FF00FF00FF00FF); +00114 <span class="keyword">static</span> <a class="code" href="a04558.html#a13">uint64</a> mmGray = <a class="code" href="a05167.html#a5">INT64_CONSTANT</a>(0x0080008000800080); +00115 <span class="keyword">static</span> <a class="code" href="a04558.html#a13">uint64</a> mmInterpBufer[4]= {0,0,0,<a class="code" href="a05167.html#a5">INT64_CONSTANT</a>(0x00FF00FF00FF00FF)}; +00116 +00117 <span class="comment">/*</span> +00118 <span class="comment"> dLum is actually 0xFFFFFF00 + realDLum</span> +00119 <span class="comment"> dSat is actually 0xFFFFFF00 + realDSat</span> +00120 <span class="comment"> */</span> +00121 +00122 <a class="code" href="a04558.html#a9">uint16</a> retVal; +00123 +00124 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00125 <span class="preprocessor"></span> <span class="keywordflow">if</span>(CSystemInfo::hasMMX()) +00126 { +00127 __asm +00128 { +00129 mov edi, <a class="code" href="a04223.html#a586">offset</a> mmInterpBufer +00130 mov ecx, <span class="keyword">this</span> +00131 +00132 <span class="comment">// get HLS in edx.</span> +00133 mov eax, 0 +00134 mov ebx, 0 +00135 lea esi, [ecx]<span class="keyword">this</span>._Color16ToHLS +00136 mov ax, colorIn +00137 mov edx, [esi+ eax*4] +00138 +00139 <span class="comment">// apply dh to H (ie dl!). Auto-wrap.</span> +00140 add dl, dHue +00141 <span class="comment">// get the color into mm0</span> +00142 mov bl, dl +00143 lea esi, [ecx]<span class="keyword">this</span>._HueTable +00144 movd mm0, [esi+ ebx*4] +00145 punpcklbw mm0, mmBlank +00146 +00147 <span class="comment">// get L into eax and S into ebx</span> +00148 mov eax, edx +00149 mov ebx, edx +00150 shr eax, 8 +00151 shr ebx, 16 +00152 and eax, 255 +00153 and ebx, 255 +00154 <span class="comment">// add dLum/dSat and clamp to 1.</span> +00155 add eax, dLum +00156 sbb ecx, ecx <span class="comment">// ecx= FFFFFFFF if carry.</span> +00157 add ebx, dSat +00158 sbb edx, edx +00159 or eax, ecx <span class="comment">// eax= FFFFFFFF if carry was set</span> +00160 or ebx, edx +00161 <span class="comment">// add Magic delta, and clamp to 0.</span> +00162 add eax, 256 +00163 sbb ecx, ecx <span class="comment">// ecx= 0 if carry not set => result below 0.</span> +00164 add ebx, 256 +00165 sbb edx, edx +00166 and eax, ecx <span class="comment">// eax= 0 if result was below 0</span> +00167 and ebx, edx +00168 +00169 <span class="comment">// Load Sat/(1-Sat) into MMX</span> +00170 movd mm2, ebx +00171 movq mm3, mmOne +00172 punpckldq mm2, mm2 <span class="comment">// mm2= 0000 00AA 0000 00AA</span> +00173 packssdw mm2, mm2 <span class="comment">// mm2= 00AA 00AA 00AA 00AA</span> +00174 movq mm1, mmGray +00175 psubusw mm3, mm2 <span class="comment">// mm3= 1-sat.</span> +00176 <span class="comment">// combine Color and Sat</span> +00177 pmullw mm0, mm2 <span class="comment">// mm0= color*sat</span> +00178 pmullw mm1, mm3 <span class="comment">// mm1= gray*(1-sat)</span> +00179 paddusw mm0, mm1 <span class="comment">// mm0= color saturated</span> +00180 <span class="comment">// shift and store into the buffer for Luminance interpolation</span> +00181 psrlw mm0, 8 +00182 movq [edi+ 8], mm0 +00183 movq [edi+ 16], mm0 +00184 +00185 <span class="comment">// use edx as index for luminance: 0: L=0 to 127. 1: L=128 to 255.</span> +00186 mov edx, eax +00187 shl eax, 1 +00188 shr edx, 7 +00189 and eax, 255 <span class="comment">// 0-127 and 128-255 transform auto to 0-254</span> +00190 <span class="comment">// expand 0-254 to 0-255</span> +00191 mov ecx, eax +00192 shl edx, 4 +00193 shr ecx, 7 +00194 add eax, ecx +00195 +00196 <span class="comment">// Combine color and Luminance into MMX. interpolate 0->col or col->white according to edx.</span> +00197 <span class="comment">// Load Lum/(1-Lum) into MMX</span> +00198 movd mm2, eax +00199 movq mm3, mmOne +00200 punpckldq mm2, mm2 <span class="comment">// mm2= 0000 00AA 0000 00AA</span> +00201 packssdw mm2, mm2 <span class="comment">// mm2= 00AA 00AA 00AA 00AA</span> +00202 psubusw mm3, mm2 <span class="comment">// mm3= 1-lum.</span> +00203 <span class="comment">// Combine color and Sat into MMX</span> +00204 movq mm0, [edi+ edx] +00205 movq mm1, [edi+ edx + 8] +00206 pmullw mm0, mm3 <span class="comment">// mm0= color0*(1-lum)</span> +00207 pmullw mm1, mm2 <span class="comment">// mm1= color1*lum</span> +00208 paddusw mm0, mm1 <span class="comment">// mm0= final color</span> +00209 +00210 <span class="comment">// shift and unpack</span> +00211 psrlw mm0, 8 +00212 packuswb mm0, mm0 +00213 movd eax, mm0 +00214 +00215 <span class="comment">// pack to 16bits.</span> +00216 mov ebx, eax +00217 mov ecx, eax +00218 shl eax, 8 <span class="comment">// Red</span> +00219 shr ebx, 5 <span class="comment">// Green</span> +00220 shr ecx, 19 <span class="comment">// Blue</span> +00221 and eax, 0xF800 +00222 and ebx, 0x07E0 +00223 and ecx, 0x001F +00224 or eax, ebx +00225 or eax, ecx +00226 +00227 mov retVal, ax +00228 } +00229 } +00230 <span class="keywordflow">else</span> +00231 <span class="preprocessor">#endif // NL_OS_WINDOWS</span> +00232 <span class="preprocessor"></span> { +00233 CHLSA hls= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[colorIn]; +00234 <span class="comment">// apply (C version) Dhue, dLum and dSat</span> +00235 hls.<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo1">H</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(hls.H + dHue); +00236 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a576">v</a>= (<a class="code" href="a04558.html#a14">sint</a>)hls.L + (<a class="code" href="a04558.html#a14">sint</a>)(dLum-0xFFFFFF00); +00237 fastClamp8(v); +00238 hls.L= <a class="code" href="a04223.html#a576">v</a>; +00239 <a class="code" href="a04223.html#a576">v</a>= (<a class="code" href="a04558.html#a14">sint</a>)hls.S + (<a class="code" href="a04558.html#a14">sint</a>)(dSat-0xFFFFFF00); +00240 fastClamp8(v); +00241 hls.S= <a class="code" href="a04223.html#a576">v</a>; +00242 +00243 <a class="code" href="a03337.html">CRGBA</a> ret= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera1">convert</a>(hls.H, hls.L, hls.S); +00244 retVal= ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAa6">get565</a>(); +00245 } +00246 +00247 <span class="keywordflow">return</span> retVal; +00248 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifiera1" doxytag="NL3D::CFastHLSModifier::convert" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NL3D::CFastHLSModifier::convert </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>H</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>L</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>S</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +convert a HLS (0..255) to a RGBA. +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00086">86</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05707.html#l00084">_HueTable</a>, <a class="el" href="a06340.html#l00227">NLMISC::CRGBA::blendFromuiRGBOnly()</a>, <a class="el" href="a06340.html#l00236">NLMISC::CRGBA::modulateFromuiRGBOnly()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, and <a class="el" href="a05706.html#l00414">convertRGBABitmap()</a>. +<p> +<div class="fragment"><pre>00087 { +00088 <span class="keyword">static</span> <a class="code" href="a03337.html">CRGBA</a> gray(128,128,128); +00089 L+= L>>7; +00090 S+= S>>7; +00091 <span class="comment">// H.</span> +00092 <a class="code" href="a03337.html">CRGBA</a> col= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr1">_HueTable</a>[H]; +00093 <span class="comment">// S.</span> +00094 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_3">blendFromuiRGBOnly</a>(gray, col, S); +00095 <span class="comment">// L.</span> +00096 <span class="keywordflow">if</span>(L<=128) +00097 { +00098 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_5">modulateFromuiRGBOnly</a>(col, L*2); +00099 } +00100 <span class="keywordflow">else</span> +00101 { +00102 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_3">blendFromuiRGBOnly</a>(col, CRGBA::White, (L-128)*2 ); +00103 } +00104 +00105 <span class="keywordflow">return</span> col; +00106 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifiera2" doxytag="NL3D::CFastHLSModifier::convertDDSBitmap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertDDSBitmap </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>dst</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>src</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>dh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>dl</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>ds</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +convert a DDS bitmap into another DDS, with HLS decal (0..255, -255..+255, -255..+255). +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00393">393</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05706.html#l00252">convertDDSBitmapDXTC1Or1A()</a>, <a class="el" href="a05706.html#l00354">convertDDSBitmapDXTC3Or5()</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a05487.html#l00335">NLMISC::CBitmap::getPixelFormat()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00394 { +00395 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat</a>()); +00396 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getWidth()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>() && <a class="code" href="a04223.html#a652">src</a>.getHeight()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>()); +00397 +00398 <span class="comment">// Magic add clamp.</span> +00399 <a class="code" href="a04558.html#a15">uint</a> dLum= 0xFFFFFF00 + dl; +00400 <a class="code" href="a04558.html#a15">uint</a> dSat= 0xFFFFFF00 + ds; +00401 +00402 <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC1 || <a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC1Alpha) +00403 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierd1">convertDDSBitmapDXTC1Or1A</a>(dst, src, dh, dLum, dSat); +00404 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC3 || <a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC5) +00405 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierd2">convertDDSBitmapDXTC3Or5</a>(dst, src, dh, dLum, dSat); +00406 <span class="keywordflow">else</span> +00407 { +00408 <a class="code" href="a04199.html#a12">nlstop</a>; +00409 } +00410 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifierd1" doxytag="NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>dst</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>src</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>dh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>dLum</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>dSat</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00252">252</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00393">convertDDSBitmap()</a>. +<p> +<div class="fragment"><pre>00253 { +00254 <a class="code" href="a04558.html#a15">uint</a> W= <a class="code" href="a04223.html#a652">src</a>.getWidth(); +00255 <a class="code" href="a04558.html#a15">uint</a> H= <a class="code" href="a04223.html#a652">src</a>.getHeight(); +00256 +00257 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *srcPix= &(<a class="code" href="a04223.html#a652">src</a>.getPixels()[0]); +00258 <a class="code" href="a04558.html#a7">uint8</a> *dstPix= &(dst.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]); +00259 <a class="code" href="a04558.html#a15">uint</a> numBlock= (W*H)/16; +00260 +00261 <span class="comment">/*</span> +00262 <span class="comment"> need to swap color and bits for DXTC1 or DXTC1A.</span> +00263 <span class="comment"> */</span> +00264 +00265 <span class="keyword">static</span> <a class="code" href="a04558.html#a11">uint32</a> bitLUT[8]= { +00266 1,0,3,2, <span class="comment">// reverse std order</span> +00267 1,0,2,3, <span class="comment">// reverse order for "special 0/black packing"</span> +00268 }; +00269 +00270 <span class="comment">// Do not use alpha mask for now.</span> +00271 <span class="keywordflow">for</span>(;numBlock>0;numBlock--) +00272 { +00273 <a class="code" href="a04558.html#a9">uint16</a> srcCol0= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[0]; +00274 <a class="code" href="a04558.html#a9">uint16</a> srcCol1= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[1]; +00275 <span class="keywordtype">bool</span> srcSign= srcCol0>srcCol1; +00276 <span class="comment">// apply modifiers for 2 colors.</span> +00277 <a class="code" href="a04558.html#a9">uint16</a> dstCol0= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol0, dh,dLum,dSat); +00278 <a class="code" href="a04558.html#a9">uint16</a> dstCol1= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol1, dh,dLum,dSat); +00279 <span class="keywordtype">bool</span> dstSign= dstCol0>dstCol1; +00280 <span class="keywordflow">if</span>((<a class="code" href="a04558.html#a15">uint</a>)dstSign!=(<a class="code" href="a04558.html#a15">uint</a>)srcSign) +00281 { +00282 swap(dstCol0,dstCol1); +00283 <span class="comment">// must change bits too!</span> +00284 <a class="code" href="a04558.html#a11">uint32</a> srcBits= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[1]; +00285 <a class="code" href="a04558.html#a11">uint32</a> dstBits= 0; +00286 <span class="comment">// take correct lut according to original sign</span> +00287 <a class="code" href="a04558.html#a11">uint32</a> *lut; +00288 <span class="keywordflow">if</span>(srcCol0>srcCol1) +00289 lut= bitLUT; +00290 <span class="keywordflow">else</span> +00291 lut= bitLUT+4; +00292 +00293 <span class="comment">// for all bits, transpose with lut.</span> +00294 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00295 <span class="preprocessor"></span> __asm +00296 { +00297 mov eax, srcBits +00298 mov esi, lut +00299 mov edx, 0 +00300 mov ecx, 16 +00301 <span class="comment">// prepare 1st.</span> +00302 rol eax, 2 +00303 mov ebx, eax +00304 and ebx, 2 +00305 <span class="comment">// do it 16 times.</span> +00306 myLoop: +00307 or edx, [esi+ebx*4] +00308 rol eax, 2 +00309 rol edx, 2 +00310 mov ebx, eax +00311 and ebx, 2 +00312 dec ecx +00313 jnz myLoop +00314 +00315 ror edx, 2 +00316 mov dstBits, edx +00317 } +00318 <span class="preprocessor">#else</span> +00319 <span class="preprocessor"></span> <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> n=16;n>0;n--) +00320 { +00321 <span class="comment">// transform the id.</span> +00322 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>= srcBits&3; +00323 <span class="keywordtype">id</span>= lut[<span class="keywordtype">id</span>]; +00324 <span class="comment">// write.</span> +00325 dstBits|= <span class="keywordtype">id</span><<30; +00326 <span class="comment">// don't decal last</span> +00327 <span class="keywordflow">if</span>(n>1) +00328 dstBits>>=2; +00329 } +00330 <span class="preprocessor">#endif</span> +00331 <span class="preprocessor"></span> +00332 <span class="comment">// store </span> +00333 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[1]= dstBits; +00334 } +00335 <span class="keywordflow">else</span> +00336 <span class="comment">// just copy bits</span> +00337 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[1]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[3]; +00338 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[0]= dstCol0; +00339 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[1]= dstCol1; +00340 <span class="comment">// skip.</span> +00341 srcPix+= 8; +00342 dstPix+= 8; +00343 } +00344 +00345 <span class="comment">// Must end MMX, for applyHLSMod()</span> +00346 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00347 <span class="preprocessor"></span> <span class="keywordflow">if</span>(CSystemInfo::hasMMX()) +00348 _asm emms; +00349 <span class="preprocessor">#endif</span> +00350 <span class="preprocessor"></span> +00351 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifierd2" doxytag="NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5 </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>dst</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>src</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>dh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>dLum</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>dSat</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00354">354</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00393">convertDDSBitmap()</a>. +<p> +<div class="fragment"><pre>00355 { +00356 <a class="code" href="a04558.html#a15">uint</a> W= <a class="code" href="a04223.html#a652">src</a>.getWidth(); +00357 <a class="code" href="a04558.html#a15">uint</a> H= <a class="code" href="a04223.html#a652">src</a>.getHeight(); +00358 +00359 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *srcPix= &(<a class="code" href="a04223.html#a652">src</a>.getPixels()[0]); +00360 <a class="code" href="a04558.html#a7">uint8</a> *dstPix= &(dst.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]); +00361 <a class="code" href="a04558.html#a15">uint</a> numBlock= (W*H)/16; +00362 +00363 <span class="comment">/*</span> +00364 <span class="comment"> NB: don't need to swap color and bits for DXTC3 or DXTC5.</span> +00365 <span class="comment"> */</span> +00366 +00367 <span class="comment">// Do not use alpha mask for now.</span> +00368 <span class="keywordflow">for</span>(;numBlock>0;numBlock--) +00369 { +00370 <a class="code" href="a04558.html#a9">uint16</a> srcCol0= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[4]; +00371 <a class="code" href="a04558.html#a9">uint16</a> srcCol1= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[5]; +00372 <span class="comment">// apply modifiers for 2 colors.</span> +00373 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[4]= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol0, dh,dLum,dSat); +00374 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[5]= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol1, dh,dLum,dSat); +00375 <span class="comment">// just copy bits</span> +00376 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[3]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[3]; +00377 <span class="comment">// copy alpha part.</span> +00378 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[0]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[0]; +00379 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[1]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[1]; +00380 <span class="comment">// skip bits and alpha part.</span> +00381 srcPix+= 16; +00382 dstPix+= 16; +00383 } +00384 +00385 <span class="comment">// Must end MMX, for applyHLSMod()</span> +00386 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00387 <span class="preprocessor"></span> <span class="keywordflow">if</span>(CSystemInfo::hasMMX()) +00388 _asm emms; +00389 <span class="preprocessor">#endif</span> +00390 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifiera3" doxytag="NL3D::CFastHLSModifier::convertRGBABitmap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertRGBABitmap </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>dst</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> & </td> + <td class="mdname" nowrap> <em>src</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>dh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>dl</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>ds</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255). +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00414">414</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05706.html#l00086">convert()</a>, <a class="el" href="a06339.html#l00609">NLMISC::CRGBA::convertToHLS()</a>, <a class="el" href="a05487.html#l00335">NLMISC::CBitmap::getPixelFormat()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05701.html#l00125">NLMISC::OptFastFloor()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00415 { +00416 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat</a>()); +00417 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::RGBA); +00418 +00419 <a class="code" href="a04558.html#a15">uint</a> W= <a class="code" href="a04223.html#a652">src</a>.getWidth(); +00420 <a class="code" href="a04558.html#a15">uint</a> H= <a class="code" href="a04223.html#a652">src</a>.getHeight(); +00421 +00422 <span class="keyword">const</span> <a class="code" href="a03337.html">CRGBA</a> *srcPix= (<span class="keyword">const</span> <a class="code" href="a03337.html">CRGBA</a>*)&(<a class="code" href="a04223.html#a652">src</a>.getPixels()[0]); +00423 <a class="code" href="a03337.html">CRGBA</a> *dstPix= (<a class="code" href="a03337.html">CRGBA</a>*)&(dst.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]); +00424 <a class="code" href="a04558.html#a15">uint</a> numPix= W*H; +00425 +00426 <span class="comment">// Do not use alpha mask for now.</span> +00427 <span class="keywordflow">for</span>(;numPix>0;numPix--) +00428 { +00429 <span class="keywordtype">float</span> H,L,S; +00430 srcPix-><a class="code" href="a03337.html#NLMISC_1_1CRGBAz2026_1">convertToHLS</a>(H,L,S); +00431 H*= 256.f/360.f; +00432 L*= 255.f; +00433 S*= 255.f; +00434 H+= dh+0.5f; +00435 L+= dl+0.5f; +00436 S+= ds+0.5f; +00437 <a class="code" href="a05378.html#a374">clamp</a>(H, 0, 255); +00438 <a class="code" href="a05378.html#a374">clamp</a>(L, 0, 255); +00439 <a class="code" href="a05378.html#a374">clamp</a>(S, 0, 255); +00440 <a class="code" href="a04558.html#a7">uint8</a> H8= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(H); +00441 <a class="code" href="a04558.html#a7">uint8</a> L8= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(L); +00442 <a class="code" href="a04558.html#a7">uint8</a> S8= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(S); +00443 *dstPix= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera1">convert</a>(H8, L8, S8); +00444 srcPix++; +00445 dstPix++; +00446 } +00447 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifiere0" doxytag="NL3D::CFastHLSModifier::getInstance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02513.html">CFastHLSModifier</a> & NL3D::CFastHLSModifier::getInstance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +get the singleton +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00077">77</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +References <a class="el" href="a05706.html#l00043">_Instance</a>. +<p> +<div class="fragment"><pre>00078 { +00079 <span class="keywordflow">if</span>(!<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a>) +00080 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a>= <span class="keyword">new</span> <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierd0">CFastHLSModifier</a>; +00081 <span class="keywordflow">return</span> *<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a>; +00082 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CFastHLSModifierr0" doxytag="NL3D::CFastHLSModifier::_Color16ToHLS" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02514.html">CHLSA</a> <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr0">NL3D::CFastHLSModifier::_Color16ToHLS</a>[65536]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05707.html#l00085">85</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, and <a class="el" href="a05706.html#l00047">CFastHLSModifier()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifierr1" doxytag="NL3D::CFastHLSModifier::_HueTable" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr1">NL3D::CFastHLSModifier::_HueTable</a>[HueTableSize]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05707.html#l00084">84</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00047">CFastHLSModifier()</a>, and <a class="el" href="a05706.html#l00086">convert()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CFastHLSModifierv0" doxytag="NL3D::CFastHLSModifier::_Instance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02513.html">CFastHLSModifier</a> * <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierv0">NL3D::CFastHLSModifier::_Instance</a> = NULL<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05706.html#l00043">43</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>. +<p> +Referenced by <a class="el" href="a05706.html#l00077">getInstance()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05707.html">fasthls_modifier.h</a><li><a class="el" href="a05706.html">fasthls_modifier.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:46:31 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |