aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/bitmap_8h-source.html
blob: d863696234a9b7d0b3597e4d3c889f7c8595e2a1 (plain)
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
<!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>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</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>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</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>
&nbsp;

<!-- 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>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <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> &nbsp; </center>
<hr><h1>bitmap.h</h1><a href="bitmap_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_BITMAP_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_BITMAP_H</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#ifdef USE_JPEG</font>
00030 <font class="preprocessor"></font><font class="preprocessor">#define XMD_H</font>
00031 <font class="preprocessor"></font><font class="preprocessor">#undef FAR</font>
00032 <font class="preprocessor"></font><font class="keyword">extern</font> <font class="stringliteral">"C"</font>
00033 {
00034 <font class="preprocessor">#include &lt;jpeglib.h&gt;</font>
00035 }
00036 <font class="preprocessor">#endif // USE_JPEG</font>
00037 <font class="preprocessor"></font>
00038 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00039 <font class="preprocessor">#include "<a class="code" href="rgba_8h.html">nel/misc/rgba.h</a>"</font>
00040 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
00041 <font class="preprocessor">#include &lt;vector&gt;</font>
00042 
00043 
00044 <font class="keyword">namespace </font>NLMISC 
00045 {
00046 
00047 
00048 <font class="keyword">class </font>IStream;
00049 
00050 <font class="comment">//------------------ DDS STUFFS --------------------</font>
00051 
00052 <font class="preprocessor">#ifndef NL_MAKEFOURCC</font>
<a name="l00053"></a><a class="code" href="bitmap_8h.html#a0">00053</a> <font class="preprocessor"></font><font class="preprocessor">    #define NL_MAKEFOURCC(ch0, ch1, ch2, ch3)                              \</font>
00054 <font class="preprocessor">                ((uint32)(uint8)(ch0) | ((uint32)(uint8)(ch1) &lt;&lt; 8) |   \</font>
00055 <font class="preprocessor">                ((uint32)(uint8)(ch2) &lt;&lt; 16) | ((uint32)(uint8)(ch3) &lt;&lt; 24 ))</font>
00056 <font class="preprocessor"></font><font class="preprocessor">#endif </font>
00057 <font class="preprocessor"></font>
00058 <font class="keyword">const</font> uint32    <a class="code" href="namespaceNLMISC.html#a2">DDS</a> = <a class="code" href="bitmap_8h.html#a0">NL_MAKEFOURCC</a>(<font class="charliteral">'D'</font>, <font class="charliteral">'D'</font>, <font class="charliteral">'S'</font>, <font class="charliteral">' '</font>);
00059 <font class="keyword">const</font> uint32    <a class="code" href="namespaceNLMISC.html#a3">DXT_</a> = <a class="code" href="bitmap_8h.html#a0">NL_MAKEFOURCC</a>(<font class="charliteral">'D'</font>,<font class="charliteral">'X'</font>, <font class="charliteral">'T'</font>, <font class="charliteral">'\0'</font>);
00060 
00061 
00062 <font class="comment">// dwLinearSize is valid</font>
<a name="l00063"></a><a class="code" href="bitmap_8h.html#a1">00063</a> <font class="preprocessor">#define DDSD_LINEARSIZE         0x00080000l</font>
00064 <font class="preprocessor"></font>
00065 
00066 <font class="comment">//---------------- END OF DDS STUFFS ------------------</font>
00067 
00068 
00069 <font class="keyword">const</font> uint8     <a class="code" href="namespaceNLMISC.html#a4">MAX_MIPMAP</a> = 16;
00070 
00071 
00072 
00073 
00074 
00082 <font class="comment">/* *** IMPORTANT ********************</font>
00083 <font class="comment"> * *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL</font>
00084 <font class="comment"> * **********************************</font>
00085 <font class="comment"> */</font>
<a name="l00086"></a><a class="code" href="classNLMISC_1_1CBitmap.html">00086</a> <font class="keyword">class </font>CBitmap
00087 {
00088 <font class="keyword">protected</font> :
<a name="l00089"></a><a class="code" href="classNLMISC_1_1CBitmap.html#n0">00089</a>         std::vector&lt;uint8&gt; <a class="code" href="classNLMISC_1_1CBitmap.html#n0">_Data</a>[<a class="code" href="namespaceNLMISC.html#a4">MAX_MIPMAP</a>];
00090 
00091         <font class="comment">// The number of mipmaps. base image IS a mipmap. 1 means a base image with no mipmaping.</font>
<a name="l00092"></a><a class="code" href="classNLMISC_1_1CBitmap.html#n1">00092</a>         uint8   <a class="code" href="classNLMISC_1_1CBitmap.html#n1">_MipMapCount</a>;
<a name="l00093"></a><a class="code" href="classNLMISC_1_1CBitmap.html#n2">00093</a>         <font class="keywordtype">bool</font>    <a class="code" href="classNLMISC_1_1CBitmap.html#n2">_LoadGrayscaleAsAlpha</a>;
<a name="l00094"></a><a class="code" href="classNLMISC_1_1CBitmap.html#n3">00094</a>         uint32  <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>;
<a name="l00095"></a><a class="code" href="classNLMISC_1_1CBitmap.html#n4">00095</a>         uint32  <a class="code" href="classNLMISC_1_1CBitmap.html#n4">_Height</a>;
00096 
00097 <font class="keyword">private</font> :
00098         
00099 
00106         uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#c0">blend</a>(uint32 &amp;n0, uint32 &amp;n1, uint32 coef0);
00107 
00108 
00117         uint8 <a class="code" href="classNLMISC_1_1CBitmap.html#c1">readDDS</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint mipMapSkip);
00118 
00119 
00126         uint8 <a class="code" href="classNLMISC_1_1CBitmap.html#c2">readTGA</a>(  <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f);
00127 
00128 
00129 
00143 
00144         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_0">convertToDXTC5</a>();
00145 
00146         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_1">convertToRGBA</a>();
00147         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_2">luminanceToRGBA</a>();
00148         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_3">alphaToRGBA</a>();
00149         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_4">alphaLuminanceToRGBA</a>();
00150         
00151         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_5">convertToLuminance</a>();
00152         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_6">rgbaToLuminance</a>();
00153         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_7">alphaToLuminance</a>();
00154         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_8">alphaLuminanceToLuminance</a>();
00155         
00156         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_9">convertToAlpha</a>();
00157         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_10">rgbaToAlpha</a>();
00158         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_11">luminanceToAlpha</a>();
00159         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_12">alphaLuminanceToAlpha</a>();
00160 
00161         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_13">convertToAlphaLuminance</a>();
00162         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_14">rgbaToAlphaLuminance</a>();
00163         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_15">luminanceToAlphaLuminance</a>();
00164         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#z275_16">alphaToAlphaLuminance</a>();
00165         
00167 
00172         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#c3">decompressDXT1</a>(<font class="keywordtype">bool</font> <a class="code" href="driver__opengl__extension__def_8h.html#a420">alpha</a>);
00173 
00178         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#c4">decompressDXT3</a>();
00179 
00180 
00185         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#c5">decompressDXT5</a>();
00186 
00187 
00193         <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#f0">uncompress</a>(uint16 color, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> &amp;);
00194 
00195 
00205         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#c6">resamplePicture32</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *pSrc, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> *pDest, 
00206                                                          sint32 nSrcWidth, sint32 nSrcHeight, 
00207                                                          sint32 nDestWidth, sint32 nDestHeight);
00208 
00209 
00214         <font class="keywordtype">float</font> <a class="code" href="classNLMISC_1_1CBitmap.html#c7">getColorInterp</a> (<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, <font class="keywordtype">float</font> xy00, <font class="keywordtype">float</font> xy01, <font class="keywordtype">float</font> xy10, <font class="keywordtype">float</font> xy11) <font class="keyword">const</font>;
00215 
00216         
00218 
00219                 <font class="keyword">static</font> CRGBA <a class="code" href="classNLMISC_1_1CBitmap.html#z276_3">getDXTCColorFromBlock</a>(<font class="keyword">const</font> uint8 *block, sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>);
00220                 CRGBA <a class="code" href="classNLMISC_1_1CBitmap.html#z276_0">getDXTC1Texel</a>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, uint32 numMipMap) <font class="keyword">const</font>;
00221                 CRGBA <a class="code" href="classNLMISC_1_1CBitmap.html#z276_1">getDXTC3Texel</a>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, uint32 numMipMap) <font class="keyword">const</font>;
00222                 CRGBA <a class="code" href="classNLMISC_1_1CBitmap.html#z276_2">getDXTC5Texel</a>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, uint32 numMipMap) <font class="keyword">const</font>;
00224 
00225 
00226         CRGBA <a class="code" href="classNLMISC_1_1CBitmap.html#c8">CBitmap::getRGBAPixel</a>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, uint32 numMipMap <font class="comment">/*=0*/</font>) <font class="keyword">const</font>;
00227 
00228 
00229 
00230 
00231 <font class="keyword">public</font>:
00232 
<a name="l00233"></a><a class="code" href="classNLMISC_1_1CBitmap.html#s11">00233</a>         <font class="keyword">enum</font> <a class="code" href="classNLMISC_1_1CBitmap.html#s11">TType</a> 
00234         { 
00235                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s0">RGBA</a>=0,
00236                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s1">Luminance</a>,
00237                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s2">Alpha</a>,
00238                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s3">AlphaLuminance</a>,
00239                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s4">DXTC1</a>,
00240                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s5">DXTC1Alpha</a>,
00241                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s6">DXTC3</a>,
00242                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s7">DXTC5</a>,
00243                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s8">DsDt</a>,
00244                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s9">ModeCount</a>,
00245                 <a class="code" href="classNLMISC_1_1CBitmap.html#s11s10">DonTKnow</a>=0xffffffff
00246         } <a class="code" href="classNLMISC_1_1CBitmap.html#m0">PixelFormat</a>;
00247 
00248         <font class="keyword">static</font> <font class="keyword">const</font> uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#p0">bitPerPixels</a>[<a class="code" href="classNLMISC_1_1CBitmap.html#s11s9">ModeCount</a>];
00249         <font class="keyword">static</font> <font class="keyword">const</font> uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#p1">DXTC1HEADER</a>;
00250         <font class="keyword">static</font> <font class="keyword">const</font> uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#p2">DXTC3HEADER</a>;
00251         <font class="keyword">static</font> <font class="keyword">const</font> uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#p3">DXTC5HEADER</a>;
00252 
<a name="l00253"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a0">00253</a>         <a class="code" href="classNLMISC_1_1CBitmap.html#a0">CBitmap</a>()
00254         {
00255                 <a class="code" href="classNLMISC_1_1CBitmap.html#n1">_MipMapCount</a> = 1;
00256                 <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a> = 0;
00257                 <a class="code" href="classNLMISC_1_1CBitmap.html#n4">_Height</a> = 0;
00258                 <a class="code" href="classNLMISC_1_1CBitmap.html#m0">PixelFormat</a> = <a class="code" href="classNLMISC_1_1CBitmap.html#s11s0">RGBA</a>;
00259                 <a class="code" href="classNLMISC_1_1CBitmap.html#n2">_LoadGrayscaleAsAlpha</a> = <font class="keyword">true</font>;
00260         }
00261 
<a name="l00262"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a1">00262</a>         <font class="keyword">virtual</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a1">~CBitmap</a>() { }
00263 
00273         uint8   <a class="code" href="classNLMISC_1_1CBitmap.html#a2">load</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint mipMapSkip=0);
00274 
00275 
00286         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CBitmap.html#d0">loadSize</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>);
00287 
00288 
00292         <font class="keyword">static</font> <font class="keywordtype">void</font>             <a class="code" href="classNLMISC_1_1CBitmap.html#d0">loadSize</a>(<font class="keyword">const</font> std::string &amp;path, uint32 &amp;retWidth, uint32 &amp;retHeight);
00293 
00294 
00298         <font class="keywordtype">void</font>    <a class="code" href="classNLMISC_1_1CBitmap.html#a3">makeDummy</a>();
00299 
00300 
00306 
<a name="l00307"></a><a class="code" href="classNLMISC_1_1CBitmap.html#z277_0">00307</a>         std::vector&lt;uint8&gt;&amp; <a class="code" href="classNLMISC_1_1CBitmap.html#z277_0">getPixels</a>(uint32 numMipMap = 0) 
00308         { 
00309                 <font class="comment">//nlassert (numMipMap&lt;=_MipMapCount);</font>
00310                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBitmap.html#n0">_Data</a>[numMipMap];
00311         }
<a name="l00312"></a><a class="code" href="classNLMISC_1_1CBitmap.html#z277_1">00312</a>         <font class="keyword">const</font> std::vector&lt;uint8&gt;&amp; <a class="code" href="classNLMISC_1_1CBitmap.html#z277_0">getPixels</a>(uint32 numMipMap = 0)<font class="keyword"> const</font>
00313 <font class="keyword">        </font>{
00314                 <font class="comment">//nlassert (numMipMap&lt;=_MipMapCount);</font>
00315                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBitmap.html#n0">_Data</a>[numMipMap]; 
00316         }
00318         
00319         
00326         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a4">convertToType</a> (<a class="code" href="classNLMISC_1_1CBitmap.html#s11">TType</a> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>);
00327 
00328 
00329 
<a name="l00334"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a5">00334</a>         <a class="code" href="classNLMISC_1_1CBitmap.html#s11">TType</a> <a class="code" href="classNLMISC_1_1CBitmap.html#a5">getPixelFormat</a>()<font class="keyword"> const</font>
00335 <font class="keyword">        </font>{
00336                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBitmap.html#m0">PixelFormat</a>; 
00337         }
00338 
00339 
00345         <font class="keyword">virtual</font> uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#a6">getWidth</a>(uint32 numMipMap = 0) <font class="keyword">const</font>;
00346 
00347 
00353         <font class="keyword">virtual</font> uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#a7">getHeight</a>(uint32 numMipMap = 0) <font class="keyword">const</font>;
00354 
00355 
00361         uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#a8">getSize</a>(uint32 numMipMap = 0) <font class="keyword">const</font>;
00362 
00363 
<a name="l00368"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a9">00368</a>         uint32 <a class="code" href="classNLMISC_1_1CBitmap.html#a9">getMipMapCount</a>()<font class="keyword"> const</font>
00369 <font class="keyword">        </font>{
00370                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBitmap.html#n1">_MipMapCount</a>; 
00371         }
00372 
00373 
00379         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a10">rotateCCW</a>();
00380 
00386         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a11">buildMipMaps</a>();
00387 
00393         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a12">releaseMipMaps</a>();
00394 
00400         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a13">reset</a>(<a class="code" href="classNLMISC_1_1CBitmap.html#s11">TType</a> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>=<a class="code" href="classNLMISC_1_1CBitmap.html#s11s0">RGBA</a>);
00401         
00402                 
00409         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a14">resample</a> (sint32 nNewWidth, sint32 nNewHeight);
00410         
00411                 
00420         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a15">resize</a> (sint32 nNewWidth, sint32 nNewHeight, <a class="code" href="classNLMISC_1_1CBitmap.html#s11">TType</a> newType=<a class="code" href="classNLMISC_1_1CBitmap.html#s11s10">DonTKnow</a>);
00421 
00422 
00432         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a16">resizeMipMap</a> (uint32 numMipMap, sint32 nNewWidth, sint32 nNewHeight);
00433 
00434 
00439         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a17">setMipMapCount</a>(uint32 mmc);
00440 
00441 
00451         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a18">writeTGA</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint32 d, <font class="keywordtype">bool</font> upsideDown = <font class="keyword">false</font>);
00452 
00461         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a19">writeJPG</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint8 quality = 80);
00462 
<a name="l00469"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a20">00469</a>         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a20">loadGrayscaleAsAlpha</a> (<font class="keywordtype">bool</font> loadAsAlpha)
00470         {
00471                 <a class="code" href="classNLMISC_1_1CBitmap.html#n2">_LoadGrayscaleAsAlpha</a>=loadAsAlpha;
00472         }
00473 
00474 
<a name="l00480"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a21">00480</a>         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a21">isGrayscaleAsAlpha</a> ()<font class="keyword"> const</font>
00481 <font class="keyword">        </font>{
00482                 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CBitmap.html#n2">_LoadGrayscaleAsAlpha</a>;
00483         }
00484 
00485 
00494         <font class="keywordtype">bool</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a22">blit</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a0">CBitmap</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>) ;
00495 
00496 
00502         CRGBAF <a class="code" href="classNLMISC_1_1CBitmap.html#a23">getColor</a> (<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>) <font class="keyword">const</font>;
00503 
00504 
00509         CRGBA  <a class="code" href="classNLMISC_1_1CBitmap.html#a24">getPixelColor</a>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, uint32 numMipMap = 0) <font class="keyword">const</font>;
00513         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a25">flipH</a>();
00514 
00515 
00519         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a26">flipV</a>();
00520 
00524         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a27">rot90CW</a>();
00525 
00529         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a28">rot90CCW</a>();
00530 
00538         <font class="keywordtype">void</font> <a class="code" href="classNLMISC_1_1CBitmap.html#c0">blend</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a0">CBitmap</a> &amp;Bm0, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CBitmap.html#a0">CBitmap</a> &amp;Bm1, uint16 factor);
00539 
00540 };
00541 
00542 
00543 
00544 
00545 <font class="preprocessor">#ifdef USE_JPEG</font>
00546 <font class="preprocessor"></font>
00547 <font class="keyword">extern</font> <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> *<a class="code" href="namespaceNLMISC.html#a185">JPGStream</a>;
00548 <font class="keyword">extern</font> <font class="keyword">const</font> uint32 <a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a> = 1000;
00549 <font class="keyword">extern</font> <font class="keywordtype">char</font> <a class="code" href="namespaceNLMISC.html#a187">JPGBuffer</a>[<a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a>];
00550 
00551 <font class="keyword">static</font> <font class="keywordtype">void</font> jpgCompressInit(j_compress_ptr cinfo)
00552 {
00553         cinfo-&gt;dest-&gt;next_output_byte = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *)<a class="code" href="namespaceNLMISC.html#a187">JPGBuffer</a>;
00554         cinfo-&gt;dest-&gt;free_in_buffer = <a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a>;
00555 }
00556 
00557 <font class="keyword">static</font> boolean jpgCompressEmpty(j_compress_ptr cinfo)
00558 {
00559         JPGStream-&gt;<a class="code" href="classNLMISC_1_1IStream.html#z327_0">serialBuffer</a>((uint8*) <a class="code" href="namespaceNLMISC.html#a187">JPGBuffer</a>, <a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a>);
00560         cinfo-&gt;dest-&gt;next_output_byte = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *)<a class="code" href="namespaceNLMISC.html#a187">JPGBuffer</a>;
00561         cinfo-&gt;dest-&gt;free_in_buffer = <a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a>;
00562         <font class="keywordflow">return</font> TRUE;
00563 }
00564 
00565 <font class="keyword">static</font> <font class="keywordtype">void</font> jpgCompressTerm(j_compress_ptr cinfo)
00566 {
00567         <font class="keywordflow">if</font>(<a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a> - cinfo-&gt;dest-&gt;free_in_buffer &gt; 0)
00568                 JPGStream-&gt;<a class="code" href="classNLMISC_1_1IStream.html#z327_0">serialBuffer</a>((uint8*) <a class="code" href="namespaceNLMISC.html#a187">JPGBuffer</a>, <a class="code" href="namespaceNLMISC.html#a186">JPGBufferSize</a> - cinfo-&gt;dest-&gt;free_in_buffer);
00569 }
00570 
00571 <font class="keyword">static</font> jpeg_destination_mgr jpgDestinationManager = { 0, 0, jpgCompressInit, jpgCompressEmpty, jpgCompressTerm };
00572 
00573 <font class="keyword">inline</font> <font class="keywordtype">bool</font> CBitmap::writeJPG( <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint8 quality)
00574 {
00575         <font class="keywordflow">if</font> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) <font class="keywordflow">return</font> <font class="keyword">false</font>;
00576         <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CBitmap.html#m0">PixelFormat</a> != <a class="code" href="classNLMISC_1_1CBitmap.html#s11s0">RGBA</a>) <font class="keywordflow">return</font> <font class="keyword">false</font>;
00577         
00578         JPGStream = &amp;f;
00579         
00580         <font class="keyword">struct </font>jpeg_compress_struct cinfo;
00581         <font class="keyword">struct </font>jpeg_error_mgr jerr;
00582         cinfo.err = jpeg_std_error(&amp;jerr);
00583         jpeg_create_compress(&amp;cinfo);
00584         
00585         cinfo.image_width = <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>;     <font class="comment">/* image width and height, in pixels */</font>
00586         cinfo.image_height = <a class="code" href="classNLMISC_1_1CBitmap.html#n4">_Height</a>;
00587         cinfo.input_components = 3;             <font class="comment">/* # of color components per pixel */</font>
00588         cinfo.in_color_space = JCS_RGB;         <font class="comment">/* colorspace of input image */</font>
00589         cinfo.dest = &amp;jpgDestinationManager;
00590         jpeg_set_defaults(&amp;cinfo);
00591         jpeg_set_quality(&amp;cinfo, quality, TRUE <font class="comment">/* limit to baseline-JPEG values */</font>);
00592         jpeg_start_compress(&amp;cinfo, TRUE);
00593         
00594         JSAMPROW row_pointer[1];
00595         row_pointer[0] = <font class="keyword">new</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font>[<a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>*3];
00596         
00597         <font class="keywordflow">while</font> (cinfo.next_scanline &lt; cinfo.image_height)
00598         {
00599                 <font class="keywordflow">for</font> (uint i = 0; i &lt; <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>; i++)
00600                 {
00601                         row_pointer[0][i*3+0] = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font>) <a class="code" href="classNLMISC_1_1CBitmap.html#n0">_Data</a>[0][cinfo.next_scanline * <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>*4 + i*4+0];
00602                         row_pointer[0][i*3+1] = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font>) <a class="code" href="classNLMISC_1_1CBitmap.html#n0">_Data</a>[0][cinfo.next_scanline * <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>*4 + i*4+1];
00603                         row_pointer[0][i*3+2] = (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font>) <a class="code" href="classNLMISC_1_1CBitmap.html#n0">_Data</a>[0][cinfo.next_scanline * <a class="code" href="classNLMISC_1_1CBitmap.html#n3">_Width</a>*4 + i*4+2];
00604                 }
00605                 (void) jpeg_write_scanlines(&amp;cinfo, row_pointer, 1);
00606         }
00607         jpeg_finish_compress(&amp;cinfo);
00608         jpeg_destroy_compress(&amp;cinfo);
00609         <font class="keyword">delete</font> row_pointer[0];
00610         row_pointer[0] = NULL;
00611         JPGStream = NULL;
00612         
00613         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00614 }
00615 <font class="preprocessor">#else // USE_JPEG</font>
<a name="l00616"></a><a class="code" href="classNLMISC_1_1CBitmap.html#a19">00616</a> <font class="preprocessor"></font><font class="keyword">inline</font> <font class="keywordtype">bool</font> CBitmap::writeJPG( <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f, uint8 quality)
00617 {
00618         <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"You must put #define USE_JPEG before all include in the file where you call writeJPG() if you want jpeg support"</font>);
00619 }
00620 <font class="preprocessor">#endif // USE_JPEG</font>
00621 <font class="preprocessor"></font>
00622 
00623 
00624 
00625 } <font class="comment">// NLMISC</font>
00626 
00627 
00628 <font class="preprocessor">#endif // NL_BITMAP_H</font>
00629 <font class="preprocessor"></font>
00630 <font class="comment">/* End of bitmap.h */</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </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>