aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02513.html
blob: fdf57186c04511c21270436e51eea538b721d5bd (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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NL3D::CFastHLSModifier class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CFastHLSModifier Class Reference</h1><code>#include &lt;<a class="el" href="a05707.html">fasthls_modifier.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Singleton. allow to apply HLS coloring as fast as possible (MMX...). <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2002 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a05707.html#l00049">49</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a9">uint16</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a> (<a class="el" href="a04558.html#a9">uint16</a> colorIn, <a class="el" href="a04558.html#a7">uint8</a> dHue, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera1">convert</a> (<a class="el" href="a04558.html#a15">uint</a> H, <a class="el" href="a04558.html#a15">uint</a> L, <a class="el" href="a04558.html#a15">uint</a> S)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">convert a HLS (0..255) to a RGBA.  <a href="#NL3D_1_1CFastHLSModifiera1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera2">convertDDSBitmap</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a14">sint</a> dl, <a class="el" href="a04558.html#a14">sint</a> ds)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">convert a DDS bitmap into another DDS, with HLS decal (0..255, -255..+255, -255..+255).  <a href="#NL3D_1_1CFastHLSModifiera2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiera3">convertRGBABitmap</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a14">sint</a> dl, <a class="el" href="a04558.html#a14">sint</a> ds)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255).  <a href="#NL3D_1_1CFastHLSModifiera3"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02513.html">CFastHLSModifier</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiere0">getInstance</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">get the singleton  <a href="#NL3D_1_1CFastHLSModifiere0"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Private Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom>{ <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a> =  256
 }</td></tr>

<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierd0">CFastHLSModifier</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#NL3D_1_1CFastHLSModifierd0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierd1">convertDDSBitmapDXTC1Or1A</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierd2">convertDDSBitmapDXTC3Or5</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;dst, const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;<a class="el" href="a04223.html#a652">src</a>, <a class="el" href="a04558.html#a7">uint8</a> dh, <a class="el" href="a04558.html#a15">uint</a> dLum, <a class="el" href="a04558.html#a15">uint</a> dSat)</td></tr>

<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02514.html">CHLSA</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a> [65536]</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr1">_HueTable</a> [HueTableSize]</td></tr>

<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02513.html">CFastHLSModifier</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a> = NULL</td></tr>

</table>
<hr><h2>Member Enumeration Documentation</h2>
<a class="anchor" name="NL3D_1_1CFastHLSModifiery0" doxytag="NL3D::CFastHLSModifier::@11" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> anonymous enum<code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<dl compact><dt><b>Enumeration values: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em><a class="anchor" name="NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1" doxytag="HueTableSize" ></a>HueTableSize</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>

<p>
Definition at line <a class="el" href="a05707.html#l00078">78</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>.
<p>
<div class="fragment"><pre>00078 {<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a>= 256};
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CFastHLSModifierd0" doxytag="NL3D::CFastHLSModifier::CFastHLSModifier" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CFastHLSModifier::CFastHLSModifier </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [private]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. 
<p>

<p>
Definition at line <a class="el" href="a05706.html#l00047">47</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05707.html#l00085">_Color16ToHLS</a>, <a class="el" href="a05707.html#l00084">_HueTable</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::A</a>, <a class="el" href="a06339.html#l00686">NLMISC::CRGBA::buildFromHLS()</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06339.html#l00609">NLMISC::CRGBA::convertToHLS()</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::H</a>, <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::L</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::S</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06340.html#l00162">NLMISC::CRGBA::set565()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
<div class="fragment"><pre>00048 {
00049         <a class="code" href="a04558.html#a15">uint</a> i;
00050         <span class="comment">// build the HueTable.</span>
00051         <span class="keywordflow">for</span>(i=0;i&lt;<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiery0NL3D_1_1CFastHLSModifiery1">HueTableSize</a>;i++)
00052         {
00053                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr1">_HueTable</a>[i].<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2026_0">buildFromHLS</a>(360.0f*i/HueTableSize, 0.5f, 1);
00054         }
00055         <span class="comment">// build conversion from uint16 to HLS.</span>
00056         <span class="keywordflow">for</span>(i=0;i&lt;65536;i++)
00057         {
00058                 <a class="code" href="a03337.html">CRGBA</a>   col;
00059                 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAa15">set565</a>(i);
00060                 <span class="keywordtype">float</span>   h,<a class="code" href="a05373.html#a2">l</a>,<a class="code" href="a04223.html#a626">s</a>;
00061                 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2026_1">convertToHLS</a>(h,l,s);
00062                 h= (<span class="keywordtype">float</span>)floor(255*(h/360.f)+0.5f);
00063                 <a class="code" href="a05373.html#a2">l</a>= (<span class="keywordtype">float</span>)floor(255*l+0.5f);
00064                 <a class="code" href="a04223.html#a626">s</a>= (<span class="keywordtype">float</span>)floor(255*s+0.5f);
00065                 <a class="code" href="a05378.html#a374">clamp</a>(h,0,255);
00066                 <a class="code" href="a05378.html#a374">clamp</a>(l,0,255);
00067                 <a class="code" href="a05378.html#a374">clamp</a>(s,0,255);
00068                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo1">H</a>= (<a class="code" href="a04558.html#a7">uint8</a>)h;
00069                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo2">L</a>= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05373.html#a2">l</a>;
00070                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo3">S</a>= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a04223.html#a626">s</a>;
00071                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[i].<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo0">A</a>= 255;
00072         }
00073 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CFastHLSModifiera0" doxytag="NL3D::CFastHLSModifier::applyHLSMod" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> NL3D::CFastHLSModifier::applyHLSMod </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>colorIn</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dHue</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dLum</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dSat</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
convert a uint16 color into the uint16 with HLS decal. WARNING: this code use MMX when possible, but doesn't call emms!!! It is User job to do it. dLum must be actually 0xFFFFFF00 + realDLum (where realDLum== -255..+255) dSat must be actually 0xFFFFFF00 + realDSat (where realDSat== -255..+255)
<p>
Definition at line <a class="el" href="a05706.html#l00110">110</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05707.html#l00085">_Color16ToHLS</a>, <a class="el" href="a05706.html#l00086">convert()</a>, <a class="el" href="a06340.html#l00154">NLMISC::CRGBA::get565()</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::H</a>, <a class="el" href="a06590.html#l00245">INT64_CONSTANT</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::L</a>, <a class="el" href="a05646.html#l00645">offset</a>, <a class="el" href="a05707.html#l00081">NL3D::CFastHLSModifier::CHLSA::S</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l00237">v</a>.
<p>
Referenced by <a class="el" href="a05790.html#l00545">NL3D::CHLSColorTexture::colorizeDXTCBlockRGB()</a>, <a class="el" href="a05706.html#l00252">convertDDSBitmapDXTC1Or1A()</a>, and <a class="el" href="a05706.html#l00354">convertDDSBitmapDXTC3Or5()</a>.
<p>
<div class="fragment"><pre>00111 {
00112         <span class="keyword">static</span>  <a class="code" href="a04558.html#a13">uint64</a>  mmBlank = 0;
00113         <span class="keyword">static</span>  <a class="code" href="a04558.html#a13">uint64</a>  mmOne   = <a class="code" href="a05167.html#a5">INT64_CONSTANT</a>(0x00FF00FF00FF00FF);
00114         <span class="keyword">static</span>  <a class="code" href="a04558.html#a13">uint64</a>  mmGray  = <a class="code" href="a05167.html#a5">INT64_CONSTANT</a>(0x0080008000800080);
00115         <span class="keyword">static</span>  <a class="code" href="a04558.html#a13">uint64</a>  mmInterpBufer[4]= {0,0,0,<a class="code" href="a05167.html#a5">INT64_CONSTANT</a>(0x00FF00FF00FF00FF)};
00116 
00117         <span class="comment">/*</span>
00118 <span class="comment">                dLum is actually 0xFFFFFF00 + realDLum</span>
00119 <span class="comment">                dSat is actually 0xFFFFFF00 + realDSat</span>
00120 <span class="comment">        */</span>
00121 
00122         <a class="code" href="a04558.html#a9">uint16</a>  retVal;
00123 
00124 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00125 <span class="preprocessor"></span>        <span class="keywordflow">if</span>(CSystemInfo::hasMMX())
00126         {
00127                 __asm
00128                 {
00129                         mov                     edi, <a class="code" href="a04223.html#a586">offset</a> mmInterpBufer
00130                         mov                     ecx, <span class="keyword">this</span>
00131 
00132                         <span class="comment">// get HLS in edx.</span>
00133                         mov                     eax, 0
00134                         mov                     ebx, 0
00135                         lea                     esi, [ecx]<span class="keyword">this</span>._Color16ToHLS
00136                         mov                     ax, colorIn
00137                         mov                     edx, [esi+ eax*4]
00138 
00139                         <span class="comment">// apply dh to H (ie dl!). Auto-wrap.</span>
00140                         add                     dl, dHue
00141                         <span class="comment">// get the color into mm0</span>
00142                         mov                     bl, dl
00143                         lea                     esi, [ecx]<span class="keyword">this</span>._HueTable
00144                         movd            mm0, [esi+ ebx*4]
00145                         punpcklbw       mm0, mmBlank
00146 
00147                         <span class="comment">// get L into eax and S into ebx</span>
00148                         mov                     eax, edx
00149                         mov                     ebx, edx
00150                         shr                     eax, 8
00151                         shr                     ebx, 16
00152                         and                     eax, 255
00153                         and                     ebx, 255
00154                         <span class="comment">// add dLum/dSat and clamp to 1.</span>
00155                         add                     eax, dLum
00156                         sbb                     ecx, ecx        <span class="comment">// ecx= FFFFFFFF if carry.</span>
00157                         add                     ebx, dSat
00158                         sbb                     edx, edx
00159                         or                      eax, ecx        <span class="comment">// eax= FFFFFFFF if carry was set</span>
00160                         or                      ebx, edx
00161                         <span class="comment">// add Magic delta, and clamp to 0.</span>
00162                         add                     eax, 256
00163                         sbb                     ecx, ecx        <span class="comment">// ecx= 0 if carry not set =&gt; result below 0.</span>
00164                         add                     ebx, 256
00165                         sbb                     edx, edx
00166                         and                     eax, ecx        <span class="comment">// eax= 0 if result was below 0</span>
00167                         and                     ebx, edx
00168 
00169                         <span class="comment">// Load Sat/(1-Sat) into MMX</span>
00170                         movd            mm2, ebx
00171                         movq            mm3, mmOne
00172                         punpckldq       mm2, mm2        <span class="comment">// mm2= 0000 00AA 0000 00AA</span>
00173                         packssdw        mm2, mm2        <span class="comment">// mm2= 00AA 00AA 00AA 00AA</span>
00174                         movq            mm1, mmGray
00175                         psubusw         mm3, mm2                <span class="comment">// mm3= 1-sat.</span>
00176                         <span class="comment">// combine Color and Sat</span>
00177                         pmullw          mm0, mm2        <span class="comment">// mm0= color*sat</span>
00178                         pmullw          mm1, mm3        <span class="comment">// mm1= gray*(1-sat)</span>
00179                         paddusw         mm0, mm1        <span class="comment">// mm0= color saturated</span>
00180                         <span class="comment">// shift and store into the buffer for Luminance interpolation</span>
00181                         psrlw       mm0, 8
00182                         movq            [edi+ 8], mm0
00183                         movq            [edi+ 16], mm0
00184 
00185                         <span class="comment">// use edx as index for luminance: 0: L=0 to 127. 1: L=128 to 255.</span>
00186                         mov                     edx, eax
00187                         shl                     eax, 1
00188                         shr                     edx, 7
00189                         and                     eax, 255                <span class="comment">// 0-127 and 128-255 transform auto to 0-254</span>
00190                         <span class="comment">// expand 0-254 to 0-255</span>
00191                         mov                     ecx, eax
00192                         shl                     edx, 4
00193                         shr                     ecx, 7
00194                         add                     eax, ecx
00195 
00196                         <span class="comment">// Combine color and Luminance into MMX. interpolate 0-&gt;col or col-&gt;white according to edx.</span>
00197                         <span class="comment">// Load Lum/(1-Lum) into MMX</span>
00198                         movd            mm2, eax
00199                         movq            mm3, mmOne
00200                         punpckldq       mm2, mm2        <span class="comment">// mm2= 0000 00AA 0000 00AA</span>
00201                         packssdw        mm2, mm2        <span class="comment">// mm2= 00AA 00AA 00AA 00AA</span>
00202                         psubusw         mm3, mm2        <span class="comment">// mm3= 1-lum.</span>
00203                         <span class="comment">// Combine color and Sat into MMX</span>
00204                         movq            mm0, [edi+ edx]
00205                         movq            mm1, [edi+ edx + 8]
00206                         pmullw          mm0, mm3        <span class="comment">// mm0= color0*(1-lum)</span>
00207                         pmullw          mm1, mm2        <span class="comment">// mm1= color1*lum</span>
00208                         paddusw         mm0, mm1        <span class="comment">// mm0= final color</span>
00209 
00210                         <span class="comment">// shift and unpack</span>
00211                         psrlw       mm0, 8
00212                         packuswb    mm0, mm0
00213                         movd            eax, mm0
00214 
00215                         <span class="comment">// pack to 16bits.</span>
00216                         mov                     ebx, eax
00217                         mov                     ecx, eax
00218                         shl                     eax, 8          <span class="comment">// Red</span>
00219                         shr                     ebx, 5          <span class="comment">// Green</span>
00220                         shr                     ecx, 19         <span class="comment">// Blue</span>
00221                         and                     eax, 0xF800
00222                         and                     ebx, 0x07E0
00223                         and                     ecx, 0x001F
00224                         or                      eax, ebx
00225                         or                      eax, ecx
00226 
00227                         mov                     retVal, ax
00228                 }
00229         }
00230         <span class="keywordflow">else</span>
00231 <span class="preprocessor">#endif  // NL_OS_WINDOWS</span>
00232 <span class="preprocessor"></span>        {
00233                 CHLSA   hls= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr0">_Color16ToHLS</a>[colorIn];
00234                 <span class="comment">// apply (C version) Dhue, dLum and dSat</span>
00235                 hls.<a class="code" href="a02514.html#NL3D_1_1CFastHLSModifier_1_1CHLSAo1">H</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(hls.H + dHue);
00236                 <a class="code" href="a04558.html#a14">sint</a>    <a class="code" href="a04223.html#a576">v</a>= (<a class="code" href="a04558.html#a14">sint</a>)hls.L + (<a class="code" href="a04558.html#a14">sint</a>)(dLum-0xFFFFFF00);
00237                 fastClamp8(v);
00238                 hls.L= <a class="code" href="a04223.html#a576">v</a>;
00239                 <a class="code" href="a04223.html#a576">v</a>= (<a class="code" href="a04558.html#a14">sint</a>)hls.S + (<a class="code" href="a04558.html#a14">sint</a>)(dSat-0xFFFFFF00);
00240                 fastClamp8(v);
00241                 hls.S= <a class="code" href="a04223.html#a576">v</a>;
00242 
00243                 <a class="code" href="a03337.html">CRGBA</a>   ret= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera1">convert</a>(hls.H, hls.L, hls.S);
00244                 retVal= ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAa6">get565</a>();
00245         }
00246 
00247         <span class="keywordflow">return</span> retVal;
00248 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifiera1" doxytag="NL3D::CFastHLSModifier::convert" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NL3D::CFastHLSModifier::convert </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>H</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>L</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>S</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
convert a HLS (0..255) to a RGBA. 
<p>

<p>
Definition at line <a class="el" href="a05706.html#l00086">86</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05707.html#l00084">_HueTable</a>, <a class="el" href="a06340.html#l00227">NLMISC::CRGBA::blendFromuiRGBOnly()</a>, <a class="el" href="a06340.html#l00236">NLMISC::CRGBA::modulateFromuiRGBOnly()</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, and <a class="el" href="a05706.html#l00414">convertRGBABitmap()</a>.
<p>
<div class="fragment"><pre>00087 {
00088         <span class="keyword">static</span>  <a class="code" href="a03337.html">CRGBA</a>   gray(128,128,128);
00089         L+= L&gt;&gt;7;
00090         S+= S&gt;&gt;7;
00091         <span class="comment">// H.</span>
00092         <a class="code" href="a03337.html">CRGBA</a>   col= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierr1">_HueTable</a>[H];
00093         <span class="comment">// S.</span>
00094         col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_3">blendFromuiRGBOnly</a>(gray, col, S);
00095         <span class="comment">// L.</span>
00096         <span class="keywordflow">if</span>(L&lt;=128)
00097         {
00098                 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_5">modulateFromuiRGBOnly</a>(col, L*2);
00099         }
00100         <span class="keywordflow">else</span>
00101         {
00102                 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2022_3">blendFromuiRGBOnly</a>(col, CRGBA::White, (L-128)*2 );
00103         }
00104 
00105         <span class="keywordflow">return</span> col;
00106 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifiera2" doxytag="NL3D::CFastHLSModifier::convertDDSBitmap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertDDSBitmap </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>dst</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>src</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dh</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dl</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>ds</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
convert a DDS bitmap into another DDS, with HLS decal (0..255, -255..+255, -255..+255). 
<p>

<p>
Definition at line <a class="el" href="a05706.html#l00393">393</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05706.html#l00252">convertDDSBitmapDXTC1Or1A()</a>, <a class="el" href="a05706.html#l00354">convertDDSBitmapDXTC3Or5()</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a05487.html#l00335">NLMISC::CBitmap::getPixelFormat()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
<div class="fragment"><pre>00394 {
00395         <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat</a>());
00396         <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getWidth()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>() &amp;&amp; <a class="code" href="a04223.html#a652">src</a>.getHeight()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>());
00397 
00398         <span class="comment">// Magic add clamp.</span>
00399         <a class="code" href="a04558.html#a15">uint</a>    dLum= 0xFFFFFF00 + dl;
00400         <a class="code" href="a04558.html#a15">uint</a>    dSat= 0xFFFFFF00 + ds;
00401 
00402         <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC1 || <a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC1Alpha)
00403                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierd1">convertDDSBitmapDXTC1Or1A</a>(dst, src, dh, dLum, dSat);
00404         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC3 || <a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::DXTC5)
00405                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierd2">convertDDSBitmapDXTC3Or5</a>(dst, src, dh, dLum, dSat);
00406         <span class="keywordflow">else</span>
00407         {
00408                 <a class="code" href="a04199.html#a12">nlstop</a>;
00409         }
00410 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifierd1" doxytag="NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>dst</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>src</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dh</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dLum</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dSat</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [private]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05706.html#l00252">252</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a05706.html#l00393">convertDDSBitmap()</a>.
<p>
<div class="fragment"><pre>00253 {
00254         <a class="code" href="a04558.html#a15">uint</a>    W= <a class="code" href="a04223.html#a652">src</a>.getWidth();
00255         <a class="code" href="a04558.html#a15">uint</a>    H= <a class="code" href="a04223.html#a652">src</a>.getHeight();
00256 
00257         <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a>     *srcPix= &amp;(<a class="code" href="a04223.html#a652">src</a>.getPixels()[0]);
00258         <a class="code" href="a04558.html#a7">uint8</a>           *dstPix= &amp;(dst.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]);
00259         <a class="code" href="a04558.html#a15">uint</a>    numBlock= (W*H)/16;
00260 
00261         <span class="comment">/*</span>
00262 <span class="comment">                need to swap color and bits for DXTC1 or DXTC1A.</span>
00263 <span class="comment">        */</span>
00264 
00265         <span class="keyword">static</span> <a class="code" href="a04558.html#a11">uint32</a>   bitLUT[8]= { 
00266                 1,0,3,2,                        <span class="comment">// reverse std order</span>
00267                 1,0,2,3,                        <span class="comment">// reverse order for "special 0/black packing"</span>
00268         };
00269 
00270         <span class="comment">// Do not use alpha mask for now.</span>
00271         <span class="keywordflow">for</span>(;numBlock&gt;0;numBlock--)
00272         {
00273                 <a class="code" href="a04558.html#a9">uint16</a>  srcCol0= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[0];
00274                 <a class="code" href="a04558.html#a9">uint16</a>  srcCol1= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[1];
00275                 <span class="keywordtype">bool</span>    srcSign= srcCol0&gt;srcCol1;
00276                 <span class="comment">// apply modifiers for 2 colors.</span>
00277                 <a class="code" href="a04558.html#a9">uint16</a>  dstCol0= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol0, dh,dLum,dSat);
00278                 <a class="code" href="a04558.html#a9">uint16</a>  dstCol1= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol1, dh,dLum,dSat);
00279                 <span class="keywordtype">bool</span>    dstSign= dstCol0&gt;dstCol1;
00280                 <span class="keywordflow">if</span>((<a class="code" href="a04558.html#a15">uint</a>)dstSign!=(<a class="code" href="a04558.html#a15">uint</a>)srcSign)
00281                 {
00282                         swap(dstCol0,dstCol1);
00283                         <span class="comment">// must change bits too!</span>
00284                         <a class="code" href="a04558.html#a11">uint32</a>  srcBits= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[1];
00285                         <a class="code" href="a04558.html#a11">uint32</a>  dstBits= 0;
00286                         <span class="comment">// take correct lut according to original sign</span>
00287                         <a class="code" href="a04558.html#a11">uint32</a>  *lut;
00288                         <span class="keywordflow">if</span>(srcCol0&gt;srcCol1)
00289                                 lut= bitLUT;
00290                         <span class="keywordflow">else</span>
00291                                 lut= bitLUT+4;
00292 
00293                         <span class="comment">// for all bits, transpose with lut.</span>
00294 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00295 <span class="preprocessor"></span>                        __asm
00296                         {
00297                                 mov             eax, srcBits
00298                                 mov             esi, lut
00299                                 mov             edx, 0
00300                                 mov             ecx, 16
00301                                 <span class="comment">// prepare 1st.</span>
00302                                 rol             eax, 2
00303                                 mov             ebx, eax
00304                                 and             ebx, 2
00305                                 <span class="comment">// do it 16 times.</span>
00306                         myLoop:
00307                                 or              edx, [esi+ebx*4]
00308                                 rol             eax, 2
00309                                 rol             edx, 2
00310                                 mov             ebx, eax
00311                                 and             ebx, 2
00312                                 dec             ecx
00313                                 jnz             myLoop
00314 
00315                                 ror             edx, 2
00316                                 mov             dstBits, edx
00317                         }
00318 <span class="preprocessor">#else</span>
00319 <span class="preprocessor"></span>                        <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> n=16;n&gt;0;n--)
00320                         {
00321                                 <span class="comment">// transform the id.</span>
00322                                 <a class="code" href="a04558.html#a15">uint</a>    <span class="keywordtype">id</span>= srcBits&amp;3;
00323                                 <span class="keywordtype">id</span>= lut[<span class="keywordtype">id</span>];
00324                                 <span class="comment">// write.</span>
00325                                 dstBits|= <span class="keywordtype">id</span>&lt;&lt;30;
00326                                 <span class="comment">// don't decal last</span>
00327                                 <span class="keywordflow">if</span>(n&gt;1)
00328                                         dstBits&gt;&gt;=2;
00329                         }
00330 <span class="preprocessor">#endif</span>
00331 <span class="preprocessor"></span>
00332                         <span class="comment">// store </span>
00333                         ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[1]= dstBits;
00334                 }
00335                 <span class="keywordflow">else</span>
00336                         <span class="comment">// just copy bits</span>
00337                         ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[1]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[3];
00338                 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[0]= dstCol0;
00339                 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[1]= dstCol1;
00340                 <span class="comment">// skip.</span>
00341                 srcPix+= 8;
00342                 dstPix+= 8;
00343         }
00344 
00345         <span class="comment">// Must end MMX, for applyHLSMod()</span>
00346 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00347 <span class="preprocessor"></span>        <span class="keywordflow">if</span>(CSystemInfo::hasMMX())
00348                 _asm    emms;
00349 <span class="preprocessor">#endif</span>
00350 <span class="preprocessor"></span>
00351 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifierd2" doxytag="NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5 </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>dst</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>src</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dh</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dLum</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dSat</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [private]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05706.html#l00354">354</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a05706.html#l00393">convertDDSBitmap()</a>.
<p>
<div class="fragment"><pre>00355 {
00356         <a class="code" href="a04558.html#a15">uint</a>    W= <a class="code" href="a04223.html#a652">src</a>.getWidth();
00357         <a class="code" href="a04558.html#a15">uint</a>    H= <a class="code" href="a04223.html#a652">src</a>.getHeight();
00358 
00359         <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a>     *srcPix= &amp;(<a class="code" href="a04223.html#a652">src</a>.getPixels()[0]);
00360         <a class="code" href="a04558.html#a7">uint8</a>           *dstPix= &amp;(dst.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]);
00361         <a class="code" href="a04558.html#a15">uint</a>    numBlock= (W*H)/16;
00362 
00363         <span class="comment">/*</span>
00364 <span class="comment">                NB: don't need to swap color and bits for DXTC3 or DXTC5.</span>
00365 <span class="comment">        */</span>
00366 
00367         <span class="comment">// Do not use alpha mask for now.</span>
00368         <span class="keywordflow">for</span>(;numBlock&gt;0;numBlock--)
00369         {
00370                 <a class="code" href="a04558.html#a9">uint16</a>  srcCol0= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[4];
00371                 <a class="code" href="a04558.html#a9">uint16</a>  srcCol1= ((<a class="code" href="a04558.html#a9">uint16</a>*)srcPix)[5];
00372                 <span class="comment">// apply modifiers for 2 colors.</span>
00373                 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[4]= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol0, dh,dLum,dSat);
00374                 ((<a class="code" href="a04558.html#a9">uint16</a>*)dstPix)[5]= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera0">applyHLSMod</a>(srcCol1, dh,dLum,dSat);
00375                 <span class="comment">// just copy bits</span>
00376                 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[3]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[3];
00377                 <span class="comment">// copy alpha part.</span>
00378                 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[0]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[0];
00379                 ((<a class="code" href="a04558.html#a11">uint32</a>*)dstPix)[1]= ((<a class="code" href="a04558.html#a11">uint32</a>*)srcPix)[1];
00380                 <span class="comment">// skip bits and alpha part.</span>
00381                 srcPix+= 16;
00382                 dstPix+= 16;
00383         }
00384 
00385         <span class="comment">// Must end MMX, for applyHLSMod()</span>
00386 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00387 <span class="preprocessor"></span>        <span class="keywordflow">if</span>(CSystemInfo::hasMMX())
00388                 _asm    emms;
00389 <span class="preprocessor">#endif</span>
00390 <span class="preprocessor"></span>}
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifiera3" doxytag="NL3D::CFastHLSModifier::convertRGBABitmap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CFastHLSModifier::convertRGBABitmap </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>dst</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>src</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dh</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>dl</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>ds</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255). 
<p>

<p>
Definition at line <a class="el" href="a05706.html#l00414">414</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05706.html#l00086">convert()</a>, <a class="el" href="a06339.html#l00609">NLMISC::CRGBA::convertToHLS()</a>, <a class="el" href="a05487.html#l00335">NLMISC::CBitmap::getPixelFormat()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05701.html#l00125">NLMISC::OptFastFloor()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
<div class="fragment"><pre>00415 {
00416         <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==dst.<a class="code" href="a02268.html#NL3D_1_1ITexturea15">getPixelFormat</a>());
00417         <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a652">src</a>.getPixelFormat()==CBitmap::RGBA);
00418 
00419         <a class="code" href="a04558.html#a15">uint</a>    W= <a class="code" href="a04223.html#a652">src</a>.getWidth();
00420         <a class="code" href="a04558.html#a15">uint</a>    H= <a class="code" href="a04223.html#a652">src</a>.getHeight();
00421 
00422         <span class="keyword">const</span> <a class="code" href="a03337.html">CRGBA</a>     *srcPix= (<span class="keyword">const</span> <a class="code" href="a03337.html">CRGBA</a>*)&amp;(<a class="code" href="a04223.html#a652">src</a>.getPixels()[0]);
00423         <a class="code" href="a03337.html">CRGBA</a>           *dstPix= (<a class="code" href="a03337.html">CRGBA</a>*)&amp;(dst.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]);
00424         <a class="code" href="a04558.html#a15">uint</a>    numPix= W*H;
00425 
00426         <span class="comment">// Do not use alpha mask for now.</span>
00427         <span class="keywordflow">for</span>(;numPix&gt;0;numPix--)
00428         {
00429                 <span class="keywordtype">float</span>   H,L,S;
00430                 srcPix-&gt;<a class="code" href="a03337.html#NLMISC_1_1CRGBAz2026_1">convertToHLS</a>(H,L,S);
00431                 H*= 256.f/360.f;
00432                 L*= 255.f;
00433                 S*= 255.f;
00434                 H+= dh+0.5f;
00435                 L+= dl+0.5f;
00436                 S+= ds+0.5f;
00437                 <a class="code" href="a05378.html#a374">clamp</a>(H, 0, 255);
00438                 <a class="code" href="a05378.html#a374">clamp</a>(L, 0, 255);
00439                 <a class="code" href="a05378.html#a374">clamp</a>(S, 0, 255);
00440                 <a class="code" href="a04558.html#a7">uint8</a>   H8= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(H);
00441                 <a class="code" href="a04558.html#a7">uint8</a>   L8= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(L);
00442                 <a class="code" href="a04558.html#a7">uint8</a>   S8= (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(S);
00443                 *dstPix= <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifiera1">convert</a>(H8, L8, S8);
00444                 srcPix++;
00445                 dstPix++;
00446         }
00447 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifiere0" doxytag="NL3D::CFastHLSModifier::getInstance" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02513.html">CFastHLSModifier</a> &amp; NL3D::CFastHLSModifier::getInstance </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
get the singleton 
<p>

<p>
Definition at line <a class="el" href="a05706.html#l00077">77</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
References <a class="el" href="a05706.html#l00043">_Instance</a>.
<p>
<div class="fragment"><pre>00078 {
00079         <span class="keywordflow">if</span>(!<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a>)
00080                 <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a>= <span class="keyword">new</span> <a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierd0">CFastHLSModifier</a>;
00081         <span class="keywordflow">return</span> *<a class="code" href="a02513.html#NL3D_1_1CFastHLSModifierv0">_Instance</a>;
00082 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CFastHLSModifierr0" doxytag="NL3D::CFastHLSModifier::_Color16ToHLS" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02514.html">CHLSA</a> <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr0">NL3D::CFastHLSModifier::_Color16ToHLS</a>[65536]<code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05707.html#l00085">85</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>.
<p>
Referenced by <a class="el" href="a05706.html#l00110">applyHLSMod()</a>, and <a class="el" href="a05706.html#l00047">CFastHLSModifier()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifierr1" doxytag="NL3D::CFastHLSModifier::_HueTable" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierr1">NL3D::CFastHLSModifier::_HueTable</a>[HueTableSize]<code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05707.html#l00084">84</a> of file <a class="el" href="a05707.html">fasthls_modifier.h</a>.
<p>
Referenced by <a class="el" href="a05706.html#l00047">CFastHLSModifier()</a>, and <a class="el" href="a05706.html#l00086">convert()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CFastHLSModifierv0" doxytag="NL3D::CFastHLSModifier::_Instance" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02513.html">CFastHLSModifier</a> * <a class="el" href="a02513.html#NL3D_1_1CFastHLSModifierv0">NL3D::CFastHLSModifier::_Instance</a> = NULL<code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05706.html#l00043">43</a> of file <a class="el" href="a05706.html">fasthls_modifier.cpp</a>.
<p>
Referenced by <a class="el" href="a05706.html#l00077">getInstance()</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05707.html">fasthls_modifier.h</a><li><a class="el" href="a05706.html">fasthls_modifier.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:46:31 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>