home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sierra Multimedia Katalog 1995 to 1996
/
sierra1.iso
/
wing
/
httables.c_
/
httables.c
Wrap
C/C++ Source or Header
|
1994-08-13
|
8KB
|
381 lines
/**************************************************************************
HTTABLES.C - halftone tables
**************************************************************************/
/**************************************************************************
(C) Copyright 1994 Microsoft Corp. All rights reserved.
You have a royalty-free right to use, modify, reproduce and
distribute the Sample Files (and/or any modified version) in
any way you find useful, provided that you agree that
Microsoft has no warranty obligations or liability for any
Sample Application Files which are modified.
**************************************************************************/
#include<windows.h>
#include<memory.h>
#include<wing.h>
long const PALETTERGBFlag = 0x02000000;
long const PALETTEINDEXFlag = 0x01000000;
/*----------------------------------------------------------------------------
Division lookup tables. These tables compute 0-255 divided by 51 and
modulo 51. These tables could approximate gamma correction.
*/
char unsigned const aDividedBy51Rounded[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,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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, 0, 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, 0, 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, 0, 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, 0, 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, 0,
};
/*----------------------------------------------------------------------------
Multiplication LUTs. These compute 0-5 times 6 and 36.
*/
char unsigned const aTimes6[6] =
{
0, 6, 12, 18, 24, 30
};
char unsigned const aTimes36[6] =
{
0, 36, 72, 108, 144, 180
};
/*----------------------------------------------------------------------------
Dither matrices for 8 bit to 2.6 bit halftones.
*/
char unsigned const aHalftone16x16[256] =
{
0, 44, 9, 41, 3, 46, 12, 43, 1, 44, 10, 41, 3, 46, 12, 43,
34, 16, 25, 19, 37, 18, 28, 21, 35, 16, 26, 19, 37, 18, 28, 21,
38, 6, 47, 3, 40, 9, 50, 6, 38, 7, 47, 4, 40, 9, 49, 6,
22, 28, 13, 31, 25, 31, 15, 34, 22, 29, 13, 32, 24, 31, 15, 34,
2, 46, 12, 43, 1, 45, 10, 42, 2, 45, 11, 42, 1, 45, 11, 42,
37, 18, 27, 21, 35, 17, 26, 20, 36, 17, 27, 20, 36, 17, 26, 20,
40, 8, 49, 5, 38, 7, 48, 4, 39, 8, 48, 5, 39, 7, 48, 4,
24, 30, 15, 33, 23, 29, 13, 32, 23, 30, 14, 33, 23, 29, 14, 32,
2, 46, 12, 43, 0, 44, 10, 41, 3, 47, 12, 44, 0, 44, 10, 41,
37, 18, 27, 21, 35, 16, 25, 19, 37, 19, 28, 22, 35, 16, 25, 19,
40, 9, 49, 5, 38, 7, 47, 4, 40, 9, 50, 6, 38, 6, 47, 3,
24, 30, 15, 34, 22, 29, 13, 32, 25, 31, 15, 34, 22, 28, 13, 31,
1, 45, 11, 42, 2, 46, 11, 42, 1, 45, 10, 41, 2, 46, 11, 43,
36, 17, 26, 20, 36, 17, 27, 21, 35, 16, 26, 20, 36, 18, 27, 21,
39, 8, 48, 4, 39, 8, 49, 5, 38, 7, 48, 4, 39, 8, 49, 5,
23, 29, 14, 33, 24, 30, 14, 33, 23, 29, 13, 32, 24, 30, 14, 33,
};
char unsigned const aHalftone8x8[64] =
{
0, 38, 9, 47, 2, 40, 11, 50,
25, 12, 35, 22, 27, 15, 37, 24,
6, 44, 3, 41, 8, 47, 5, 43,
31, 19, 28, 15, 34, 21, 31, 18,
1, 39, 11, 49, 0, 39, 10, 48,
27, 14, 36, 23, 26, 13, 35, 23,
7, 46, 4, 43, 7, 45, 3, 42,
33, 20, 30, 17, 32, 19, 29, 16,
};
char unsigned const aHalftone4x4_1[16] =
{
0, 25, 6, 31,
38, 12, 44, 19,
9, 35, 3, 28,
47, 22, 41, 15
};
char unsigned const aHalftone4x4_2[16] =
{
41, 3, 9, 28,
35, 15, 22, 47,
6, 25, 38, 0,
19, 44, 31, 12
};
/***************************************************************************
aWinGHalftoneTranslation
Translates a 2.6 bit-per-pixel halftoned representation into the
slightly rearranged WinG Halftone Palette.
*/
char unsigned const aWinGHalftoneTranslation[216] =
{
0,
29,
30,
31,
32,
249,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
250,
250,
57,
58,
59,
251,
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,
250,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
227,
112,
113,
114,
115,
116,
117,
118,
119,
151,
120,
121,
122,
123,
124,
228,
125,
126,
229,
133,
162,
135,
131,
132,
137,
166,
134,
140,
130,
136,
143,
138,
139,
174,
141,
142,
177,
129,
144,
145,
146,
147,
148,
149,
150,
157,
152,
153,
154,
155,
156,
192,
158,
159,
160,
161,
196,
163,
164,
165,
127,
199,
167,
168,
169,
170,
171,
172,
173,
207,
175,
176,
210,
178,
179,
180,
181,
182,
183,
184,
185,
186,
187,
188,
189,
190,
191,
224,
193,
194,
195,
252,
252,
197,
198,
128,
253,
252,
200,
201,
202,
203,
204,
205,
206,
230,
208,
209,
231,
211,
212,
213,
214,
215,
216,
217,
218,
219,
220,
221,
222,
254,
223,
232,
225,
226,
255,
};