diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/rgba_8cpp-source.html | 805 |
1 files changed, 805 insertions, 0 deletions
diff --git a/docs/doxygen/nel/rgba_8cpp-source.html b/docs/doxygen/nel/rgba_8cpp-source.html new file mode 100644 index 00000000..7befbbaf --- /dev/null +++ b/docs/doxygen/nel/rgba_8cpp-source.html @@ -0,0 +1,805 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.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">Compound List</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">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>rgba.cpp</h1><a href="rgba_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font> +00027 +00028 <font class="preprocessor">#include "<a class="code" href="rgba_8h.html">nel/misc/rgba.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="system__info_8h.html">nel/misc/system_info.h</a>"</font> +00031 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font> +00032 +00033 +00034 <font class="keyword">namespace </font>NLMISC { +00035 +00036 +00037 <font class="comment">//#define DISABLE_MMX_OPTIM</font> +00038 +00039 <font class="comment">// ***************************************************************************</font> +00040 <font class="comment">// ***************************************************************************</font> +00041 <font class="comment">// CRGBA</font> +00042 <font class="comment">// ***************************************************************************</font> +00043 <font class="comment">// ***************************************************************************</font> +00044 +00045 <font class="comment">// predifined colors</font> +00046 +00048 <font class="keyword">const</font> CRGBA CRGBA::Black(0, 0, 0) ; +00049 <font class="keyword">const</font> CRGBA CRGBA::Red(255, 0, 0) ; +00050 <font class="keyword">const</font> CRGBA CRGBA::Green(0, 255, 0) ; +00051 <font class="keyword">const</font> CRGBA CRGBA::Yellow(255, 255, 0) ; +00052 <font class="keyword">const</font> CRGBA CRGBA::Blue(0, 0, 255) ; +00053 <font class="keyword">const</font> CRGBA CRGBA::Magenta(255, 0, 255) ; +00054 <font class="keyword">const</font> CRGBA CRGBA::Cyan(0, 255, 255) ; +00055 <font class="keyword">const</font> CRGBA CRGBA::White(255, 255, 255) ; +00056 +00057 <font class="comment">// ***************************************************************************</font> +<a name="l00058"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a6">00058</a> <font class="keywordtype">void</font> CRGBA::serial(<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00059 { +00060 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>); +00061 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>); +00062 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>); +00063 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>); +00064 } +00065 <font class="comment">// ***************************************************************************</font> +<a name="l00066"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a10">00066</a> <font class="keywordtype">void</font> CRGBA::set(uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, uint8 g, uint8 b, uint8 a) +00067 { +00068 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00069 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = g; +00070 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = b; +00071 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a> = a; +00072 } +00073 +00074 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font> +00075 <font class="preprocessor"></font><font class="preprocessor"> #pragma warning(disable : 4731) </font><font class="comment">/* frame pointer register 'ebp' modified by inline assembly code */</font> +00076 <font class="preprocessor">#endif</font> +00077 <font class="preprocessor"></font> +00078 <font class="comment">// ***************************************************************************</font> +<a name="l00079"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z322_0">00079</a> <font class="keywordtype">void</font> CRGBA::addColors(CRGBA *dest, <font class="keyword">const</font> CRGBA *src1, <font class="keyword">const</font> CRGBA *src2, uint numColors, uint srcStride, uint destStride, uint dup) +00080 { +00081 <font class="keywordflow">if</font> (numColors == 0) <font class="keywordflow">return</font>; +00082 <font class="preprocessor"> #if defined(NL_OS_WINDOWS) && !defined(DISABLE_MMX_OPTIM)</font> +00083 <font class="preprocessor"></font> <font class="keywordflow">if</font> (!CSystemInfo::hasMMX()) +00084 <font class="preprocessor"> #endif</font> +00085 <font class="preprocessor"></font> { <font class="comment">// unoptimized version</font> +00086 <font class="keywordflow">if</font> (dup == 1) +00087 { +00088 <font class="keywordflow">while</font> (numColors--) +00089 { +00090 dest->add(*src1, *src2); +00091 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00092 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00093 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00094 } +00095 } +00096 <font class="keywordflow">else</font> +00097 { +00098 <font class="keywordflow">if</font> (dup == 4) <font class="comment">// optimisation for the 4 case</font> +00099 { +00100 <font class="keywordflow">while</font> (numColors--) +00101 { +00102 dest->add(*src1, *src2); +00103 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00104 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00105 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00106 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00107 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00108 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + (destStride << 1)); +00109 +00110 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00111 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00112 } +00113 } +00114 <font class="keywordflow">else</font> +00115 { +00116 <font class="keywordflow">while</font> (numColors--) +00117 { +00118 dest->add(*src1, *src2); +00119 +00120 uint k = dup - 1; +00121 <font class="keywordflow">do</font> +00122 { +00123 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00124 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00125 } +00126 <font class="keywordflow">while</font> (--k); +00127 +00128 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00129 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00130 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00131 } +00132 } +00133 } +00134 } +00135 <font class="preprocessor"> #if defined(NL_OS_WINDOWS) && !defined(DISABLE_MMX_OPTIM)</font> +00136 <font class="preprocessor"></font> <font class="keywordflow">else</font> <font class="comment">// optimized mmx version</font> +00137 { +00139 <font class="keywordflow">if</font> (dup == 1) +00140 { +00141 __asm +00142 { +00143 push ebp +00144 mov edi, dest +00145 mov esi, src1 +00146 mov ebx, src2 +00147 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00148 mov ecx, numColors +00149 mov edx, destStride +00150 mov ebp, srcStride +00151 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> edi, edx +00152 myLoop: +00153 movd mm0, [esi] +00154 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> edi, edx +00155 movd mm1, [esi + ebx] +00156 paddusb mm0, mm1 +00157 movd [edi], mm0 +00158 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00159 dec ecx +00160 jne myLoop +00161 pop ebp +00162 emms +00163 } +00164 } +00165 <font class="keywordflow">else</font> +00166 { +00167 <font class="keywordflow">if</font> (dup == 4) +00168 { +00169 __asm +00170 { +00171 push ebp +00172 mov edi, dest +00173 mov esi, src1 +00174 mov ebx, src2 +00175 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00176 mov ecx, numColors +00177 mov edx, destStride +00178 mov ebp, srcStride +00179 myLoop4: +00180 movd mm0, [esi] +00181 movd mm1, [esi + ebx] +00182 paddusb mm0, mm1 +00183 movd eax, mm0 +00184 +00185 mov [edi], eax +00186 mov [edi + edx], eax +00187 mov [edi + 2 * edx], eax +00188 lea edi, [edi + edx * 2] +00189 mov [edi + edx], eax +00190 lea edi, [edi + edx * 2] +00191 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00192 +00193 dec ecx +00194 jne myLoop4 +00195 pop ebp +00196 emms +00197 } +00198 } +00199 <font class="keywordflow">else</font> +00200 { +00201 __asm +00202 { +00203 push ebp +00204 mov edi, dest +00205 mov esi, src1 +00206 mov ebx, src2 +00207 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00208 mov ecx, numColors +00209 mov edx, destStride +00210 mov eax, dup +00211 mov ebp, srcStride +00212 push eax +00213 myLoopN: +00214 movd mm0, [esi] +00215 movd mm1, [esi + ebx] +00216 push ecx +00217 paddusb mm0, mm1 +00218 mov ecx, 4[esp] +00219 movd eax, mm0 +00220 dupLoopN: +00221 mov [edi], eax +00222 dec ecx +00223 lea edi, [edi + edx] +00224 jne dupLoopN +00225 pop ecx ; get back the loop counter +00226 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00227 dec ecx +00228 jne myLoopN +00229 pop eax +00230 pop ebp +00231 emms +00232 } +00233 } +00234 } +00235 } +00236 <font class="preprocessor"> #endif</font> +00237 <font class="preprocessor"></font>} +00238 <font class="comment">// ***************************************************************************</font> +<a name="l00239"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z322_1">00239</a> <font class="keywordtype">void</font> CRGBA::modulateColors(CRGBA *dest, <font class="keyword">const</font> CRGBA *src1, <font class="keyword">const</font> CRGBA *src2, uint numColors, uint srcStride, uint destStride, uint dup) +00240 { +00241 <font class="preprocessor"> #if defined(NL_OS_WINDOWS) && !defined(DISABLE_MMX_OPTIM)</font> +00242 <font class="preprocessor"></font> <font class="keywordflow">if</font> (!CSystemInfo::hasMMX()) +00243 <font class="preprocessor"> #endif</font> +00244 <font class="preprocessor"></font> { <font class="comment">// unoptimized version</font> +00245 <font class="keywordflow">if</font> (dup == 1) +00246 { +00247 <font class="keywordflow">while</font> (numColors--) +00248 { +00249 dest->modulateFromColor(*src1, *src2); +00250 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00251 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00252 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00253 } +00254 } +00255 <font class="keywordflow">else</font> +00256 { +00257 <font class="keywordflow">if</font> (dup == 4) <font class="comment">// optimisation for the 4 case</font> +00258 { +00259 <font class="keywordflow">while</font> (numColors--) +00260 { +00261 dest->modulateFromColor(*src1, *src2); +00262 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00263 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00264 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00265 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00266 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00267 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + (destStride << 1)); +00268 +00269 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00270 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00271 } +00272 } +00273 <font class="keywordflow">else</font> +00274 { +00275 <font class="keywordflow">while</font> (numColors--) +00276 { +00277 dest->modulateFromColor(*src1, *src2); +00278 +00279 uint k = dup - 1; +00280 <font class="keywordflow">do</font> +00281 { +00282 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00283 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00284 } +00285 <font class="keywordflow">while</font> (--k); +00286 +00287 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00288 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00289 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00290 } +00291 } +00292 } +00293 } +00294 <font class="preprocessor"> #if defined(NL_OS_WINDOWS) && !defined(DISABLE_MMX_OPTIM)</font> +00295 <font class="preprocessor"></font> <font class="keywordflow">else</font> <font class="comment">// optimized mmx version</font> +00296 { +00297 uint64 blank = 0; +00299 <font class="keywordflow">if</font> (dup == 1) +00300 { __asm +00301 { +00302 push ebp +00303 movq mm2, blank +00304 mov edi, dest +00305 mov esi, src1 +00306 mov ebx, src2 +00307 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00308 mov ecx, numColors +00309 mov edx, destStride +00310 mov ebp, srcStride +00311 myLoop: +00312 movd mm0, [esi] +00313 movd mm1, [esi + ebx] +00314 punpcklbw mm0, mm2 +00315 punpcklbw mm1, mm2 +00316 pmullw mm0, mm1 +00317 psrlw mm0, 8 +00318 packuswb mm0, mm0 +00319 movd [edi], mm0 +00320 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> edi, edx +00321 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00322 +00323 dec ecx +00324 jne myLoop +00325 pop ebp +00326 emms +00327 } +00328 } +00329 <font class="keywordflow">else</font> +00330 { +00331 <font class="keywordflow">if</font> (dup == 4) +00332 { +00333 +00334 __asm +00335 { +00336 push ebp +00337 movq mm2, blank +00338 mov edi, dest +00339 mov esi, src1 +00340 mov ebx, src2 +00341 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00342 mov ecx, numColors +00343 mov edx, destStride +00344 mov ebp, srcStride +00345 myLoop4: +00346 movd mm0, [esi] +00347 movd mm1, [esi + ebx] +00348 punpcklbw mm0, mm2 +00349 punpcklbw mm1, mm2 +00350 pmullw mm0, mm1 +00351 psrlw mm0, 8 +00352 packuswb mm0, mm0 +00353 movd eax, mm0 +00354 ; duplicate the result 4 times +00355 mov [edi], eax +00356 mov [edi + edx], eax +00357 mov [edi + 2 * edx], eax +00358 lea edi, [edi + 2 * edx] +00359 mov [edi + edx], eax +00360 lea edi, [edi + 2 * edx] +00361 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00362 dec ecx +00363 jne myLoop4 +00364 pop ebp +00365 emms +00366 } +00367 } +00368 <font class="keywordflow">else</font> +00369 { +00370 __asm +00371 { +00372 push ebp +00373 mov edi, dest +00374 mov esi, src1 +00375 mov ebx, src2 +00376 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00377 mov ecx, numColors +00378 mov edx, destStride +00379 mov eax, dup +00380 mov ebp, srcStride +00381 push eax +00382 myLoopN: +00383 movd mm0, [esi] +00384 movd mm1, [esi + ebx] +00385 punpcklbw mm0, mm2 +00386 punpcklbw mm1, mm2 +00387 pmullw mm0, mm1 +00388 push ecx +00389 psrlw mm0, 8 +00390 mov ecx, 4[esp] +00391 packuswb mm0, mm0 +00392 movd eax, mm0 +00393 dupLoopN: +00394 mov [edi], eax +00395 dec ecx +00396 lea edi, [edi + edx] +00397 jne dupLoopN +00398 pop ecx ; get back the loop counter +00399 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00400 dec ecx +00401 jne myLoopN +00402 pop eax +00403 pop ebp +00404 emms +00405 } +00406 } +00407 } +00408 } +00409 <font class="preprocessor"> #endif</font> +00410 <font class="preprocessor"></font>} +00411 <font class="comment">// ***************************************************************************</font> +<a name="l00412"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z322_2">00412</a> <font class="keywordtype">void</font> CRGBA::subtractColors(CRGBA *dest, <font class="keyword">const</font> CRGBA *src1, <font class="keyword">const</font> CRGBA *src2, uint numColors, uint srcStride, uint destStride, uint dup) +00413 { +00414 <font class="keywordflow">if</font> (numColors == 0) <font class="keywordflow">return</font>; +00415 <font class="preprocessor"> #if defined(NL_OS_WINDOWS) && !defined(DISABLE_MMX_OPTIM)</font> +00416 <font class="preprocessor"></font> <font class="keywordflow">if</font> (!CSystemInfo::hasMMX()) +00417 <font class="preprocessor"> #endif</font> +00418 <font class="preprocessor"></font> { <font class="comment">// unoptimized version</font> +00419 <font class="keywordflow">if</font> (dup == 1) +00420 { +00421 <font class="keywordflow">while</font> (numColors--) +00422 { +00423 dest->sub(*src1, *src2); +00424 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00425 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00426 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00427 } +00428 } +00429 <font class="keywordflow">else</font> +00430 { +00431 <font class="keywordflow">if</font> (dup == 4) <font class="comment">// optimisation for the 4 case</font> +00432 { +00433 <font class="keywordflow">while</font> (numColors--) +00434 { +00435 dest->sub(*src1, *src2); +00436 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00437 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00438 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00439 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00440 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00441 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + (destStride << 1)); +00442 +00443 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00444 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00445 } +00446 } +00447 <font class="keywordflow">else</font> +00448 { +00449 <font class="keywordflow">while</font> (numColors--) +00450 { +00451 dest->sub(*src1, *src2); +00452 +00453 uint k = dup - 1; +00454 <font class="keywordflow">do</font> +00455 { +00456 * (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride) = *dest; +00457 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00458 } +00459 <font class="keywordflow">while</font> (--k); +00460 +00461 dest = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) dest + destStride); +00462 src1 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src1 + srcStride); +00463 src2 = (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *) ((uint8 *) src2 + srcStride); +00464 } +00465 } +00466 } +00467 } +00468 <font class="preprocessor"> #if defined(NL_OS_WINDOWS) && !defined(DISABLE_MMX_OPTIM)</font> +00469 <font class="preprocessor"></font> <font class="keywordflow">else</font> <font class="comment">// optimized mmx version</font> +00470 { +00472 <font class="keywordflow">if</font> (dup == 1) +00473 { +00474 __asm +00475 { +00476 push ebp +00477 mov edi, dest +00478 mov esi, src1 +00479 mov ebx, src2 +00480 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00481 mov ecx, numColors +00482 mov edx, destStride +00483 mov ebp, srcStride +00484 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> edi, edx +00485 myLoop: +00486 movd mm0, [esi] +00487 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> edi, edx +00488 movd mm1, [esi + ebx] +00489 psubusb mm0, mm1 +00490 movd [edi], mm0 +00491 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00492 dec ecx +00493 jne myLoop +00494 pop ebp +00495 emms +00496 } +00497 } +00498 <font class="keywordflow">else</font> +00499 { +00500 <font class="keywordflow">if</font> (dup == 4) +00501 { +00502 __asm +00503 { +00504 push ebp +00505 mov edi, dest +00506 mov esi, src1 +00507 mov ebx, src2 +00508 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00509 mov ecx, numColors +00510 mov edx, destStride +00511 mov ebp, srcStride +00512 myLoop4: +00513 movd mm0, [esi] +00514 movd mm1, [esi + ebx] +00515 psubusb mm0, mm1 +00516 movd eax, mm0 +00517 +00518 mov [edi], eax +00519 mov [edi + edx], eax +00520 mov [edi + 2 * edx], eax +00521 lea edi, [edi + edx * 2] +00522 mov [edi + edx], eax +00523 lea edi, [edi + edx * 2] +00524 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00525 +00526 dec ecx +00527 jne myLoop4 +00528 pop ebp +00529 emms +00530 } +00531 } +00532 <font class="keywordflow">else</font> +00533 { +00534 __asm +00535 { +00536 push ebp +00537 mov edi, dest +00538 mov esi, src1 +00539 mov ebx, src2 +00540 <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a> ebx, esi ; <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a> to source 2 +00541 mov ecx, numColors +00542 mov edx, destStride +00543 mov eax, dup +00544 mov ebp, srcStride +00545 push eax +00546 myLoopN: +00547 movd mm0, [esi] +00548 movd mm1, [esi + ebx] +00549 push ecx +00550 psubusb mm0, mm1 +00551 mov ecx, 4[esp] +00552 movd eax, mm0 +00553 dupLoopN: +00554 mov [edi], eax +00555 dec ecx +00556 lea edi, [edi + edx] +00557 jne dupLoopN +00558 pop ecx ; get back the loop counter +00559 <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a> esi, ebp +00560 dec ecx +00561 jne myLoopN +00562 pop eax +00563 pop ebp +00564 emms +00565 } +00566 } +00567 } +00568 } +00569 <font class="preprocessor"> #endif</font> +00570 <font class="preprocessor"></font>} +00571 +00572 <font class="comment">// ***************************************************************************</font> +00573 <font class="comment">// ***************************************************************************</font> +00574 <font class="comment">// CBGRA</font> +00575 <font class="comment">// ***************************************************************************</font> +00576 <font class="comment">// ***************************************************************************</font> +00577 +00578 +00579 <font class="comment">// ***************************************************************************</font> +<a name="l00580"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a7">00580</a> <font class="keywordtype">void</font> CBGRA::serial(<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00581 { +00582 f.serial (<a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a>); +00583 f.serial (<a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a>); +00584 f.serial (<a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a>); +00585 f.serial (<a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>); +00586 } +00587 <font class="comment">// ***************************************************************************</font> +<a name="l00588"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a9">00588</a> <font class="keywordtype">void</font> CBGRA::set(uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, uint8 g, uint8 b, uint8 a) +00589 { +00590 <a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00591 <a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a> = g; +00592 <a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a> = b; +00593 <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a> = a; +00594 } +00595 <font class="comment">// ***************************************************************************</font> +<a name="l00596"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a8">00596</a> <font class="keywordtype">void</font> CBGRA::blendFromui(CBGRA &c0, CBGRA &c1, uint coef) <font class="comment">// coef must be in [0,256]</font> +00597 { +00598 <font class="keywordtype">int</font> a1 = coef; +00599 <font class="keywordtype">int</font> a2 = 256-a1; +00600 R = (c0.R*a2 + c1.R*a1) >>8; +00601 G = (c0.G*a2 + c1.G*a1) >>8; +00602 B = (c0.B*a2 + c1.B*a1) >>8; +00603 A = (c0.A*a2 + c1.A*a1) >>8; +00604 } +00605 +00606 +00607 <font class="comment">// ***************************************************************************</font> +<a name="l00608"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z323_0">00608</a> <font class="keywordtype">bool</font> CRGBA::convertToHLS(<font class="keywordtype">float</font> &h, <font class="keywordtype">float</font> &<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, <font class="keywordtype">float</font> &<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)<font class="keyword"> const</font> +00609 <font class="keyword"></font>{ +00610 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> = <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> / 255.f; +00611 <font class="keywordtype">float</font> g = <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> / 255.f; +00612 <font class="keywordtype">float</font> b = <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> / 255.f; +00613 +00614 <font class="keywordtype">float</font> maxV = <a class="code" href="namespaceNLMISC.html#a219">NLMISC::maxof</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, g, b); +00615 <font class="keywordtype">float</font> minV = <a class="code" href="namespaceNLMISC.html#a216">NLMISC::minof</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, g, b); +00616 +00618 <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0.5f * (maxV + minV); +00619 +00621 <font class="keywordflow">if</font> (minV == maxV) <font class="comment">// all composants are equals -> achromatique</font> +00622 { +00623 <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> = 0; +00624 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00625 } +00626 <font class="keywordtype">float</font> diff = maxV - minV; +00628 <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> = <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> > 0.5f ? <font class="comment">/*are we in the top of the double-hexcone ? */</font> +00629 diff / (2.f - maxV - minV) : +00630 diff / (maxV + minV); +00631 +00632 <font class="comment">// Get hue</font> +00633 +00634 <font class="keywordflow">if</font> (maxV == <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>) +00635 { +00636 h = (g - b) / diff; +00637 } +00638 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (maxV == g) +00639 { +00640 h = 2.f + (b - <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>) / diff; +00641 } +00642 <font class="keywordflow">else</font> +00643 { +00644 h = 4.f + (<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> - g) / diff; +00645 } +00646 +00647 h *= 60.f; <font class="comment">// scale to [0..360]</font> +00648 +00649 <font class="keywordflow">if</font> (h < 0.f) h += 360.f; +00650 +00651 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00652 } +00653 +00654 +00655 <font class="comment">// ***************************************************************************</font> +00657 <font class="comment">static float HLSValue(float h, float v1, float v2)</font> +00658 { +00659 <font class="comment">/* get hue in the [0, 360] interval */</font> +00660 <font class="comment">// h -= 360.f * ::floorf(h / 360.f);</font> +00661 +00662 <font class="keywordflow">if</font> (h > 360.f) h -= 360.f; +00663 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (h < 0) h += 360.f; +00664 +00665 <font class="keywordflow">if</font> (h < 60.f) +00666 { +00667 <font class="keywordflow">return</font> v1 + (v2 - v1) * h / 60.f; +00668 } +00669 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (h < 180.f) +00670 { +00671 <font class="keywordflow">return</font> v2; +00672 } +00673 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (h < 240.f) +00674 { +00675 <font class="keywordflow">return</font> v1 + (v2 - v1) * (240.f - h) / 60.f; +00676 } +00677 <font class="keywordflow">else</font> +00678 { +00679 <font class="keywordflow">return</font> v1; +00680 } +00681 } +00682 +00683 +00684 <font class="comment">// ***************************************************************************</font> +<a name="l00685"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z323_1">00685</a> <font class="keywordtype">void</font> CRGBA::buildFromHLS(<font class="keywordtype">float</font> h, <font class="keywordtype">float</font> <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>) +00686 { +00687 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, 0, 1); +00688 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>, 0, 1); +00689 +00690 <font class="keywordtype">float</font> v2 = (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> <= 0.5f) ? (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> * (1 + <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)) : (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> - <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> * <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>); +00691 <font class="keywordtype">float</font> v1 = 2.f * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> - v2; +00692 +00693 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> == 0) <font class="comment">// achromatic ?</font> +00694 { +00695 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (uint8) (255.f * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>); +00696 } +00697 <font class="keywordflow">else</font> <font class="comment">// chromatic case</font> +00698 { +00699 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>; +00700 <font class="comment">//</font> +00701 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = <a class="code" href="namespaceNLMISC.html#a313">HLSValue</a>(h + 120.f, v1, v2); +00702 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, 0.f, 1.f); +00703 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (uint8) (255.f * <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00704 <font class="comment">//</font> +00705 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = <a class="code" href="namespaceNLMISC.html#a313">HLSValue</a>(h, v1, v2); +00706 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, 0.f, 1.f); +00707 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (uint8) (255.f * <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00708 <font class="comment">//</font> +00709 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = <a class="code" href="namespaceNLMISC.html#a313">HLSValue</a>(h - 120.f, v1, v2); +00710 <a class="code" href="namespaceNLMISC.html#a215">clamp</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, 0.f, 1.f); +00711 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (uint8) (255.f * <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>); +00712 } +00713 } +00714 +00715 +00716 <font class="comment">// ***************************************************************************</font> +00717 <font class="comment">// ***************************************************************************</font> +00718 <font class="comment">// CRGBAF</font> +00719 <font class="comment">// ***************************************************************************</font> +00720 <font class="comment">// ***************************************************************************</font> +00721 +00722 +00723 <font class="comment">// ***************************************************************************</font> +00724 <font class="keywordtype">void</font> CRGBAF::serial(<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00725 { +00726 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>); +00727 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>); +00728 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>); +00729 f.serial (<a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>); +00730 } +00731 <font class="comment">// ***************************************************************************</font> +<a name="l00732"></a><a class="code" href="classNLMISC_1_1CRGBAF.html#a0">00732</a> <font class="keywordtype">void</font> CRGBAF::set(<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, <font class="keywordtype">float</font> g, <font class="keywordtype">float</font> b, <font class="keywordtype">float</font> a) +00733 { +00734 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>; +00735 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a> = g; +00736 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a> = b; +00737 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a> = a; +00738 } +00739 +00740 +00741 +00742 +00743 +00744 } <font class="comment">// NLMISC</font> +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |