1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
<!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="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/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="/inc/img/black_banner.jpg"><A HREF=""><IMG SRC="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="/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="/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="/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="/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:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>rgba.h</h1><a href="rgba_8h.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">#ifndef NL_RGBA_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_RGBA_H</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
00031
00032
00033 <font class="keyword">namespace </font>NLMISC
00034 {
00035
00036 <font class="keyword">class </font>IStream;
00037
<a name="l00044"></a><a class="code" href="classNLMISC_1_1CRGBA.html">00044</a> <font class="keyword">class </font>CRGBA
00045 {
00046 <font class="keyword">public</font>:
00047
<a name="l00049"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a0">00049</a> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>() {};
00050
<a name="l00058"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a1">00058</a> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>(uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, uint8 g, uint8 b, uint8 a=255) :
00059 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>), <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>(g), <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>(b), <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>(a) {}
00060
<a name="l00064"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a2">00064</a> uint <a class="code" href="classNLMISC_1_1CRGBA.html#a2">getPacked</a>()<font class="keyword"> const </font>{<font class="keywordflow">return</font> ((uint)<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a><<24) + ((uint)<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a><<16) + ((uint)<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a><<8) + <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>;}
00065
<a name="l00069"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a3">00069</a> <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a3">operator<</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c)<font class="keyword"> const </font>{<font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a2">getPacked</a>()<c.getPacked();}
<a name="l00073"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a4">00073</a> <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a4">operator!=</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c)<font class="keyword"> const </font>{<font class="keywordflow">return</font> !(*<font class="keyword">this</font>==c);}
00074
<a name="l00078"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a5">00078</a> <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a5">operator==</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c)<font class="keyword"> const </font>
00079 <font class="keyword"> </font>{<font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>==c.R && <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>==c.G && <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>==c.B && <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>==c.A;}
00080
00085 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a6">serial</a> (<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f);
00086
<a name="l00093"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a7">00093</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a7">blendFromui</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1, uint coef) <font class="comment">// coef must be in [0,256]</font>
00094 {
00095 uint a1 = coef;
00096 uint a2 = 256-a1;
00097 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (c0.R*a2 + c1.R*a1) >>8;
00098 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (c0.G*a2 + c1.G*a1) >>8;
00099 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (c0.B*a2 + c1.B*a1) >>8;
00100 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a> = (c0.A*a2 + c1.A*a1) >>8;
00101 }
00102
<a name="l00108"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a8">00108</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a8">modulateFromui</a> (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, uint a)
00109 {
00110 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (c0.R*a) >>8;
00111 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (c0.G*a) >>8;
00112 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (c0.B*a) >>8;
00113 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a> = (c0.A*a) >>8;
00114 }
00115
00116
<a name="l00122"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a9">00122</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a9">modulateFromColor</a> (<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1)
00123 {
00124 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (c0.R*c1.R) >>8;
00125 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (c0.G*c1.G) >>8;
00126 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (c0.B*c1.B) >>8;
00127 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a> = (c0.A*c1.A) >>8;
00128 }
00129
00130
00138 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a10">set</a> (uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, uint8 g, uint8 b, uint8 a=255);
00139
<a name="l00143"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a11">00143</a> uint16 <a class="code" href="classNLMISC_1_1CRGBA.html#a11">get565</a> ()<font class="keyword"> const</font>
00144 <font class="keyword"> </font>{
00145 <font class="keywordflow">return</font> ((uint16)(<a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>&0xf8)<<8) | ((uint16)(<a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>&0xfc)<<3) | (uint16)(<a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>>>3);
00146 }
00147
<a name="l00151"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a12">00151</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a12">set565</a>(uint16 col)
00152 {
00153 <font class="comment">// unpack.</font>
00154 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= col>>11;
00155 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (col>>5)&0x3F;
00156 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (col)&0x1F;
00157 <font class="comment">// to 8 bits.</font>
00158 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= (R<<3) + (R>>2);
00159 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (G<<2) + (G>>4);
00160 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (B<<3) + (B>>2);
00161 }
00162
00163
<a name="l00167"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a13">00167</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a13">avg2</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> a, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> b)
00168 {
00169 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= ((uint)a.R+(uint)b.R)>>1;
00170 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= ((uint)a.G+(uint)b.G)>>1;
00171 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= ((uint)a.B+(uint)b.B)>>1;
00172 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>= ((uint)a.A+(uint)b.A)>>1;
00173 }
00174
<a name="l00179"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a14">00179</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a14">avg4</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> a, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> b, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> d)
00180 {
00181 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= ((uint)a.R+(uint)b.R+(uint)c.R+(uint)d.R+ 1)>>2;
00182 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= ((uint)a.G+(uint)b.G+(uint)c.G+(uint)d.G+ 1)>>2;
00183 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= ((uint)a.B+(uint)b.B+(uint)c.B+(uint)d.B+ 1)>>2;
00184 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>= ((uint)a.A+(uint)b.A+(uint)c.A+(uint)d.A+ 1)>>2;
00185 }
00186
<a name="l00190"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a15">00190</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a15">add</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1)
00191 {
00192 uint <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>,g,b,a;
00193 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= c0.R + c1.R; <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= (uint8)<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00194 g= c0.G + c1.G; g= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(g, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (uint8)g;
00195 b= c0.B + c1.B; b= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(b, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (uint8)b;
00196 a= c0.A + c1.A; a= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(a, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>= (uint8)a;
00197 }
00198
<a name="l00202"></a><a class="code" href="classNLMISC_1_1CRGBA.html#a16">00202</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a16">sub</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1)
00203 {
00204 sint <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>,g,b,a;
00205 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= c0.R - c1.R; <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= std::max(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= (uint8)<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00206 g= c0.G - c1.G; g= std::max(g, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (uint8)g;
00207 b= c0.B - c1.B; b= std::max(b, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (uint8)b;
00208 a= c0.A - c1.A; a= std::max(a, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>= (uint8)a;
00209 }
00210
00211
00213 <font class="comment">// @{</font>
00214
<a name="l00216"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_0">00216</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_0">blendFromuiRGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1, uint coef) <font class="comment">// coef must be in [0,256]</font>
00217 {
00218 uint a1 = coef;
00219 uint a2 = 256-a1;
00220 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (c0.R*a2 + c1.R*a1) >>8;
00221 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (c0.G*a2 + c1.G*a1) >>8;
00222 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (c0.B*a2 + c1.B*a1) >>8;
00223 }
<a name="l00225"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_1">00225</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_1">modulateFromuiRGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, uint a)
00226 {
00227 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (c0.R*a) >>8;
00228 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (c0.G*a) >>8;
00229 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (c0.B*a) >>8;
00230 }
<a name="l00232"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_2">00232</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_2">modulateFromColorRGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1)
00233 {
00234 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a> = (c0.R*c1.R) >>8;
00235 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a> = (c0.G*c1.G) >>8;
00236 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a> = (c0.B*c1.B) >>8;
00237 }
<a name="l00239"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_3">00239</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_3">avg2RGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> a, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> b)
00240 {
00241 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= ((uint)a.R+(uint)b.R)>>1;
00242 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= ((uint)a.G+(uint)b.G)>>1;
00243 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= ((uint)a.B+(uint)b.B)>>1;
00244 }
<a name="l00246"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_4">00246</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_4">avg4RGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> a, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> b, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> d)
00247 {
00248 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= ((uint)a.R+(uint)b.R+(uint)c.R+(uint)d.R+ 1)>>2;
00249 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= ((uint)a.G+(uint)b.G+(uint)c.G+(uint)d.G+ 1)>>2;
00250 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= ((uint)a.B+(uint)b.B+(uint)c.B+(uint)d.B+ 1)>>2;
00251 }
<a name="l00253"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_5">00253</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_5">addRGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1)
00254 {
00255 uint <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>,g,b;
00256 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= c0.R + c1.R; <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= (uint8)<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00257 g= c0.G + c1.G; g= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(g, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (uint8)g;
00258 b= c0.B + c1.B; b= <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(b, 255U); <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (uint8)b;
00259 }
<a name="l00261"></a><a class="code" href="classNLMISC_1_1CRGBA.html#z321_6">00261</a> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z321_6">subRGBOnly</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c0, <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> c1)
00262 {
00263 sint <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>,g,b;
00264 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= c0.R - c1.R; <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= std::max(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>= (uint8)<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>;
00265 g= c0.G - c1.G; g= std::max(g, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>= (uint8)g;
00266 b= c0.B - c1.B; b= std::max(b, 0); <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>= (uint8)b;
00267 }
00268
00269
00270
00271 <font class="comment">// @}</font>
00272
00274
00275
00284 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z322_0">addColors</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *dest, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *src1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *src2, uint numColors, uint srcStride = <font class="keyword">sizeof</font>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>), uint destStride = <font class="keyword">sizeof</font>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>), uint dup = 1);
00285
00293 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z322_1">modulateColors</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *dest, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *src1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *src2, uint numColors, uint srcStride = <font class="keyword">sizeof</font>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>), uint destStride = <font class="keyword">sizeof</font>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>), uint dup = 1);
00294
00302 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z322_2">subtractColors</a>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *dest, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *src1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> *src2, uint numColors, uint srcStride = <font class="keyword">sizeof</font>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>), uint destStride = <font class="keyword">sizeof</font>(<a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a>), uint dup = 1);
00304
00306
00307
00312 <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z323_0">convertToHLS</a>(<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> &S) <font class="keyword">const</font>;
00313
00317 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBA.html#z323_1">buildFromHLS</a>(<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>);
00319
00320
00321
<a name="l00323"></a><a class="code" href="classNLMISC_1_1CRGBA.html#m0">00323</a> uint8 <a class="code" href="classNLMISC_1_1CRGBA.html#m0">R</a>;
<a name="l00325"></a><a class="code" href="classNLMISC_1_1CRGBA.html#m1">00325</a> uint8 <a class="code" href="classNLMISC_1_1CRGBA.html#m1">G</a>;
<a name="l00327"></a><a class="code" href="classNLMISC_1_1CRGBA.html#m2">00327</a> uint8 <a class="code" href="classNLMISC_1_1CRGBA.html#m2">B</a>;
<a name="l00329"></a><a class="code" href="classNLMISC_1_1CRGBA.html#m3">00329</a> uint8 <a class="code" href="classNLMISC_1_1CRGBA.html#m3">A</a>;
00330
00331
00333 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p0">Black</a> ;
00334 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p1">Red</a> ;
00335 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p2">Green</a> ;
00336 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p3">Yellow</a> ;
00337 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p4">Blue</a> ;
00338 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p5">Magenta</a> ;
00339 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p6">Cyan</a> ;
00340 <font class="keyword">static</font> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html#a0">CRGBA</a> <a class="code" href="classNLMISC_1_1CRGBA.html#p7">White</a> ;
00341 };
00342
00343
<a name="l00350"></a><a class="code" href="classNLMISC_1_1CBGRA.html">00350</a> <font class="keyword">class </font>CBGRA
00351 {
00352 <font class="keyword">public</font>:
00353
<a name="l00355"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a0">00355</a> <a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a>() {};
00356
<a name="l00361"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a1">00361</a> <a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a>(CRGBA c)
00362 {
00363 <a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a>=c.R;
00364 <a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a>=c.G;
00365 <a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a>=c.B;
00366 <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>=c.A;
00367 };
00368
<a name="l00376"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a2">00376</a> <a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a>(uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, uint8 g, uint8 b, uint8 a=255) :
00377 <a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>), <a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a>(g), <a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a>(b), <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>(a) {}
00378
<a name="l00382"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a3">00382</a> <a class="code" href="classNLMISC_1_1CBGRA.html#a3">operator CRGBA</a>()
00383 {
00384 <font class="keywordflow">return</font> CRGBA (<a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a>, <a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a>, <a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a>, <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>);
00385 }
00386
<a name="l00390"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a4">00390</a> uint <a class="code" href="classNLMISC_1_1CBGRA.html#a4">getPacked</a>()<font class="keyword"> const </font>
00391 <font class="keyword"> </font>{
00392 <font class="keywordflow">return</font> ((uint)<a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a><<24) + ((uint)<a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a><<16) + ((uint)<a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a><<8) + <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>;
00393 }
00394
<a name="l00398"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a5">00398</a> <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a5">operator<</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a> &c)<font class="keyword"> const </font>
00399 <font class="keyword"> </font>{
00400 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a4">getPacked</a>()<c.getPacked();
00401 }
00402
<a name="l00406"></a><a class="code" href="classNLMISC_1_1CBGRA.html#a6">00406</a> <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a6">operator==</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a> &c)<font class="keyword"> const </font>
00407 <font class="keyword"> </font>{
00408 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a>==c.R && <a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a>==c.G && <a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a>==c.B && <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>==c.A;
00409 }
00410
00415 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a7">serial</a>(<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f);
00416
00423 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a8">blendFromui</a>(<a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a> &c0, <a class="code" href="classNLMISC_1_1CBGRA.html#a0">CBGRA</a> &c1, uint factor);
00424
00432 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBGRA.html#a9">set</a>(uint8 <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, uint8 g, uint8 b, uint8 a);
00433
<a name="l00435"></a><a class="code" href="classNLMISC_1_1CBGRA.html#m0">00435</a> uint8 <a class="code" href="classNLMISC_1_1CBGRA.html#m0">R</a>;
<a name="l00437"></a><a class="code" href="classNLMISC_1_1CBGRA.html#m1">00437</a> uint8 <a class="code" href="classNLMISC_1_1CBGRA.html#m1">G</a>;
<a name="l00439"></a><a class="code" href="classNLMISC_1_1CBGRA.html#m2">00439</a> uint8 <a class="code" href="classNLMISC_1_1CBGRA.html#m2">B</a>;
<a name="l00441"></a><a class="code" href="classNLMISC_1_1CBGRA.html#m3">00441</a> uint8 <a class="code" href="classNLMISC_1_1CBGRA.html#m3">A</a>;
00442 };
00443
00444
<a name="l00451"></a><a class="code" href="classNLMISC_1_1CRGBAF.html">00451</a> <font class="keyword">class </font>CRGBAF
00452 {
00453 <font class="keyword">public</font>:
00455 CRGBAF ()
00456 {}
00457
00465 CRGBAF (<font class="keywordtype">float</font> _r, <font class="keywordtype">float</font> _g, <font class="keywordtype">float</font> _b, <font class="keywordtype">float</font> _a=1.f)
00466 {
00467 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>=_r;
00468 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>=_g;
00469 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>=_b;
00470 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>=_a;
00471 }
00472
00477 CRGBAF (CRGBA c)
00478 {
00479 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>=(float)c.R/255.f;
00480 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>=(float)c.G/255.f;
00481 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>=(float)c.B/255.f;
00482 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>=(float)c.A/255.f;
00483 }
00484
00488 operator CRGBA()<font class="keyword"> const</font>
00489 <font class="keyword"> </font>{
00490 uint8 _r=(uint8)(<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>*255.f);
00491 uint8 _g=(uint8)(<a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>*255.f);
00492 uint8 _b=(uint8)(<a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>*255.f);
00493 uint8 _a=(uint8)(<a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>*255.f);
00494 <font class="keywordflow">return</font> CRGBA (_r, _g, _b, _a);
00495 }
00496
00500 <font class="keywordtype">void</font> normalize ()
00501 {
00502 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>= (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>>1.f) ? 1.f : (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a><0.f) ? 0.f : <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>;
00503 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>= (<a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>>1.f) ? 1.f : (<a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a><0.f) ? 0.f : <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>;
00504 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>= (<a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>>1.f) ? 1.f : (<a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a><0.f) ? 0.f : <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>;
00505 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>= (<a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>>1.f) ? 1.f : (<a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a><0.f) ? 0.f : <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>;
00506 }
00507
00513 CRGBAF <a class="code" href="ucstring_8h.html#a6">operator+ </a>(<font class="keyword">const</font> CRGBAF& c)<font class="keyword"> const</font>
00514 <font class="keyword"> </font>{
00515 <font class="keywordflow">return</font> CRGBAF (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>+c.R, <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>+c.G, <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>+c.B, <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>+c.A);
00516 }
00517
00523 CRGBAF operator- (<font class="keyword">const</font> CRGBAF& c)<font class="keyword"> const</font>
00524 <font class="keyword"> </font>{
00525 <font class="keywordflow">return</font> CRGBAF (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>-c.R, <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>-c.G, <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>-c.B, <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>-c.A);
00526 }
00527
00533 CRGBAF <a class="code" href="namespaceNLMISC.html#a273">operator* </a>(<font class="keyword">const</font> CRGBAF& c)<font class="keyword"> const</font>
00534 <font class="keyword"> </font>{
00535 <font class="keywordflow">return</font> CRGBAF (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>*c.R, <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>*c.G, <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>*c.B, <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>*c.A);
00536 }
00537
00543 CRGBAF <a class="code" href="namespaceNLMISC.html#a273">operator* </a>(<font class="keywordtype">float</font> f)<font class="keyword"> const</font>
00544 <font class="keyword"> </font>{
00545 <font class="keywordflow">return</font> CRGBAF (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>*f, <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>*f, <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>*f, <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>*f);
00546 }
00547
00553 CRGBAF operator/ (<font class="keywordtype">float</font> f)<font class="keyword"> const</font>
00554 <font class="keyword"> </font>{
00555 <font class="keywordflow">return</font> CRGBAF (<a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>/f, <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>/f, <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>/f, <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>/f);
00556 }
00557
00563 CRGBAF& operator+= (<font class="keyword">const</font> CRGBAF& c)
00564 {
00565 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>+=c.R;
00566 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>+=c.G;
00567 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>+=c.B;
00568 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>+=c.A;
00569 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00570 }
00571
00577 CRGBAF& operator-= (<font class="keyword">const</font> CRGBAF& c)
00578 {
00579 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>-=c.R;
00580 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>-=c.G;
00581 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>-=c.B;
00582 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>-=c.A;
00583 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00584 }
00585
00591 CRGBAF& operator*= (<font class="keyword">const</font> CRGBAF& c)
00592 {
00593 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>*=c.R;
00594 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>*=c.G;
00595 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>*=c.B;
00596 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>*=c.A;
00597 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00598 }
00599
00605 CRGBAF& operator*= (<font class="keywordtype">float</font> f)
00606 {
00607 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>*=f;
00608 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>*=f;
00609 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>*=f;
00610 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>*=f;
00611 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00612 }
00613
00619 CRGBAF& operator/= (<font class="keywordtype">float</font> f)
00620 {
00621 <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>/=f;
00622 <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>/=f;
00623 <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>/=f;
00624 <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>/=f;
00625 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00626 }
00627
00632 <font class="keywordtype">void</font> serial(<font class="keyword">class</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f);
00633
00641 <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CRGBAF.html#a0">set</a>(<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);
00642
<a name="l00644"></a><a class="code" href="classNLMISC_1_1CRGBAF.html#m0">00644</a> <font class="keywordtype">float</font> <a class="code" href="classNLMISC_1_1CRGBAF.html#m0">R</a>;
<a name="l00646"></a><a class="code" href="classNLMISC_1_1CRGBAF.html#m1">00646</a> <font class="keywordtype">float</font> <a class="code" href="classNLMISC_1_1CRGBAF.html#m1">G</a>;
<a name="l00648"></a><a class="code" href="classNLMISC_1_1CRGBAF.html#m2">00648</a> <font class="keywordtype">float</font> <a class="code" href="classNLMISC_1_1CRGBAF.html#m2">B</a>;
<a name="l00650"></a><a class="code" href="classNLMISC_1_1CRGBAF.html#m3">00650</a> <font class="keywordtype">float</font> <a class="code" href="classNLMISC_1_1CRGBAF.html#m3">A</a>;
00651 };
00652
00658 <font class="keyword">inline</font> CRGBAF <a class="code" href="namespaceNLMISC.html#a273">operator* </a>(<font class="keywordtype">float</font> f, <font class="keyword">const</font> CRGBAF& c)
00659 {
00660 <font class="keywordflow">return</font> CRGBAF (c.R*f, c.G*f, c.B*f, c.A*f);
00661 }
00662
00663 } <font class="comment">// NLMISC</font>
00664
00665
00666 <font class="preprocessor">#endif // NL_RGBA_H</font>
00667 <font class="preprocessor"></font>
00668 <font class="comment">/* End of rgba.h */</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|