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
|
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
/* are copyright of the aforementioned persons and companies. */
/* */
/* Redistribution and use of the present software is allowed according */
/* to terms specified in the file LICENSE.nxcomp which comes in the */
/* source distribution. */
/* */
/* All rights reserved. */
/* */
/* NOTE: This software has received contributions from various other */
/* contributors, only the core maintainers and supporters are listed as */
/* copyright holders. Please contact us, if you feel you should be listed */
/* as copyright holder, as well. */
/* */
/**************************************************************************/
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "NXpack.h"
const ColorMask Mask8TrueColor = { 128, 63, 240, 7 };
const ColorMask Mask64TrueColor = { 192, 7, 240, 4 };
const ColorMask Mask256TrueColor = { 255, 0, 255, 0 };
const ColorMask Mask512TrueColor = { 224, 5, 240, 4 };
const ColorMask Mask4KTrueColor = { 240, 4, 240, 2 };
const ColorMask Mask32KTrueColor = { 248, 3, 248, 2 };
const ColorMask Mask64KTrueColor = { 255, 0, 255, 0 };
const ColorMask Mask256KTrueColor = { 252, 1, 252, 1 };
const ColorMask Mask2MTrueColor = { 255, 0, 254, 1 };
const ColorMask Mask16MTrueColor = { 255, 0, 255, 0 };
const ColorMask *MethodColorMask(unsigned int method)
{
switch (method)
{
case MASK_8_COLORS:
{
return &Mask8TrueColor;
}
case MASK_64_COLORS:
{
return &Mask64TrueColor;
}
case MASK_256_COLORS:
{
return &Mask256TrueColor;
}
case MASK_512_COLORS:
{
return &Mask512TrueColor;
}
case MASK_4K_COLORS:
{
return &Mask4KTrueColor;
}
case MASK_32K_COLORS:
{
return &Mask32KTrueColor;
}
case MASK_64K_COLORS:
{
return &Mask64KTrueColor;
}
case MASK_256K_COLORS:
{
return &Mask256KTrueColor;
}
case MASK_2M_COLORS:
{
return &Mask2MTrueColor;
}
case MASK_16M_COLORS:
{
return &Mask16MTrueColor;
}
default:
{
return NULL;
}
}
}
int MethodBitsPerPixel(unsigned int method)
{
switch (method)
{
case PACK_MASKED_8_COLORS:
case PACK_JPEG_8_COLORS:
case PACK_PNG_8_COLORS:
{
return 8;
}
case PACK_MASKED_64_COLORS:
case PACK_JPEG_64_COLORS:
case PACK_PNG_64_COLORS:
{
return 8;
}
case PACK_MASKED_256_COLORS:
case PACK_JPEG_256_COLORS:
case PACK_PNG_256_COLORS:
{
return 8;
}
case PACK_MASKED_512_COLORS:
case PACK_JPEG_512_COLORS:
case PACK_PNG_512_COLORS:
{
return 16;
}
case PACK_MASKED_4K_COLORS:
case PACK_JPEG_4K_COLORS:
case PACK_PNG_4K_COLORS:
{
return 16;
}
case PACK_MASKED_32K_COLORS:
case PACK_JPEG_32K_COLORS:
case PACK_PNG_32K_COLORS:
{
return 16;
}
case PACK_MASKED_64K_COLORS:
case PACK_JPEG_64K_COLORS:
case PACK_PNG_64K_COLORS:
{
return 16;
}
case PACK_MASKED_256K_COLORS:
case PACK_JPEG_256K_COLORS:
case PACK_PNG_256K_COLORS:
{
return 24;
}
case PACK_MASKED_2M_COLORS:
case PACK_JPEG_2M_COLORS:
case PACK_PNG_2M_COLORS:
{
return 24;
}
case PACK_MASKED_16M_COLORS:
case PACK_JPEG_16M_COLORS:
case PACK_PNG_16M_COLORS:
{
return 24;
}
case PACK_BITMAP_16M_COLORS:
case PACK_RGB_16M_COLORS:
case PACK_RLE_16M_COLORS:
{
return 24;
}
default:
{
return 0;
}
}
}
#ifdef __cplusplus
}
#endif
|