2
|
1 |
/*
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
3 |
*
|
|
4 |
* This code is free software; you can redistribute it and/or modify it
|
|
5 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
6 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
7 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
8 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
9 |
*
|
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
14 |
* accompanied this code).
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License version
|
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
19 |
*
|
5506
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
21 |
* or visit www.oracle.com if you need additional information or have any
|
|
22 |
* questions.
|
2
|
23 |
*/
|
|
24 |
|
|
25 |
// This file is available under and governed by the GNU General Public
|
|
26 |
// License version 2 only, as published by the Free Software Foundation.
|
|
27 |
// However, the following notice accompanied the original version of this
|
|
28 |
// file:
|
|
29 |
//
|
|
30 |
//
|
|
31 |
// Little cms
|
2394
|
32 |
// Copyright (C) 1998-2007 Marti Maria
|
2
|
33 |
//
|
|
34 |
// Permission is hereby granted, free of charge, to any person obtaining
|
|
35 |
// a copy of this software and associated documentation files (the "Software"),
|
|
36 |
// to deal in the Software without restriction, including without limitation
|
|
37 |
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
38 |
// and/or sell copies of the Software, and to permit persons to whom the Software
|
|
39 |
// is furnished to do so, subject to the following conditions:
|
|
40 |
//
|
|
41 |
// The above copyright notice and this permission notice shall be included in
|
|
42 |
// all copies or substantial portions of the Software.
|
|
43 |
//
|
|
44 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
45 |
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
46 |
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
47 |
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
48 |
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
49 |
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
50 |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
51 |
|
2394
|
52 |
// Version 1.18
|
|
53 |
|
2
|
54 |
#ifndef __cms_H
|
|
55 |
|
|
56 |
// ********** Configuration toggles ****************************************
|
|
57 |
|
|
58 |
// Optimization mode.
|
|
59 |
//
|
|
60 |
// Note that USE_ASSEMBLER Is fastest by far, but it is limited to Pentium.
|
|
61 |
// USE_FLOAT are the generic floating-point routines. USE_C should work on
|
|
62 |
// virtually any machine.
|
|
63 |
|
|
64 |
//#define USE_FLOAT 1
|
2394
|
65 |
// #define USE_C 1
|
2
|
66 |
#define USE_ASSEMBLER 1
|
|
67 |
|
|
68 |
// Define this if you are using this package as a DLL (windows only)
|
|
69 |
|
|
70 |
// #define LCMS_DLL 1
|
|
71 |
// #define LCMS_DLL_BUILD 1
|
|
72 |
|
|
73 |
// Uncomment if you are trying the engine in a non-windows environment
|
|
74 |
// like linux, SGI, VAX, FreeBSD, BeOS, etc.
|
|
75 |
#define NON_WINDOWS 1
|
|
76 |
|
|
77 |
// Uncomment this one if you are using big endian machines (only meaningful
|
|
78 |
// when NON_WINDOWS is used)
|
2394
|
79 |
// #define USE_BIG_ENDIAN 1
|
2
|
80 |
|
|
81 |
// Uncomment this one if your compiler/machine does support the
|
|
82 |
// "long long" type This will speedup fixed point math. (USE_C only)
|
|
83 |
#define USE_INT64 1
|
|
84 |
|
|
85 |
// Some machines does not have a reliable 'swab' function. Usually
|
|
86 |
// leave commented unless the testbed diagnoses the contrary.
|
|
87 |
// #define USE_CUSTOM_SWAB 1
|
|
88 |
|
|
89 |
// Uncomment this if your compiler supports inline
|
|
90 |
#define USE_INLINE 1
|
|
91 |
|
|
92 |
// Uncomment this if your compiler doesn't work with fast floor function
|
|
93 |
// #define USE_DEFAULT_FLOOR_CONVERSION 1
|
|
94 |
|
|
95 |
// Uncomment this line on multithreading environments
|
|
96 |
// #define USE_PTHREADS 1
|
|
97 |
|
2394
|
98 |
// Uncomment this line if you want lcms to use the black point tag in profile,
|
|
99 |
// if commented, lcms will compute the black point by its own.
|
|
100 |
// It is safer to leve it commented out
|
|
101 |
// #define HONOR_BLACK_POINT_TAG 1
|
|
102 |
|
2
|
103 |
// ********** End of configuration toggles ******************************
|
|
104 |
|
2394
|
105 |
#define LCMS_VERSION 118
|
2
|
106 |
|
|
107 |
// Microsoft VisualC++
|
|
108 |
|
|
109 |
// Deal with Microsoft's attempt at deprecating C standard runtime functions
|
|
110 |
#ifdef _MSC_VER
|
|
111 |
# undef NON_WINDOWS
|
|
112 |
# if (_MSC_VER >= 1400)
|
2394
|
113 |
# ifndef _CRT_SECURE_NO_DEPRECATE
|
2
|
114 |
# define _CRT_SECURE_NO_DEPRECATE 1
|
2394
|
115 |
# endif
|
2
|
116 |
# endif
|
|
117 |
#endif
|
|
118 |
|
|
119 |
// Borland C
|
|
120 |
|
|
121 |
#ifdef __BORLANDC__
|
|
122 |
# undef NON_WINDOWS
|
|
123 |
#endif
|
|
124 |
|
|
125 |
#include <stdio.h>
|
|
126 |
#include <stdlib.h>
|
|
127 |
#include <math.h>
|
|
128 |
#include <assert.h>
|
|
129 |
#include <stdarg.h>
|
|
130 |
#include <time.h>
|
|
131 |
|
|
132 |
// Metroworks CodeWarrior
|
|
133 |
#ifdef __MWERKS__
|
|
134 |
# define unlink remove
|
|
135 |
# if WIN32
|
|
136 |
# define USE_CUSTOM_SWAB 1
|
2394
|
137 |
# undef NON_WINDOWS
|
2
|
138 |
# else
|
|
139 |
# define NON_WINDOWS 1
|
|
140 |
# endif
|
|
141 |
#endif
|
|
142 |
|
|
143 |
|
|
144 |
// Here comes the Non-Windows settings
|
|
145 |
|
|
146 |
#ifdef NON_WINDOWS
|
|
147 |
|
|
148 |
// Non windows environments. Also avoid indentation on includes.
|
|
149 |
|
|
150 |
#ifdef USE_PTHREADS
|
|
151 |
# include <pthread.h>
|
|
152 |
typedef pthread_rwlock_t LCMS_RWLOCK_T;
|
|
153 |
# define LCMS_CREATE_LOCK(x) pthread_rwlock_init((x), NULL)
|
|
154 |
# define LCMS_FREE_LOCK(x) pthread_rwlock_destroy((x))
|
|
155 |
# define LCMS_READ_LOCK(x) pthread_rwlock_rdlock((x))
|
|
156 |
# define LCMS_WRITE_LOCK(x) pthread_rwlock_wrlock((x))
|
|
157 |
# define LCMS_UNLOCK(x) pthread_rwlock_unlock((x))
|
|
158 |
#endif
|
|
159 |
|
|
160 |
#undef LCMS_DLL
|
|
161 |
|
|
162 |
#ifdef USE_ASSEMBLER
|
|
163 |
# undef USE_ASSEMBLER
|
|
164 |
# define USE_C 1
|
|
165 |
#endif
|
|
166 |
|
|
167 |
#ifdef _HOST_BIG_ENDIAN
|
|
168 |
# define USE_BIG_ENDIAN 1
|
|
169 |
#endif
|
|
170 |
|
2394
|
171 |
#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc) || defined(__ppc__) || defined(__s390__) || defined(__s390x__)
|
2
|
172 |
# define USE_BIG_ENDIAN 1
|
|
173 |
#endif
|
|
174 |
|
2394
|
175 |
#if TARGET_CPU_PPC
|
2
|
176 |
# define USE_BIG_ENDIAN 1
|
|
177 |
#endif
|
|
178 |
|
2394
|
179 |
#if macintosh
|
|
180 |
# ifndef __LITTLE_ENDIAN__
|
|
181 |
# define USE_BIG_ENDIAN 1
|
|
182 |
# endif
|
|
183 |
#endif
|
|
184 |
|
|
185 |
#ifdef __BIG_ENDIAN__
|
2
|
186 |
# define USE_BIG_ENDIAN 1
|
|
187 |
#endif
|
|
188 |
|
|
189 |
#ifdef WORDS_BIGENDIAN
|
|
190 |
# define USE_BIG_ENDIAN 1
|
|
191 |
#endif
|
|
192 |
|
|
193 |
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
|
|
194 |
# include <sys/types.h>
|
|
195 |
# define USE_INT64 1
|
|
196 |
# define LCMSSLONGLONG int64_t
|
|
197 |
# define LCMSULONGLONG u_int64_t
|
|
198 |
#endif
|
|
199 |
|
|
200 |
#ifdef USE_INT64
|
|
201 |
# ifndef LCMSULONGLONG
|
|
202 |
# define LCMSULONGLONG unsigned long long
|
|
203 |
# define LCMSSLONGLONG long long
|
|
204 |
# endif
|
|
205 |
#endif
|
|
206 |
|
|
207 |
#if !defined(__INTEGRITY)
|
|
208 |
# include <memory.h>
|
|
209 |
#endif
|
|
210 |
|
|
211 |
#include <string.h>
|
|
212 |
|
|
213 |
#if defined(__GNUC__) || defined(__FreeBSD__)
|
|
214 |
# include <unistd.h>
|
|
215 |
#endif
|
|
216 |
|
|
217 |
#ifndef LCMS_WIN_TYPES_ALREADY_DEFINED
|
|
218 |
|
|
219 |
typedef unsigned char BYTE, *LPBYTE;
|
|
220 |
typedef unsigned short WORD, *LPWORD;
|
|
221 |
typedef unsigned long DWORD, *LPDWORD;
|
|
222 |
typedef char *LPSTR;
|
|
223 |
typedef void *LPVOID;
|
|
224 |
|
|
225 |
#define ZeroMemory(p,l) memset((p),0,(l))
|
|
226 |
#define CopyMemory(d,s,l) memcpy((d),(s),(l))
|
|
227 |
#define FAR
|
|
228 |
|
|
229 |
#ifndef stricmp
|
|
230 |
# define stricmp strcasecmp
|
|
231 |
#endif
|
|
232 |
|
|
233 |
|
|
234 |
#ifndef FALSE
|
|
235 |
# define FALSE 0
|
|
236 |
#endif
|
|
237 |
#ifndef TRUE
|
|
238 |
# define TRUE 1
|
|
239 |
#endif
|
|
240 |
|
|
241 |
#define LOWORD(l) ((WORD)(l))
|
|
242 |
#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
|
|
243 |
|
|
244 |
#ifndef MAX_PATH
|
|
245 |
# define MAX_PATH (256)
|
|
246 |
#endif
|
|
247 |
|
|
248 |
#define cdecl
|
|
249 |
#endif
|
|
250 |
|
|
251 |
// The specification for "inline" is section 6.7.4 of the C99 standard (ISO/IEC 9899:1999).
|
|
252 |
|
|
253 |
#define LCMS_INLINE static inline
|
|
254 |
|
|
255 |
#else
|
|
256 |
|
|
257 |
// Win32 stuff
|
|
258 |
|
|
259 |
#ifndef WIN32_LEAN_AND_MEAN
|
|
260 |
# define WIN32_LEAN_AND_MEAN
|
|
261 |
#endif
|
|
262 |
|
|
263 |
#include <windows.h>
|
|
264 |
|
2394
|
265 |
#ifdef _WIN64
|
|
266 |
# ifdef USE_ASSEMBLER
|
|
267 |
# undef USE_ASSEMBLER
|
|
268 |
# define USE_C 1
|
|
269 |
# endif
|
|
270 |
#endif
|
2
|
271 |
|
|
272 |
#ifdef USE_INT64
|
|
273 |
# ifndef LCMSULONGLONG
|
|
274 |
# define LCMSULONGLONG unsigned __int64
|
|
275 |
# define LCMSSLONGLONG __int64
|
|
276 |
# endif
|
|
277 |
#endif
|
|
278 |
|
|
279 |
// This works for both VC & BorlandC
|
|
280 |
#define LCMS_INLINE __inline
|
|
281 |
|
|
282 |
#ifdef USE_PTHREADS
|
|
283 |
typedef CRITICAL_SECTION LCMS_RWLOCK_T;
|
|
284 |
# define LCMS_CREATE_LOCK(x) InitializeCriticalSection((x))
|
|
285 |
# define LCMS_FREE_LOCK(x) DeleteCriticalSection((x))
|
|
286 |
# define LCMS_READ_LOCK(x) EnterCriticalSection((x))
|
|
287 |
# define LCMS_WRITE_LOCK(x) EnterCriticalSection((x))
|
|
288 |
# define LCMS_UNLOCK(x) LeaveCriticalSection((x))
|
|
289 |
#endif
|
|
290 |
|
|
291 |
#endif
|
|
292 |
|
|
293 |
#ifndef USE_PTHREADS
|
|
294 |
typedef int LCMS_RWLOCK_T;
|
|
295 |
# define LCMS_CREATE_LOCK(x)
|
|
296 |
# define LCMS_FREE_LOCK(x)
|
|
297 |
# define LCMS_READ_LOCK(x)
|
|
298 |
# define LCMS_WRITE_LOCK(x)
|
|
299 |
# define LCMS_UNLOCK(x)
|
|
300 |
#endif
|
|
301 |
|
2394
|
302 |
// Base types
|
|
303 |
|
|
304 |
typedef int LCMSBOOL;
|
|
305 |
typedef void* LCMSHANDLE;
|
2
|
306 |
|
|
307 |
#include "icc34.h" // ICC header file
|
|
308 |
|
|
309 |
|
|
310 |
// Some tag & type additions
|
|
311 |
|
|
312 |
#define lcmsSignature ((icSignature) 0x6c636d73L)
|
|
313 |
|
|
314 |
#define icSigLuvKData ((icColorSpaceSignature) 0x4C75764BL) // 'LuvK'
|
|
315 |
|
|
316 |
#define icSigHexachromeData ((icColorSpaceSignature) 0x4d434836L) // MCH6
|
|
317 |
#define icSigHeptachromeData ((icColorSpaceSignature) 0x4d434837L) // MCH7
|
|
318 |
#define icSigOctachromeData ((icColorSpaceSignature) 0x4d434838L) // MCH8
|
|
319 |
|
|
320 |
#define icSigMCH5Data ((icColorSpaceSignature) 0x4d434835L) // MCH5
|
|
321 |
#define icSigMCH6Data ((icColorSpaceSignature) 0x4d434836L) // MCH6
|
|
322 |
#define icSigMCH7Data ((icColorSpaceSignature) 0x4d434837L) // MCH7
|
|
323 |
#define icSigMCH8Data ((icColorSpaceSignature) 0x4d434838L) // MCH8
|
|
324 |
#define icSigMCH9Data ((icColorSpaceSignature) 0x4d434839L) // MCH9
|
|
325 |
#define icSigMCHAData ((icColorSpaceSignature) 0x4d434841L) // MCHA
|
|
326 |
#define icSigMCHBData ((icColorSpaceSignature) 0x4d434842L) // MCHB
|
|
327 |
#define icSigMCHCData ((icColorSpaceSignature) 0x4d434843L) // MCHC
|
|
328 |
#define icSigMCHDData ((icColorSpaceSignature) 0x4d434844L) // MCHD
|
|
329 |
#define icSigMCHEData ((icColorSpaceSignature) 0x4d434845L) // MCHE
|
|
330 |
#define icSigMCHFData ((icColorSpaceSignature) 0x4d434846L) // MCHF
|
|
331 |
|
|
332 |
#define icSigChromaticityTag ((icTagSignature) 0x6368726dL) // As per Addendum 2 to Spec. ICC.1:1998-09
|
|
333 |
#define icSigChromaticAdaptationTag ((icTagSignature) 0x63686164L) // 'chad'
|
|
334 |
#define icSigColorantTableTag ((icTagSignature) 0x636c7274L) // 'clrt'
|
|
335 |
#define icSigColorantTableOutTag ((icTagSignature) 0x636c6f74L) // 'clot'
|
|
336 |
|
|
337 |
#define icSigParametricCurveType ((icTagTypeSignature) 0x70617261L) // parametric (ICC 4.0)
|
|
338 |
#define icSigMultiLocalizedUnicodeType ((icTagTypeSignature) 0x6D6C7563L)
|
|
339 |
#define icSigS15Fixed16ArrayType ((icTagTypeSignature) 0x73663332L)
|
|
340 |
#define icSigChromaticityType ((icTagTypeSignature) 0x6368726dL)
|
|
341 |
#define icSiglutAtoBType ((icTagTypeSignature) 0x6d414220L) // mAB
|
|
342 |
#define icSiglutBtoAType ((icTagTypeSignature) 0x6d424120L) // mBA
|
|
343 |
#define icSigColorantTableType ((icTagTypeSignature) 0x636c7274L) // clrt
|
|
344 |
|
|
345 |
|
|
346 |
typedef struct {
|
|
347 |
icUInt8Number gridPoints[16]; // Number of grid points in each dimension.
|
|
348 |
icUInt8Number prec; // Precision of data elements in bytes.
|
|
349 |
icUInt8Number pad1;
|
|
350 |
icUInt8Number pad2;
|
|
351 |
icUInt8Number pad3;
|
|
352 |
/*icUInt8Number data[icAny]; Data follows see spec for size */
|
|
353 |
} icCLutStruct;
|
|
354 |
|
|
355 |
// icLutAtoB
|
|
356 |
typedef struct {
|
|
357 |
icUInt8Number inputChan; // Number of input channels
|
|
358 |
icUInt8Number outputChan; // Number of output channels
|
|
359 |
icUInt8Number pad1;
|
|
360 |
icUInt8Number pad2;
|
|
361 |
icUInt32Number offsetB; // Offset to first "B" curve
|
|
362 |
icUInt32Number offsetMat; // Offset to matrix
|
|
363 |
icUInt32Number offsetM; // Offset to first "M" curve
|
|
364 |
icUInt32Number offsetC; // Offset to CLUT
|
|
365 |
icUInt32Number offsetA; // Offset to first "A" curve
|
|
366 |
/*icUInt8Number data[icAny]; Data follows see spec for size */
|
|
367 |
} icLutAtoB;
|
|
368 |
|
|
369 |
// icLutBtoA
|
|
370 |
typedef struct {
|
|
371 |
icUInt8Number inputChan; // Number of input channels
|
|
372 |
icUInt8Number outputChan; // Number of output channels
|
|
373 |
icUInt8Number pad1;
|
|
374 |
icUInt8Number pad2;
|
|
375 |
icUInt32Number offsetB; // Offset to first "B" curve
|
|
376 |
icUInt32Number offsetMat; // Offset to matrix
|
|
377 |
icUInt32Number offsetM; // Offset to first "M" curve
|
|
378 |
icUInt32Number offsetC; // Offset to CLUT
|
|
379 |
icUInt32Number offsetA; // Offset to first "A" curve
|
|
380 |
/*icUInt8Number data[icAny]; Data follows see spec for size */
|
|
381 |
} icLutBtoA;
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
#ifdef __cplusplus
|
|
388 |
extern "C" {
|
|
389 |
#endif
|
|
390 |
|
|
391 |
// Calling convention
|
|
392 |
|
|
393 |
#ifdef NON_WINDOWS
|
|
394 |
# define LCMSEXPORT
|
|
395 |
# define LCMSAPI
|
|
396 |
#else
|
|
397 |
# ifdef LCMS_DLL
|
|
398 |
# ifdef __BORLANDC__
|
|
399 |
# define LCMSEXPORT __stdcall _export
|
|
400 |
# define LCMSAPI
|
|
401 |
# else
|
|
402 |
// VC++
|
|
403 |
# define LCMSEXPORT _stdcall
|
|
404 |
# ifdef LCMS_DLL_BUILD
|
|
405 |
# define LCMSAPI __declspec(dllexport)
|
|
406 |
# else
|
|
407 |
# define LCMSAPI __declspec(dllimport)
|
|
408 |
# endif
|
|
409 |
# endif
|
|
410 |
# else
|
|
411 |
# define LCMSEXPORT cdecl
|
|
412 |
# define LCMSAPI
|
|
413 |
# endif
|
|
414 |
#endif
|
|
415 |
|
|
416 |
#ifdef USE_ASSEMBLER
|
|
417 |
#ifdef __BORLANDC__
|
|
418 |
|
|
419 |
# define ASM asm
|
|
420 |
# define RET(v) return(v)
|
|
421 |
#else
|
|
422 |
// VC++
|
|
423 |
# define ASM __asm
|
|
424 |
# define RET(v) return
|
|
425 |
#endif
|
|
426 |
#endif
|
|
427 |
|
|
428 |
#ifdef _MSC_VER
|
|
429 |
#ifndef stricmp
|
|
430 |
# define stricmp _stricmp
|
|
431 |
#endif
|
|
432 |
#ifndef unlink
|
|
433 |
# define unlink _unlink
|
|
434 |
#endif
|
|
435 |
#ifndef swab
|
|
436 |
# define swab _swab
|
|
437 |
#endif
|
|
438 |
#ifndef itoa
|
|
439 |
# define itoa _itoa
|
|
440 |
#endif
|
|
441 |
#ifndef fileno
|
|
442 |
# define fileno _fileno
|
|
443 |
#endif
|
|
444 |
#ifndef strupr
|
|
445 |
# define strupr _strupr
|
|
446 |
#endif
|
|
447 |
#ifndef hypot
|
|
448 |
# define hypot _hypot
|
|
449 |
#endif
|
2394
|
450 |
#ifndef snprintf
|
|
451 |
# define snprintf _snprintf
|
|
452 |
#endif
|
|
453 |
#ifndef vsnprintf
|
|
454 |
# define vsnprintf _vsnprintf
|
|
455 |
#endif
|
|
456 |
|
|
457 |
|
2
|
458 |
#endif
|
|
459 |
|
|
460 |
|
|
461 |
#ifndef M_PI
|
|
462 |
# define M_PI 3.14159265358979323846
|
|
463 |
#endif
|
|
464 |
|
|
465 |
#ifndef LOGE
|
|
466 |
# define LOGE 0.4342944819
|
|
467 |
#endif
|
|
468 |
|
|
469 |
// ********** Little cms API ***************************************************
|
|
470 |
|
|
471 |
typedef LCMSHANDLE cmsHPROFILE; // Opaque typedefs to hide internals
|
|
472 |
typedef LCMSHANDLE cmsHTRANSFORM;
|
|
473 |
|
|
474 |
#define MAXCHANNELS 16 // Maximum number of channels
|
|
475 |
|
|
476 |
// Format of pixel is defined by one DWORD, using bit fields as follows
|
|
477 |
//
|
2394
|
478 |
// D TTTTT U Y F P X S EEE CCCC BBB
|
2
|
479 |
//
|
2394
|
480 |
// D: Use dither (8 bits only)
|
2
|
481 |
// T: Pixeltype
|
|
482 |
// F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
|
|
483 |
// P: Planar? 0=Chunky, 1=Planar
|
|
484 |
// X: swap 16 bps endianess?
|
|
485 |
// S: Do swap? ie, BGR, KYMC
|
|
486 |
// E: Extra samples
|
|
487 |
// C: Channels (Samples per pixel)
|
|
488 |
// B: Bytes per sample
|
|
489 |
// Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
|
|
490 |
|
|
491 |
|
2394
|
492 |
#define DITHER_SH(s) ((s) << 22)
|
2
|
493 |
#define COLORSPACE_SH(s) ((s) << 16)
|
|
494 |
#define SWAPFIRST_SH(s) ((s) << 14)
|
|
495 |
#define FLAVOR_SH(s) ((s) << 13)
|
|
496 |
#define PLANAR_SH(p) ((p) << 12)
|
|
497 |
#define ENDIAN16_SH(e) ((e) << 11)
|
|
498 |
#define DOSWAP_SH(e) ((e) << 10)
|
|
499 |
#define EXTRA_SH(e) ((e) << 7)
|
|
500 |
#define CHANNELS_SH(c) ((c) << 3)
|
|
501 |
#define BYTES_SH(b) (b)
|
|
502 |
|
|
503 |
// Pixel types
|
|
504 |
|
|
505 |
#define PT_ANY 0 // Don't check colorspace
|
|
506 |
// 1 & 2 are reserved
|
|
507 |
#define PT_GRAY 3
|
|
508 |
#define PT_RGB 4
|
|
509 |
#define PT_CMY 5
|
|
510 |
#define PT_CMYK 6
|
|
511 |
#define PT_YCbCr 7
|
|
512 |
#define PT_YUV 8 // Lu'v'
|
|
513 |
#define PT_XYZ 9
|
|
514 |
#define PT_Lab 10
|
|
515 |
#define PT_YUVK 11 // Lu'v'K
|
|
516 |
#define PT_HSV 12
|
|
517 |
#define PT_HLS 13
|
|
518 |
#define PT_Yxy 14
|
|
519 |
#define PT_HiFi 15
|
|
520 |
#define PT_HiFi7 16
|
|
521 |
#define PT_HiFi8 17
|
|
522 |
#define PT_HiFi9 18
|
|
523 |
#define PT_HiFi10 19
|
|
524 |
#define PT_HiFi11 20
|
|
525 |
#define PT_HiFi12 21
|
|
526 |
#define PT_HiFi13 22
|
|
527 |
#define PT_HiFi14 23
|
|
528 |
#define PT_HiFi15 24
|
|
529 |
|
|
530 |
#define NOCOLORSPACECHECK(x) ((x) & 0xFFFF)
|
|
531 |
|
|
532 |
// Some (not all!) representations
|
|
533 |
|
|
534 |
#ifndef TYPE_RGB_8 // TYPE_RGB_8 is a very common identifier, so don't include ours
|
|
535 |
// if user has it already defined.
|
|
536 |
|
|
537 |
#define TYPE_GRAY_8 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1))
|
|
538 |
#define TYPE_GRAY_8_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1))
|
|
539 |
#define TYPE_GRAY_16 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
|
|
540 |
#define TYPE_GRAY_16_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1))
|
|
541 |
#define TYPE_GRAY_16_SE (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
542 |
#define TYPE_GRAYA_8 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1))
|
|
543 |
#define TYPE_GRAYA_16 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2))
|
|
544 |
#define TYPE_GRAYA_16_SE (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
545 |
#define TYPE_GRAYA_8_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PLANAR_SH(1))
|
|
546 |
#define TYPE_GRAYA_16_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1))
|
|
547 |
|
|
548 |
#define TYPE_RGB_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
549 |
#define TYPE_RGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
550 |
#define TYPE_BGR_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
551 |
#define TYPE_BGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
|
|
552 |
#define TYPE_RGB_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
553 |
#define TYPE_RGB_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
554 |
#define TYPE_RGB_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
555 |
#define TYPE_BGR_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
556 |
#define TYPE_BGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
|
|
557 |
#define TYPE_BGR_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
558 |
|
|
559 |
#define TYPE_RGBA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
560 |
#define TYPE_RGBA_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
561 |
#define TYPE_RGBA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
562 |
#define TYPE_RGBA_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
563 |
#define TYPE_RGBA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
564 |
|
|
565 |
#define TYPE_ARGB_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1))
|
|
566 |
#define TYPE_ARGB_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
|
|
567 |
|
|
568 |
#define TYPE_ABGR_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
569 |
#define TYPE_ABGR_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
570 |
#define TYPE_ABGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
|
|
571 |
#define TYPE_ABGR_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
572 |
|
|
573 |
#define TYPE_BGRA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
|
|
574 |
#define TYPE_BGRA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
|
|
575 |
#define TYPE_BGRA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
|
|
576 |
|
|
577 |
#define TYPE_CMY_8 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
578 |
#define TYPE_CMY_8_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
579 |
#define TYPE_CMY_16 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
580 |
#define TYPE_CMY_16_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
581 |
#define TYPE_CMY_16_SE (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
582 |
|
|
583 |
#define TYPE_CMYK_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1))
|
|
584 |
#define TYPE_CMYKA_8 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1))
|
|
585 |
#define TYPE_CMYK_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1))
|
|
586 |
#define TYPE_YUVK_8 TYPE_CMYK_8_REV
|
|
587 |
#define TYPE_CMYK_8_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|PLANAR_SH(1))
|
|
588 |
#define TYPE_CMYK_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
|
|
589 |
#define TYPE_CMYK_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1))
|
|
590 |
#define TYPE_YUVK_16 TYPE_CMYK_16_REV
|
|
591 |
#define TYPE_CMYK_16_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|PLANAR_SH(1))
|
|
592 |
#define TYPE_CMYK_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
593 |
|
|
594 |
#define TYPE_KYMC_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
595 |
#define TYPE_KYMC_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
596 |
#define TYPE_KYMC_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
597 |
|
|
598 |
#define TYPE_KCMY_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1))
|
|
599 |
#define TYPE_KCMY_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
|
|
600 |
#define TYPE_KCMY_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1))
|
|
601 |
#define TYPE_KCMY_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
|
|
602 |
#define TYPE_KCMY_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
|
|
603 |
|
|
604 |
|
|
605 |
// HiFi separations, Thanks to Steven Greaves for providing the code,
|
|
606 |
// the colorspace is not checked
|
|
607 |
#define TYPE_CMYK5_8 (CHANNELS_SH(5)|BYTES_SH(1))
|
|
608 |
#define TYPE_CMYK5_16 (CHANNELS_SH(5)|BYTES_SH(2))
|
|
609 |
#define TYPE_CMYK5_16_SE (CHANNELS_SH(5)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
610 |
#define TYPE_KYMC5_8 (CHANNELS_SH(5)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
611 |
#define TYPE_KYMC5_16 (CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
612 |
#define TYPE_KYMC5_16_SE (CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
613 |
|
|
614 |
#define TYPE_CMYKcm_8 (CHANNELS_SH(6)|BYTES_SH(1))
|
|
615 |
#define TYPE_CMYKcm_8_PLANAR (CHANNELS_SH(6)|BYTES_SH(1)|PLANAR_SH(1))
|
|
616 |
#define TYPE_CMYKcm_16 (CHANNELS_SH(6)|BYTES_SH(2))
|
|
617 |
#define TYPE_CMYKcm_16_PLANAR (CHANNELS_SH(6)|BYTES_SH(2)|PLANAR_SH(1))
|
|
618 |
#define TYPE_CMYKcm_16_SE (CHANNELS_SH(6)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
619 |
|
|
620 |
// Separations with more than 6 channels aren't very standarized,
|
|
621 |
// Except most start with CMYK and add other colors, so I just used
|
|
622 |
// then total number of channels after CMYK i.e CMYK8_8
|
|
623 |
|
|
624 |
#define TYPE_CMYK7_8 (CHANNELS_SH(7)|BYTES_SH(1))
|
|
625 |
#define TYPE_CMYK7_16 (CHANNELS_SH(7)|BYTES_SH(2))
|
|
626 |
#define TYPE_CMYK7_16_SE (CHANNELS_SH(7)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
627 |
#define TYPE_KYMC7_8 (CHANNELS_SH(7)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
628 |
#define TYPE_KYMC7_16 (CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
629 |
#define TYPE_KYMC7_16_SE (CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
630 |
#define TYPE_CMYK8_8 (CHANNELS_SH(8)|BYTES_SH(1))
|
|
631 |
#define TYPE_CMYK8_16 (CHANNELS_SH(8)|BYTES_SH(2))
|
|
632 |
#define TYPE_CMYK8_16_SE (CHANNELS_SH(8)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
633 |
#define TYPE_KYMC8_8 (CHANNELS_SH(8)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
634 |
#define TYPE_KYMC8_16 (CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
635 |
#define TYPE_KYMC8_16_SE (CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
636 |
#define TYPE_CMYK9_8 (CHANNELS_SH(9)|BYTES_SH(1))
|
|
637 |
#define TYPE_CMYK9_16 (CHANNELS_SH(9)|BYTES_SH(2))
|
|
638 |
#define TYPE_CMYK9_16_SE (CHANNELS_SH(9)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
639 |
#define TYPE_KYMC9_8 (CHANNELS_SH(9)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
640 |
#define TYPE_KYMC9_16 (CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
641 |
#define TYPE_KYMC9_16_SE (CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
642 |
#define TYPE_CMYK10_8 (CHANNELS_SH(10)|BYTES_SH(1))
|
|
643 |
#define TYPE_CMYK10_16 (CHANNELS_SH(10)|BYTES_SH(2))
|
|
644 |
#define TYPE_CMYK10_16_SE (CHANNELS_SH(10)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
645 |
#define TYPE_KYMC10_8 (CHANNELS_SH(10)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
646 |
#define TYPE_KYMC10_16 (CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
647 |
#define TYPE_KYMC10_16_SE (CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
648 |
#define TYPE_CMYK11_8 (CHANNELS_SH(11)|BYTES_SH(1))
|
|
649 |
#define TYPE_CMYK11_16 (CHANNELS_SH(11)|BYTES_SH(2))
|
|
650 |
#define TYPE_CMYK11_16_SE (CHANNELS_SH(11)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
651 |
#define TYPE_KYMC11_8 (CHANNELS_SH(11)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
652 |
#define TYPE_KYMC11_16 (CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
653 |
#define TYPE_KYMC11_16_SE (CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
654 |
#define TYPE_CMYK12_8 (CHANNELS_SH(12)|BYTES_SH(1))
|
|
655 |
#define TYPE_CMYK12_16 (CHANNELS_SH(12)|BYTES_SH(2))
|
|
656 |
#define TYPE_CMYK12_16_SE (CHANNELS_SH(12)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
657 |
#define TYPE_KYMC12_8 (CHANNELS_SH(12)|BYTES_SH(1)|DOSWAP_SH(1))
|
|
658 |
#define TYPE_KYMC12_16 (CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1))
|
|
659 |
#define TYPE_KYMC12_16_SE (CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
|
|
660 |
|
|
661 |
// Colorimetric
|
|
662 |
|
|
663 |
#define TYPE_XYZ_16 (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
664 |
#define TYPE_Lab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
665 |
#define TYPE_ALab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|DOSWAP_SH(1))
|
|
666 |
#define TYPE_Lab_16 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
667 |
#define TYPE_Yxy_16 (COLORSPACE_SH(PT_Yxy)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
668 |
|
|
669 |
// YCbCr
|
|
670 |
|
|
671 |
#define TYPE_YCbCr_8 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
672 |
#define TYPE_YCbCr_8_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
673 |
#define TYPE_YCbCr_16 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
674 |
#define TYPE_YCbCr_16_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
675 |
#define TYPE_YCbCr_16_SE (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
676 |
|
|
677 |
// YUV
|
|
678 |
|
|
679 |
#define TYPE_YUV_8 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
680 |
#define TYPE_YUV_8_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
681 |
#define TYPE_YUV_16 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
682 |
#define TYPE_YUV_16_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
683 |
#define TYPE_YUV_16_SE (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
684 |
|
|
685 |
// HLS
|
|
686 |
|
|
687 |
#define TYPE_HLS_8 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
688 |
#define TYPE_HLS_8_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
689 |
#define TYPE_HLS_16 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
690 |
#define TYPE_HLS_16_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
691 |
#define TYPE_HLS_16_SE (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
692 |
|
|
693 |
|
|
694 |
// HSV
|
|
695 |
|
|
696 |
#define TYPE_HSV_8 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1))
|
|
697 |
#define TYPE_HSV_8_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
|
|
698 |
#define TYPE_HSV_16 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2))
|
|
699 |
#define TYPE_HSV_16_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
|
|
700 |
#define TYPE_HSV_16_SE (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
|
|
701 |
|
|
702 |
// Named color index. Only 16 bits allowed (don't check colorspace)
|
|
703 |
|
|
704 |
#define TYPE_NAMED_COLOR_INDEX (CHANNELS_SH(1)|BYTES_SH(2))
|
|
705 |
|
|
706 |
// Double values. Painful slow, but sometimes helpful. NOTE THAT 'BYTES' FIELD IS SET TO ZERO!
|
|
707 |
|
|
708 |
#define TYPE_XYZ_DBL (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
|
|
709 |
#define TYPE_Lab_DBL (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
|
|
710 |
#define TYPE_GRAY_DBL (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
|
|
711 |
#define TYPE_RGB_DBL (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
|
|
712 |
#define TYPE_CMYK_DBL (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))
|
|
713 |
|
|
714 |
#endif
|
|
715 |
|
|
716 |
|
|
717 |
// Gamma table parameters
|
|
718 |
|
|
719 |
typedef struct {
|
|
720 |
|
2394
|
721 |
unsigned int Crc32; // Has my table been touched?
|
|
722 |
|
|
723 |
// Keep initial parameters for further serialization
|
2
|
724 |
|
|
725 |
int Type;
|
|
726 |
double Params[10];
|
|
727 |
|
2394
|
728 |
} LCMSGAMMAPARAMS, FAR* LPLCMSGAMMAPARAMS;
|
2
|
729 |
|
|
730 |
// Gamma tables.
|
|
731 |
|
|
732 |
typedef struct {
|
|
733 |
|
2394
|
734 |
LCMSGAMMAPARAMS Seed; // Parameters used for table creation
|
2
|
735 |
|
|
736 |
// Table-based representation follows
|
|
737 |
|
|
738 |
int nEntries;
|
|
739 |
WORD GammaTable[1];
|
|
740 |
|
|
741 |
} GAMMATABLE;
|
|
742 |
|
|
743 |
typedef GAMMATABLE FAR* LPGAMMATABLE;
|
|
744 |
|
|
745 |
// Sampled curves (1D)
|
|
746 |
typedef struct {
|
|
747 |
|
|
748 |
int nItems;
|
|
749 |
double* Values;
|
|
750 |
|
|
751 |
} SAMPLEDCURVE;
|
|
752 |
|
|
753 |
typedef SAMPLEDCURVE FAR* LPSAMPLEDCURVE;
|
|
754 |
|
|
755 |
// Vectors
|
|
756 |
typedef struct { // Float Vector
|
|
757 |
|
|
758 |
double n[3];
|
|
759 |
|
|
760 |
} VEC3;
|
|
761 |
|
|
762 |
typedef VEC3 FAR* LPVEC3;
|
|
763 |
|
|
764 |
|
|
765 |
typedef struct { // Matrix
|
|
766 |
|
|
767 |
VEC3 v[3];
|
|
768 |
|
|
769 |
} MAT3;
|
|
770 |
|
|
771 |
typedef MAT3 FAR* LPMAT3;
|
|
772 |
|
|
773 |
// Colorspace values
|
|
774 |
typedef struct {
|
|
775 |
|
|
776 |
double X;
|
|
777 |
double Y;
|
|
778 |
double Z;
|
|
779 |
|
|
780 |
} cmsCIEXYZ;
|
|
781 |
|
|
782 |
typedef cmsCIEXYZ FAR* LPcmsCIEXYZ;
|
|
783 |
|
|
784 |
typedef struct {
|
|
785 |
|
|
786 |
double x;
|
|
787 |
double y;
|
|
788 |
double Y;
|
|
789 |
|
|
790 |
} cmsCIExyY;
|
|
791 |
|
|
792 |
typedef cmsCIExyY FAR* LPcmsCIExyY;
|
|
793 |
|
|
794 |
typedef struct {
|
|
795 |
|
|
796 |
double L;
|
|
797 |
double a;
|
|
798 |
double b;
|
|
799 |
|
|
800 |
} cmsCIELab;
|
|
801 |
|
|
802 |
typedef cmsCIELab FAR* LPcmsCIELab;
|
|
803 |
|
|
804 |
typedef struct {
|
|
805 |
|
|
806 |
double L;
|
|
807 |
double C;
|
|
808 |
double h;
|
|
809 |
|
|
810 |
} cmsCIELCh;
|
|
811 |
|
|
812 |
typedef cmsCIELCh FAR* LPcmsCIELCh;
|
|
813 |
|
|
814 |
typedef struct {
|
|
815 |
|
|
816 |
double J;
|
|
817 |
double C;
|
|
818 |
double h;
|
|
819 |
|
|
820 |
} cmsJCh;
|
|
821 |
|
|
822 |
typedef cmsJCh FAR* LPcmsJCh;
|
|
823 |
|
|
824 |
// Primaries
|
|
825 |
typedef struct {
|
|
826 |
|
|
827 |
cmsCIEXYZ Red;
|
|
828 |
cmsCIEXYZ Green;
|
|
829 |
cmsCIEXYZ Blue;
|
|
830 |
|
|
831 |
} cmsCIEXYZTRIPLE;
|
|
832 |
|
|
833 |
typedef cmsCIEXYZTRIPLE FAR* LPcmsCIEXYZTRIPLE;
|
|
834 |
|
|
835 |
|
|
836 |
typedef struct {
|
|
837 |
|
|
838 |
cmsCIExyY Red;
|
|
839 |
cmsCIExyY Green;
|
|
840 |
cmsCIExyY Blue;
|
|
841 |
|
|
842 |
} cmsCIExyYTRIPLE;
|
|
843 |
|
|
844 |
typedef cmsCIExyYTRIPLE FAR* LPcmsCIExyYTRIPLE;
|
|
845 |
|
|
846 |
|
|
847 |
|
|
848 |
// Following ICC spec
|
|
849 |
|
|
850 |
#define D50X (0.9642)
|
|
851 |
#define D50Y (1.0)
|
|
852 |
#define D50Z (0.8249)
|
|
853 |
|
|
854 |
#define PERCEPTUAL_BLACK_X (0.00336)
|
|
855 |
#define PERCEPTUAL_BLACK_Y (0.0034731)
|
|
856 |
#define PERCEPTUAL_BLACK_Z (0.00287)
|
|
857 |
|
|
858 |
// Does return pointers to constant structs
|
|
859 |
|
|
860 |
LCMSAPI LPcmsCIEXYZ LCMSEXPORT cmsD50_XYZ(void);
|
|
861 |
LCMSAPI LPcmsCIExyY LCMSEXPORT cmsD50_xyY(void);
|
|
862 |
|
|
863 |
|
|
864 |
// Input/Output
|
|
865 |
|
|
866 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
|
|
867 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, DWORD dwSize);
|
2394
|
868 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile);
|
2
|
869 |
|
|
870 |
// Predefined run-time profiles
|
|
871 |
|
|
872 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateRGBProfile(LPcmsCIExyY WhitePoint,
|
|
873 |
LPcmsCIExyYTRIPLE Primaries,
|
|
874 |
LPGAMMATABLE TransferFunction[3]);
|
|
875 |
|
|
876 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateGrayProfile(LPcmsCIExyY WhitePoint,
|
|
877 |
LPGAMMATABLE TransferFunction);
|
|
878 |
|
|
879 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateLinearizationDeviceLink(icColorSpaceSignature ColorSpace,
|
|
880 |
LPGAMMATABLE TransferFunctions[]);
|
|
881 |
|
|
882 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateInkLimitingDeviceLink(icColorSpaceSignature ColorSpace,
|
|
883 |
double Limit);
|
|
884 |
|
|
885 |
|
|
886 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateLabProfile(LPcmsCIExyY WhitePoint);
|
|
887 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateLab4Profile(LPcmsCIExyY WhitePoint);
|
|
888 |
|
|
889 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateXYZProfile(void);
|
|
890 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreate_sRGBProfile(void);
|
|
891 |
|
|
892 |
|
|
893 |
|
|
894 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateBCHSWabstractProfile(int nLUTPoints,
|
|
895 |
double Bright,
|
|
896 |
double Contrast,
|
|
897 |
double Hue,
|
|
898 |
double Saturation,
|
|
899 |
int TempSrc,
|
|
900 |
int TempDest);
|
|
901 |
|
|
902 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsCreateNULLProfile(void);
|
|
903 |
|
|
904 |
|
|
905 |
// Colorimetric space conversions
|
|
906 |
|
|
907 |
LCMSAPI void LCMSEXPORT cmsXYZ2xyY(LPcmsCIExyY Dest, const cmsCIEXYZ* Source);
|
|
908 |
LCMSAPI void LCMSEXPORT cmsxyY2XYZ(LPcmsCIEXYZ Dest, const cmsCIExyY* Source);
|
|
909 |
LCMSAPI void LCMSEXPORT cmsXYZ2Lab(LPcmsCIEXYZ WhitePoint, LPcmsCIELab Lab, const cmsCIEXYZ* xyz);
|
|
910 |
LCMSAPI void LCMSEXPORT cmsLab2XYZ(LPcmsCIEXYZ WhitePoint, LPcmsCIEXYZ xyz, const cmsCIELab* Lab);
|
|
911 |
LCMSAPI void LCMSEXPORT cmsLab2LCh(LPcmsCIELCh LCh, const cmsCIELab* Lab);
|
|
912 |
LCMSAPI void LCMSEXPORT cmsLCh2Lab(LPcmsCIELab Lab, const cmsCIELCh* LCh);
|
|
913 |
|
|
914 |
|
|
915 |
// CIELab handling
|
|
916 |
|
|
917 |
LCMSAPI double LCMSEXPORT cmsDeltaE(LPcmsCIELab Lab1, LPcmsCIELab Lab2);
|
|
918 |
LCMSAPI double LCMSEXPORT cmsCIE94DeltaE(LPcmsCIELab Lab1, LPcmsCIELab Lab2);
|
|
919 |
LCMSAPI double LCMSEXPORT cmsBFDdeltaE(LPcmsCIELab Lab1, LPcmsCIELab Lab2);
|
|
920 |
LCMSAPI double LCMSEXPORT cmsCMCdeltaE(LPcmsCIELab Lab1, LPcmsCIELab Lab2);
|
|
921 |
LCMSAPI double LCMSEXPORT cmsCIE2000DeltaE(LPcmsCIELab Lab1, LPcmsCIELab Lab2, double Kl, double Kc, double Kh);
|
|
922 |
|
|
923 |
LCMSAPI void LCMSEXPORT cmsClampLab(LPcmsCIELab Lab, double amax, double amin, double bmax, double bmin);
|
|
924 |
|
2394
|
925 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsWhitePointFromTemp(int TempK, LPcmsCIExyY WhitePoint);
|
|
926 |
|
|
927 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsAdaptToIlluminant(LPcmsCIEXYZ Result,
|
2
|
928 |
LPcmsCIEXYZ SourceWhitePt,
|
|
929 |
LPcmsCIEXYZ Illuminant,
|
|
930 |
LPcmsCIEXYZ Value);
|
|
931 |
|
2394
|
932 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsBuildRGB2XYZtransferMatrix(LPMAT3 r,
|
2
|
933 |
LPcmsCIExyY WhitePoint,
|
|
934 |
LPcmsCIExyYTRIPLE Primaries);
|
|
935 |
|
|
936 |
// Viewing conditions
|
|
937 |
|
|
938 |
#define AVG_SURROUND_4 0
|
|
939 |
#define AVG_SURROUND 1
|
|
940 |
#define DIM_SURROUND 2
|
|
941 |
#define DARK_SURROUND 3
|
|
942 |
#define CUTSHEET_SURROUND 4
|
|
943 |
|
|
944 |
#define D_CALCULATE (-1)
|
|
945 |
#define D_CALCULATE_DISCOUNT (-2)
|
|
946 |
|
|
947 |
typedef struct {
|
|
948 |
|
|
949 |
cmsCIEXYZ whitePoint;
|
|
950 |
double Yb;
|
|
951 |
double La;
|
|
952 |
int surround;
|
|
953 |
double D_value;
|
|
954 |
|
|
955 |
} cmsViewingConditions;
|
|
956 |
|
|
957 |
typedef cmsViewingConditions FAR* LPcmsViewingConditions;
|
|
958 |
|
|
959 |
// CIECAM97s
|
|
960 |
|
|
961 |
LCMSAPI LCMSHANDLE LCMSEXPORT cmsCIECAM97sInit(LPcmsViewingConditions pVC2);
|
|
962 |
LCMSAPI void LCMSEXPORT cmsCIECAM97sDone(LCMSHANDLE hModel);
|
|
963 |
LCMSAPI void LCMSEXPORT cmsCIECAM97sForward(LCMSHANDLE hModel, LPcmsCIEXYZ pIn, LPcmsJCh pOut);
|
|
964 |
LCMSAPI void LCMSEXPORT cmsCIECAM97sReverse(LCMSHANDLE hModel, LPcmsJCh pIn, LPcmsCIEXYZ pOut);
|
|
965 |
|
|
966 |
|
|
967 |
// CIECAM02
|
|
968 |
|
|
969 |
LCMSAPI LCMSHANDLE LCMSEXPORT cmsCIECAM02Init(LPcmsViewingConditions pVC);
|
|
970 |
LCMSAPI void LCMSEXPORT cmsCIECAM02Done(LCMSHANDLE hModel);
|
|
971 |
LCMSAPI void LCMSEXPORT cmsCIECAM02Forward(LCMSHANDLE hModel, LPcmsCIEXYZ pIn, LPcmsJCh pOut);
|
|
972 |
LCMSAPI void LCMSEXPORT cmsCIECAM02Reverse(LCMSHANDLE hModel, LPcmsJCh pIn, LPcmsCIEXYZ pOut);
|
|
973 |
|
|
974 |
|
|
975 |
// Gamma
|
|
976 |
|
|
977 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsBuildGamma(int nEntries, double Gamma);
|
|
978 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsBuildParametricGamma(int nEntries, int Type, double Params[]);
|
|
979 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsAllocGamma(int nEntries);
|
|
980 |
LCMSAPI void LCMSEXPORT cmsFreeGamma(LPGAMMATABLE Gamma);
|
|
981 |
LCMSAPI void LCMSEXPORT cmsFreeGammaTriple(LPGAMMATABLE Gamma[3]);
|
|
982 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsDupGamma(LPGAMMATABLE Src);
|
|
983 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsReverseGamma(int nResultSamples, LPGAMMATABLE InGamma);
|
|
984 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsJoinGamma(LPGAMMATABLE InGamma, LPGAMMATABLE OutGamma);
|
|
985 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsJoinGammaEx(LPGAMMATABLE InGamma, LPGAMMATABLE OutGamma, int nPoints);
|
2394
|
986 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsSmoothGamma(LPGAMMATABLE Tab, double lambda);
|
2
|
987 |
LCMSAPI double LCMSEXPORT cmsEstimateGamma(LPGAMMATABLE t);
|
|
988 |
LCMSAPI double LCMSEXPORT cmsEstimateGammaEx(LPWORD Table, int nEntries, double Thereshold);
|
|
989 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsReadICCGamma(cmsHPROFILE hProfile, icTagSignature sig);
|
|
990 |
LCMSAPI LPGAMMATABLE LCMSEXPORT cmsReadICCGammaReversed(cmsHPROFILE hProfile, icTagSignature sig);
|
|
991 |
|
|
992 |
// Access to Profile data.
|
|
993 |
|
2394
|
994 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeMediaWhitePoint(LPcmsCIEXYZ Dest, cmsHPROFILE hProfile);
|
|
995 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeMediaBlackPoint(LPcmsCIEXYZ Dest, cmsHPROFILE hProfile);
|
|
996 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeIluminant(LPcmsCIEXYZ Dest, cmsHPROFILE hProfile);
|
|
997 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeColorants(LPcmsCIEXYZTRIPLE Dest, cmsHPROFILE hProfile);
|
2
|
998 |
LCMSAPI DWORD LCMSEXPORT cmsTakeHeaderFlags(cmsHPROFILE hProfile);
|
|
999 |
LCMSAPI DWORD LCMSEXPORT cmsTakeHeaderAttributes(cmsHPROFILE hProfile);
|
|
1000 |
|
2394
|
1001 |
LCMSAPI void LCMSEXPORT cmsSetLanguage(const char LanguageCode[4], const char CountryCode[4]);
|
2
|
1002 |
LCMSAPI const char* LCMSEXPORT cmsTakeProductName(cmsHPROFILE hProfile);
|
|
1003 |
LCMSAPI const char* LCMSEXPORT cmsTakeProductDesc(cmsHPROFILE hProfile);
|
|
1004 |
LCMSAPI const char* LCMSEXPORT cmsTakeProductInfo(cmsHPROFILE hProfile);
|
|
1005 |
LCMSAPI const char* LCMSEXPORT cmsTakeManufacturer(cmsHPROFILE hProfile);
|
|
1006 |
LCMSAPI const char* LCMSEXPORT cmsTakeModel(cmsHPROFILE hProfile);
|
|
1007 |
LCMSAPI const char* LCMSEXPORT cmsTakeCopyright(cmsHPROFILE hProfile);
|
|
1008 |
LCMSAPI const BYTE* LCMSEXPORT cmsTakeProfileID(cmsHPROFILE hProfile);
|
|
1009 |
|
2394
|
1010 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeCreationDateTime(struct tm *Dest, cmsHPROFILE hProfile);
|
|
1011 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeCalibrationDateTime(struct tm *Dest, cmsHPROFILE hProfile);
|
|
1012 |
|
|
1013 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIsTag(cmsHPROFILE hProfile, icTagSignature sig);
|
2
|
1014 |
LCMSAPI int LCMSEXPORT cmsTakeRenderingIntent(cmsHPROFILE hProfile);
|
|
1015 |
|
2394
|
1016 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsTakeCharTargetData(cmsHPROFILE hProfile, char** Data, size_t* len);
|
2
|
1017 |
|
|
1018 |
LCMSAPI int LCMSEXPORT cmsReadICCTextEx(cmsHPROFILE hProfile, icTagSignature sig, char *Text, size_t size);
|
|
1019 |
LCMSAPI int LCMSEXPORT cmsReadICCText(cmsHPROFILE hProfile, icTagSignature sig, char *Text);
|
|
1020 |
|
|
1021 |
|
|
1022 |
#define LCMS_DESC_MAX 512
|
|
1023 |
|
|
1024 |
typedef struct {
|
|
1025 |
|
|
1026 |
icSignature deviceMfg;
|
|
1027 |
icSignature deviceModel;
|
|
1028 |
icUInt32Number attributes[2];
|
|
1029 |
icTechnologySignature technology;
|
|
1030 |
|
|
1031 |
char Manufacturer[LCMS_DESC_MAX];
|
|
1032 |
char Model[LCMS_DESC_MAX];
|
|
1033 |
|
|
1034 |
} cmsPSEQDESC, FAR *LPcmsPSEQDESC;
|
|
1035 |
|
|
1036 |
typedef struct {
|
|
1037 |
|
|
1038 |
int n;
|
|
1039 |
cmsPSEQDESC seq[1];
|
|
1040 |
|
|
1041 |
} cmsSEQ, FAR *LPcmsSEQ;
|
|
1042 |
|
|
1043 |
|
|
1044 |
LCMSAPI LPcmsSEQ LCMSEXPORT cmsReadProfileSequenceDescription(cmsHPROFILE hProfile);
|
|
1045 |
LCMSAPI void LCMSEXPORT cmsFreeProfileSequenceDescription(LPcmsSEQ pseq);
|
|
1046 |
|
|
1047 |
|
|
1048 |
// Translate form/to our notation to ICC
|
|
1049 |
LCMSAPI icColorSpaceSignature LCMSEXPORT _cmsICCcolorSpace(int OurNotation);
|
2394
|
1050 |
LCMSAPI int LCMSEXPORT _cmsLCMScolorSpace(icColorSpaceSignature ProfileSpace);
|
|
1051 |
LCMSAPI int LCMSEXPORT _cmsChannelsOf(icColorSpaceSignature ColorSpace);
|
|
1052 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsIsMatrixShaper(cmsHPROFILE hProfile);
|
|
1053 |
|
|
1054 |
// How profiles may be used
|
2
|
1055 |
#define LCMS_USED_AS_INPUT 0
|
|
1056 |
#define LCMS_USED_AS_OUTPUT 1
|
|
1057 |
#define LCMS_USED_AS_PROOF 2
|
|
1058 |
|
2394
|
1059 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, int Intent, int UsedDirection);
|
2
|
1060 |
|
|
1061 |
LCMSAPI icColorSpaceSignature LCMSEXPORT cmsGetPCS(cmsHPROFILE hProfile);
|
|
1062 |
LCMSAPI icColorSpaceSignature LCMSEXPORT cmsGetColorSpace(cmsHPROFILE hProfile);
|
|
1063 |
LCMSAPI icProfileClassSignature LCMSEXPORT cmsGetDeviceClass(cmsHPROFILE hProfile);
|
|
1064 |
LCMSAPI DWORD LCMSEXPORT cmsGetProfileICCversion(cmsHPROFILE hProfile);
|
|
1065 |
LCMSAPI void LCMSEXPORT cmsSetProfileICCversion(cmsHPROFILE hProfile, DWORD Version);
|
|
1066 |
LCMSAPI icInt32Number LCMSEXPORT cmsGetTagCount(cmsHPROFILE hProfile);
|
|
1067 |
LCMSAPI icTagSignature LCMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, icInt32Number n);
|
|
1068 |
|
|
1069 |
|
|
1070 |
LCMSAPI void LCMSEXPORT cmsSetDeviceClass(cmsHPROFILE hProfile, icProfileClassSignature sig);
|
|
1071 |
LCMSAPI void LCMSEXPORT cmsSetColorSpace(cmsHPROFILE hProfile, icColorSpaceSignature sig);
|
|
1072 |
LCMSAPI void LCMSEXPORT cmsSetPCS(cmsHPROFILE hProfile, icColorSpaceSignature pcs);
|
|
1073 |
LCMSAPI void LCMSEXPORT cmsSetRenderingIntent(cmsHPROFILE hProfile, int RenderingIntent);
|
|
1074 |
LCMSAPI void LCMSEXPORT cmsSetHeaderFlags(cmsHPROFILE hProfile, DWORD Flags);
|
|
1075 |
LCMSAPI void LCMSEXPORT cmsSetHeaderAttributes(cmsHPROFILE hProfile, DWORD Flags);
|
|
1076 |
LCMSAPI void LCMSEXPORT cmsSetProfileID(cmsHPROFILE hProfile, LPBYTE ProfileID);
|
|
1077 |
|
|
1078 |
// Intents
|
|
1079 |
|
|
1080 |
#define INTENT_PERCEPTUAL 0
|
|
1081 |
#define INTENT_RELATIVE_COLORIMETRIC 1
|
|
1082 |
#define INTENT_SATURATION 2
|
|
1083 |
#define INTENT_ABSOLUTE_COLORIMETRIC 3
|
|
1084 |
|
|
1085 |
// Flags
|
|
1086 |
|
|
1087 |
#define cmsFLAGS_MATRIXINPUT 0x0001
|
|
1088 |
#define cmsFLAGS_MATRIXOUTPUT 0x0002
|
|
1089 |
#define cmsFLAGS_MATRIXONLY (cmsFLAGS_MATRIXINPUT|cmsFLAGS_MATRIXOUTPUT)
|
|
1090 |
|
|
1091 |
#define cmsFLAGS_NOWHITEONWHITEFIXUP 0x0004 // Don't hot fix scum dot
|
|
1092 |
#define cmsFLAGS_NOPRELINEARIZATION 0x0010 // Don't create prelinearization tables
|
|
1093 |
// on precalculated transforms (internal use)
|
|
1094 |
|
|
1095 |
#define cmsFLAGS_GUESSDEVICECLASS 0x0020 // Guess device class (for transform2devicelink)
|
|
1096 |
|
|
1097 |
#define cmsFLAGS_NOTCACHE 0x0040 // Inhibit 1-pixel cache
|
|
1098 |
|
|
1099 |
#define cmsFLAGS_NOTPRECALC 0x0100
|
|
1100 |
#define cmsFLAGS_NULLTRANSFORM 0x0200 // Don't transform anyway
|
|
1101 |
#define cmsFLAGS_HIGHRESPRECALC 0x0400 // Use more memory to give better accurancy
|
|
1102 |
#define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resouces
|
|
1103 |
|
|
1104 |
|
|
1105 |
#define cmsFLAGS_WHITEBLACKCOMPENSATION 0x2000
|
|
1106 |
#define cmsFLAGS_BLACKPOINTCOMPENSATION cmsFLAGS_WHITEBLACKCOMPENSATION
|
|
1107 |
|
|
1108 |
// Proofing flags
|
|
1109 |
|
|
1110 |
#define cmsFLAGS_GAMUTCHECK 0x1000 // Out of Gamut alarm
|
|
1111 |
#define cmsFLAGS_SOFTPROOFING 0x4000 // Do softproofing
|
|
1112 |
|
|
1113 |
// Black preservation
|
|
1114 |
|
|
1115 |
#define cmsFLAGS_PRESERVEBLACK 0x8000
|
|
1116 |
|
|
1117 |
// CRD special
|
|
1118 |
|
2394
|
1119 |
#define cmsFLAGS_NODEFAULTRESOURCEDEF 0x01000000
|
2
|
1120 |
|
|
1121 |
// Gridpoints
|
|
1122 |
|
|
1123 |
#define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16)
|
|
1124 |
|
|
1125 |
|
|
1126 |
// Transforms
|
|
1127 |
|
|
1128 |
LCMSAPI cmsHTRANSFORM LCMSEXPORT cmsCreateTransform(cmsHPROFILE Input,
|
|
1129 |
DWORD InputFormat,
|
|
1130 |
cmsHPROFILE Output,
|
|
1131 |
DWORD OutputFormat,
|
|
1132 |
int Intent,
|
|
1133 |
DWORD dwFlags);
|
|
1134 |
|
|
1135 |
LCMSAPI cmsHTRANSFORM LCMSEXPORT cmsCreateProofingTransform(cmsHPROFILE Input,
|
|
1136 |
DWORD InputFormat,
|
|
1137 |
cmsHPROFILE Output,
|
|
1138 |
DWORD OutputFormat,
|
|
1139 |
cmsHPROFILE Proofing,
|
|
1140 |
int Intent,
|
|
1141 |
int ProofingIntent,
|
|
1142 |
DWORD dwFlags);
|
|
1143 |
|
|
1144 |
LCMSAPI cmsHTRANSFORM LCMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[],
|
|
1145 |
int nProfiles,
|
|
1146 |
DWORD InputFormat,
|
|
1147 |
DWORD OutputFormat,
|
|
1148 |
int Intent,
|
|
1149 |
DWORD dwFlags);
|
|
1150 |
|
|
1151 |
LCMSAPI void LCMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform);
|
|
1152 |
|
|
1153 |
LCMSAPI void LCMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform,
|
|
1154 |
LPVOID InputBuffer,
|
|
1155 |
LPVOID OutputBuffer,
|
|
1156 |
unsigned int Size);
|
|
1157 |
|
|
1158 |
LCMSAPI void LCMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, DWORD InputFormat, DWORD dwOutputFormat);
|
|
1159 |
|
|
1160 |
LCMSAPI void LCMSEXPORT cmsSetAlarmCodes(int r, int g, int b);
|
|
1161 |
LCMSAPI void LCMSEXPORT cmsGetAlarmCodes(int *r, int *g, int *b);
|
|
1162 |
|
|
1163 |
|
|
1164 |
// Adaptation state for absolute colorimetric intent
|
|
1165 |
|
|
1166 |
LCMSAPI double LCMSEXPORT cmsSetAdaptationState(double d);
|
|
1167 |
|
|
1168 |
|
|
1169 |
// Primary preservation strategy
|
|
1170 |
|
|
1171 |
#define LCMS_PRESERVE_PURE_K 0
|
|
1172 |
#define LCMS_PRESERVE_K_PLANE 1
|
|
1173 |
|
|
1174 |
LCMSAPI int LCMSEXPORT cmsSetCMYKPreservationStrategy(int n);
|
|
1175 |
|
|
1176 |
// Named color support
|
|
1177 |
typedef struct {
|
|
1178 |
char Name[MAX_PATH];
|
|
1179 |
WORD PCS[3];
|
|
1180 |
WORD DeviceColorant[MAXCHANNELS];
|
|
1181 |
|
|
1182 |
|
|
1183 |
} cmsNAMEDCOLOR, FAR* LPcmsNAMEDCOLOR;
|
|
1184 |
|
|
1185 |
typedef struct {
|
|
1186 |
int nColors;
|
|
1187 |
int Allocated;
|
|
1188 |
int ColorantCount;
|
|
1189 |
char Prefix[33];
|
|
1190 |
char Suffix[33];
|
|
1191 |
|
|
1192 |
cmsNAMEDCOLOR List[1];
|
|
1193 |
|
|
1194 |
} cmsNAMEDCOLORLIST, FAR* LPcmsNAMEDCOLORLIST;
|
|
1195 |
|
|
1196 |
// Named color support
|
|
1197 |
|
2394
|
1198 |
LCMSAPI int LCMSEXPORT cmsNamedColorCount(cmsHTRANSFORM xform);
|
|
1199 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsNamedColorInfo(cmsHTRANSFORM xform, int nColor, char* Name, char* Prefix, char* Suffix);
|
|
1200 |
LCMSAPI int LCMSEXPORT cmsNamedColorIndex(cmsHTRANSFORM xform, const char* Name);
|
2
|
1201 |
|
|
1202 |
// Colorant tables
|
|
1203 |
|
|
1204 |
LCMSAPI LPcmsNAMEDCOLORLIST LCMSEXPORT cmsReadColorantTable(cmsHPROFILE hProfile, icTagSignature sig);
|
|
1205 |
|
|
1206 |
// Profile creation
|
|
1207 |
|
2394
|
1208 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsAddTag(cmsHPROFILE hProfile, icTagSignature sig, const void* data);
|
2
|
1209 |
|
|
1210 |
// Converts a transform to a devicelink profile
|
|
1211 |
LCMSAPI cmsHPROFILE LCMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, DWORD dwFlags);
|
|
1212 |
|
|
1213 |
// Set the 'save as 8-bit' flag
|
|
1214 |
LCMSAPI void LCMSEXPORT _cmsSetLUTdepth(cmsHPROFILE hProfile, int depth);
|
|
1215 |
|
|
1216 |
|
|
1217 |
// Save profile
|
2394
|
1218 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsSaveProfile(cmsHPROFILE hProfile, const char* FileName);
|
|
1219 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr,
|
2
|
1220 |
size_t* BytesNeeded);
|
|
1221 |
|
|
1222 |
|
|
1223 |
|
|
1224 |
// PostScript ColorRenderingDictionary and ColorSpaceArray
|
|
1225 |
|
|
1226 |
LCMSAPI DWORD LCMSEXPORT cmsGetPostScriptCSA(cmsHPROFILE hProfile, int Intent, LPVOID Buffer, DWORD dwBufferLen);
|
|
1227 |
LCMSAPI DWORD LCMSEXPORT cmsGetPostScriptCRD(cmsHPROFILE hProfile, int Intent, LPVOID Buffer, DWORD dwBufferLen);
|
|
1228 |
LCMSAPI DWORD LCMSEXPORT cmsGetPostScriptCRDEx(cmsHPROFILE hProfile, int Intent, DWORD dwFlags, LPVOID Buffer, DWORD dwBufferLen);
|
|
1229 |
|
|
1230 |
|
|
1231 |
// Error handling
|
|
1232 |
|
|
1233 |
#define LCMS_ERROR_ABORT 0
|
|
1234 |
#define LCMS_ERROR_SHOW 1
|
|
1235 |
#define LCMS_ERROR_IGNORE 2
|
|
1236 |
|
|
1237 |
LCMSAPI int LCMSEXPORT cmsErrorAction(int nAction);
|
|
1238 |
|
|
1239 |
#define LCMS_ERRC_WARNING 0x1000
|
|
1240 |
#define LCMS_ERRC_RECOVERABLE 0x2000
|
|
1241 |
#define LCMS_ERRC_ABORTED 0x3000
|
|
1242 |
|
|
1243 |
typedef int (* cmsErrorHandlerFunction)(int ErrorCode, const char *ErrorText);
|
|
1244 |
|
|
1245 |
LCMSAPI void LCMSEXPORT cmsSetErrorHandler(cmsErrorHandlerFunction Fn);
|
|
1246 |
|
|
1247 |
|
|
1248 |
// LUT manipulation
|
|
1249 |
|
|
1250 |
|
|
1251 |
typedef struct _lcms_LUT_struc LUT, FAR* LPLUT; // opaque pointer
|
|
1252 |
|
|
1253 |
LCMSAPI LPLUT LCMSEXPORT cmsAllocLUT(void);
|
|
1254 |
LCMSAPI LPLUT LCMSEXPORT cmsAllocLinearTable(LPLUT NewLUT, LPGAMMATABLE Tables[], int nTable);
|
|
1255 |
LCMSAPI LPLUT LCMSEXPORT cmsAlloc3DGrid(LPLUT Lut, int clutPoints, int inputChan, int outputChan);
|
|
1256 |
LCMSAPI LPLUT LCMSEXPORT cmsSetMatrixLUT(LPLUT Lut, LPMAT3 M);
|
|
1257 |
LCMSAPI LPLUT LCMSEXPORT cmsSetMatrixLUT4(LPLUT Lut, LPMAT3 M, LPVEC3 off, DWORD dwFlags);
|
|
1258 |
LCMSAPI void LCMSEXPORT cmsFreeLUT(LPLUT Lut);
|
|
1259 |
LCMSAPI void LCMSEXPORT cmsEvalLUT(LPLUT Lut, WORD In[], WORD Out[]);
|
|
1260 |
LCMSAPI double LCMSEXPORT cmsEvalLUTreverse(LPLUT Lut, WORD Target[], WORD Result[], LPWORD Hint);
|
|
1261 |
LCMSAPI LPLUT LCMSEXPORT cmsReadICCLut(cmsHPROFILE hProfile, icTagSignature sig);
|
|
1262 |
LCMSAPI LPLUT LCMSEXPORT cmsDupLUT(LPLUT Orig);
|
|
1263 |
|
2394
|
1264 |
|
2
|
1265 |
// LUT Sampling
|
|
1266 |
|
|
1267 |
typedef int (* _cmsSAMPLER)(register WORD In[],
|
|
1268 |
register WORD Out[],
|
|
1269 |
register LPVOID Cargo);
|
|
1270 |
|
|
1271 |
#define SAMPLER_HASTL1 LUT_HASTL1
|
|
1272 |
#define SAMPLER_HASTL2 LUT_HASTL2
|
|
1273 |
#define SAMPLER_INSPECT 0x01000000
|
|
1274 |
|
|
1275 |
LCMSAPI int LCMSEXPORT cmsSample3DGrid(LPLUT Lut, _cmsSAMPLER Sampler, LPVOID Cargo, DWORD dwFlags);
|
|
1276 |
|
|
1277 |
// Formatters
|
|
1278 |
|
|
1279 |
typedef unsigned char* (* cmsFORMATTER)(register void* CMMcargo,
|
|
1280 |
register WORD ToUnroll[],
|
|
1281 |
register LPBYTE Buffer);
|
|
1282 |
|
|
1283 |
LCMSAPI void LCMSEXPORT cmsSetUserFormatters(cmsHTRANSFORM hTransform, DWORD dwInput, cmsFORMATTER Input,
|
|
1284 |
DWORD dwOutput, cmsFORMATTER Output);
|
|
1285 |
|
|
1286 |
LCMSAPI void LCMSEXPORT cmsGetUserFormatters(cmsHTRANSFORM hTransform,
|
|
1287 |
LPDWORD InputFormat, cmsFORMATTER* Input,
|
|
1288 |
LPDWORD OutputFormat, cmsFORMATTER* Output);
|
|
1289 |
|
|
1290 |
|
|
1291 |
// IT8.7 / CGATS.17-200x handling
|
|
1292 |
|
|
1293 |
LCMSAPI LCMSHANDLE LCMSEXPORT cmsIT8Alloc(void);
|
|
1294 |
LCMSAPI void LCMSEXPORT cmsIT8Free(LCMSHANDLE IT8);
|
|
1295 |
|
|
1296 |
// Tables
|
|
1297 |
|
|
1298 |
LCMSAPI int LCMSEXPORT cmsIT8TableCount(LCMSHANDLE IT8);
|
|
1299 |
LCMSAPI int LCMSEXPORT cmsIT8SetTable(LCMSHANDLE IT8, int nTable);
|
|
1300 |
|
|
1301 |
// Persistence
|
|
1302 |
LCMSAPI LCMSHANDLE LCMSEXPORT cmsIT8LoadFromFile(const char* cFileName);
|
|
1303 |
LCMSAPI LCMSHANDLE LCMSEXPORT cmsIT8LoadFromMem(void *Ptr, size_t len);
|
2394
|
1304 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SaveToFile(LCMSHANDLE IT8, const char* cFileName);
|
|
1305 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SaveToMem(LCMSHANDLE hIT8, void *MemPtr, size_t* BytesNeeded);
|
2
|
1306 |
|
|
1307 |
// Properties
|
|
1308 |
LCMSAPI const char* LCMSEXPORT cmsIT8GetSheetType(LCMSHANDLE hIT8);
|
2394
|
1309 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetSheetType(LCMSHANDLE hIT8, const char* Type);
|
|
1310 |
|
|
1311 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetComment(LCMSHANDLE hIT8, const char* cComment);
|
|
1312 |
|
|
1313 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetPropertyStr(LCMSHANDLE hIT8, const char* cProp, const char *Str);
|
|
1314 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetPropertyDbl(LCMSHANDLE hIT8, const char* cProp, double Val);
|
|
1315 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetPropertyHex(LCMSHANDLE hIT8, const char* cProp, int Val);
|
|
1316 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetPropertyMulti(LCMSHANDLE hIT8, const char* cProp, const char* cSubProp, const char *Val);
|
|
1317 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetPropertyUncooked(LCMSHANDLE hIT8, const char* Key, const char* Buffer);
|
2
|
1318 |
|
|
1319 |
|
|
1320 |
LCMSAPI const char* LCMSEXPORT cmsIT8GetProperty(LCMSHANDLE hIT8, const char* cProp);
|
|
1321 |
LCMSAPI double LCMSEXPORT cmsIT8GetPropertyDbl(LCMSHANDLE hIT8, const char* cProp);
|
2394
|
1322 |
LCMSAPI const char* LCMSEXPORT cmsIT8GetPropertyMulti(LCMSHANDLE hIT8, const char* cProp, const char *cSubProp);
|
|
1323 |
LCMSAPI int LCMSEXPORT cmsIT8EnumProperties(LCMSHANDLE hIT8, const char ***PropertyNames);
|
|
1324 |
LCMSAPI int LCMSEXPORT cmsIT8EnumPropertyMulti(LCMSHANDLE hIT8, const char* cProp, const char*** SubpropertyNames);
|
2
|
1325 |
|
|
1326 |
// Datasets
|
|
1327 |
|
|
1328 |
LCMSAPI const char* LCMSEXPORT cmsIT8GetDataRowCol(LCMSHANDLE IT8, int row, int col);
|
|
1329 |
LCMSAPI double LCMSEXPORT cmsIT8GetDataRowColDbl(LCMSHANDLE IT8, int row, int col);
|
|
1330 |
|
2394
|
1331 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetDataRowCol(LCMSHANDLE hIT8, int row, int col,
|
2
|
1332 |
const char* Val);
|
|
1333 |
|
2394
|
1334 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetDataRowColDbl(LCMSHANDLE hIT8, int row, int col,
|
2
|
1335 |
double Val);
|
|
1336 |
|
|
1337 |
LCMSAPI const char* LCMSEXPORT cmsIT8GetData(LCMSHANDLE IT8, const char* cPatch, const char* cSample);
|
|
1338 |
|
|
1339 |
|
|
1340 |
LCMSAPI double LCMSEXPORT cmsIT8GetDataDbl(LCMSHANDLE IT8, const char* cPatch, const char* cSample);
|
|
1341 |
|
2394
|
1342 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetData(LCMSHANDLE IT8, const char* cPatch,
|
2
|
1343 |
const char* cSample,
|
|
1344 |
const char *Val);
|
|
1345 |
|
2394
|
1346 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetDataDbl(LCMSHANDLE hIT8, const char* cPatch,
|
2
|
1347 |
const char* cSample,
|
|
1348 |
double Val);
|
|
1349 |
|
|
1350 |
LCMSAPI int LCMSEXPORT cmsIT8GetDataFormat(LCMSHANDLE hIT8, const char* cSample);
|
2394
|
1351 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetDataFormat(LCMSHANDLE IT8, int n, const char *Sample);
|
2
|
1352 |
LCMSAPI int LCMSEXPORT cmsIT8EnumDataFormat(LCMSHANDLE IT8, char ***SampleNames);
|
|
1353 |
|
|
1354 |
|
|
1355 |
LCMSAPI const char* LCMSEXPORT cmsIT8GetPatchName(LCMSHANDLE hIT8, int nPatch, char* buffer);
|
2394
|
1356 |
LCMSAPI int LCMSEXPORT cmsIT8GetPatchByName(LCMSHANDLE hIT8, const char *cSample);
|
2
|
1357 |
|
|
1358 |
// The LABEL extension
|
|
1359 |
|
|
1360 |
LCMSAPI int LCMSEXPORT cmsIT8SetTableByLabel(LCMSHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType);
|
|
1361 |
|
2394
|
1362 |
LCMSAPI LCMSBOOL LCMSEXPORT cmsIT8SetIndexColumn(LCMSHANDLE hIT8, const char* cSample);
|
|
1363 |
|
2
|
1364 |
// Formatter for double
|
|
1365 |
LCMSAPI void LCMSEXPORT cmsIT8DefineDblFormat(LCMSHANDLE IT8, const char* Formatter);
|
|
1366 |
|
|
1367 |
|
|
1368 |
// ***************************************************************************
|
|
1369 |
// End of Little cms API From here functions are private
|
|
1370 |
// You can use them only if using static libraries, and at your own risk of
|
|
1371 |
// be stripped or changed at futures releases.
|
|
1372 |
|
|
1373 |
#ifndef LCMS_APIONLY
|
|
1374 |
|
|
1375 |
|
|
1376 |
// Compatibility with anterior versions-- not needed anymore
|
|
1377 |
// -- Morge
|
|
1378 |
|
|
1379 |
LCMSAPI void LCMSEXPORT cmsLabEncoded2Float(LPcmsCIELab Lab, const WORD wLab[3]);
|
|
1380 |
LCMSAPI void LCMSEXPORT cmsLabEncoded2Float4(LPcmsCIELab Lab, const WORD wLab[3]);
|
|
1381 |
LCMSAPI void LCMSEXPORT cmsFloat2LabEncoded(WORD wLab[3], const cmsCIELab* Lab);
|
|
1382 |
LCMSAPI void LCMSEXPORT cmsFloat2LabEncoded4(WORD wLab[3], const cmsCIELab* Lab);
|
|
1383 |
LCMSAPI void LCMSEXPORT cmsXYZEncoded2Float(LPcmsCIEXYZ fxyz, const WORD XYZ[3]);
|
|
1384 |
LCMSAPI void LCMSEXPORT cmsFloat2XYZEncoded(WORD XYZ[3], const cmsCIEXYZ* fXYZ);
|
|
1385 |
|
|
1386 |
|
|
1387 |
// Profiling Extensions --- Would be removed from API in future revisions
|
|
1388 |
|
2394
|
1389 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddTextTag(cmsHPROFILE hProfile, icTagSignature sig, const char* Text);
|
|
1390 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddXYZTag(cmsHPROFILE hProfile, icTagSignature sig, const cmsCIEXYZ* XYZ);
|
|
1391 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddLUTTag(cmsHPROFILE hProfile, icTagSignature sig, const void* lut);
|
|
1392 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddGammaTag(cmsHPROFILE hProfile, icTagSignature sig, LPGAMMATABLE TransferFunction);
|
|
1393 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddChromaticityTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsCIExyYTRIPLE Chrm);
|
|
1394 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddSequenceDescriptionTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsSEQ PSeq);
|
|
1395 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddNamedColorTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsNAMEDCOLORLIST nc);
|
|
1396 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddDateTimeTag(cmsHPROFILE hProfile, icTagSignature sig, struct tm *DateTime);
|
|
1397 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddColorantTableTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsNAMEDCOLORLIST nc);
|
|
1398 |
LCMSAPI LCMSBOOL LCMSEXPORT _cmsAddChromaticAdaptationTag(cmsHPROFILE hProfile, icTagSignature sig, const cmsCIEXYZ* mat);
|
2
|
1399 |
|
|
1400 |
// --------------------------------------------------------------------------------------------------- Inline functions
|
|
1401 |
|
|
1402 |
// Fast floor conversion logic. Thanks to Sree Kotay and Stuart Nixon
|
|
1403 |
// note than this only works in the range ..-32767...+32767 because
|
|
1404 |
// mantissa is interpreted as 15.16 fixed point.
|
|
1405 |
// The union is to avoid pointer aliasing overoptimization.
|
|
1406 |
|
|
1407 |
LCMS_INLINE int _cmsQuickFloor(double val)
|
|
1408 |
{
|
|
1409 |
#ifdef USE_DEFAULT_FLOOR_CONVERSION
|
|
1410 |
return (int) floor(val);
|
|
1411 |
#else
|
|
1412 |
const double _lcms_double2fixmagic = 68719476736.0 * 1.5; // 2^36 * 1.5, (52-16=36) uses limited precision to floor
|
|
1413 |
union {
|
|
1414 |
double val;
|
|
1415 |
int halves[2];
|
|
1416 |
} temp;
|
|
1417 |
|
|
1418 |
temp.val = val + _lcms_double2fixmagic;
|
|
1419 |
|
|
1420 |
|
|
1421 |
#ifdef USE_BIG_ENDIAN
|
|
1422 |
return temp.halves[1] >> 16;
|
|
1423 |
#else
|
|
1424 |
return temp.halves[0] >> 16;
|
|
1425 |
#endif
|
|
1426 |
#endif
|
|
1427 |
}
|
|
1428 |
|
|
1429 |
|
|
1430 |
|
|
1431 |
// Clamp with saturation
|
|
1432 |
|
|
1433 |
LCMS_INLINE WORD _cmsClampWord(int in)
|
|
1434 |
{
|
|
1435 |
if (in < 0) return 0;
|
|
1436 |
if (in > 0xFFFF) return 0xFFFFU; // Including marker
|
|
1437 |
return (WORD) in;
|
|
1438 |
}
|
|
1439 |
|
2394
|
1440 |
#ifndef LCMS_USER_ALLOC
|
|
1441 |
|
|
1442 |
// Low-level alloc hook
|
|
1443 |
|
|
1444 |
LCMS_INLINE void* _cmsMalloc(size_t size)
|
|
1445 |
{
|
|
1446 |
if (size > ((size_t) 1024*1024*500)) return NULL; // Never allow over 500Mb
|
|
1447 |
if (size < 0) return NULL; // Prevent signed size_t exploits
|
|
1448 |
|
|
1449 |
return (void*) malloc(size);
|
|
1450 |
}
|
|
1451 |
|
|
1452 |
LCMS_INLINE void* _cmsCalloc(size_t nmemb, size_t size)
|
|
1453 |
{
|
|
1454 |
size_t alloc = nmemb * size;
|
|
1455 |
|
|
1456 |
if (size == 0) {
|
|
1457 |
return _cmsMalloc(0);
|
|
1458 |
}
|
|
1459 |
if (alloc / size != nmemb) {
|
|
1460 |
return NULL;
|
|
1461 |
}
|
|
1462 |
return _cmsMalloc(alloc);
|
|
1463 |
}
|
|
1464 |
|
|
1465 |
LCMS_INLINE void _cmsFree(void *Ptr)
|
|
1466 |
{
|
|
1467 |
if (Ptr) free(Ptr);
|
|
1468 |
}
|
|
1469 |
|
|
1470 |
#endif
|
|
1471 |
|
2
|
1472 |
// ------------------------------------------------------------------------------------------- end of inline functions
|
|
1473 |
|
|
1474 |
// Signal error from inside lcms code
|
|
1475 |
|
|
1476 |
void cdecl cmsSignalError(int ErrorCode, const char *ErrorText, ...);
|
|
1477 |
|
|
1478 |
// Alignment handling (needed in ReadLUT16 and ReadLUT8)
|
|
1479 |
|
|
1480 |
typedef struct {
|
|
1481 |
icS15Fixed16Number a;
|
|
1482 |
icUInt16Number b;
|
|
1483 |
|
|
1484 |
} _cmsTestAlign16;
|
|
1485 |
|
|
1486 |
#define SIZEOF_UINT16_ALIGNED (sizeof(_cmsTestAlign16) - sizeof(icS15Fixed16Number))
|
|
1487 |
|
|
1488 |
typedef struct {
|
|
1489 |
icS15Fixed16Number a;
|
|
1490 |
icUInt8Number b;
|
|
1491 |
|
|
1492 |
} _cmsTestAlign8;
|
|
1493 |
|
|
1494 |
#define SIZEOF_UINT8_ALIGNED (sizeof(_cmsTestAlign8) - sizeof(icS15Fixed16Number))
|
|
1495 |
|
|
1496 |
|
|
1497 |
// Fixed point
|
|
1498 |
|
|
1499 |
|
|
1500 |
typedef icInt32Number Fixed32; // Fixed 15.16 whith sign
|
|
1501 |
|
|
1502 |
#define INT_TO_FIXED(x) ((x)<<16)
|
|
1503 |
#define DOUBLE_TO_FIXED(x) ((Fixed32) ((x)*65536.0+0.5))
|
|
1504 |
#define FIXED_TO_INT(x) ((x)>>16)
|
|
1505 |
#define FIXED_REST_TO_INT(x) ((x)& 0xFFFFU)
|
|
1506 |
#define FIXED_TO_DOUBLE(x) (((double)x)/65536.0)
|
|
1507 |
#define ROUND_FIXED_TO_INT(x) (((x)+0x8000)>>16)
|
|
1508 |
|
|
1509 |
|
|
1510 |
Fixed32 cdecl FixedMul(Fixed32 a, Fixed32 b);
|
|
1511 |
Fixed32 cdecl FixedSquare(Fixed32 a);
|
|
1512 |
|
|
1513 |
|
|
1514 |
#ifdef USE_INLINE
|
|
1515 |
|
|
1516 |
LCMS_INLINE Fixed32 ToFixedDomain(int a) { return a + ((a + 0x7fff) / 0xffff); }
|
|
1517 |
LCMS_INLINE int FromFixedDomain(Fixed32 a) { return a - ((a + 0x7fff) >> 16); }
|
|
1518 |
|
|
1519 |
#else
|
|
1520 |
|
|
1521 |
Fixed32 cdecl ToFixedDomain(int a); // (a * 65536.0 / 65535.0)
|
|
1522 |
int cdecl FromFixedDomain(Fixed32 a); // (a * 65535.0 + .5)
|
|
1523 |
|
|
1524 |
#endif
|
|
1525 |
|
|
1526 |
Fixed32 cdecl FixedLERP(Fixed32 a, Fixed32 l, Fixed32 h);
|
|
1527 |
WORD cdecl FixedScale(WORD a, Fixed32 s);
|
|
1528 |
|
|
1529 |
// Vector & Matrix operations. I'm using the notation frequently found in
|
|
1530 |
// literature. Mostly 'Graphic Gems' samples. Not to be same routines.
|
|
1531 |
|
|
1532 |
// Vector members
|
|
1533 |
|
|
1534 |
#define VX 0
|
|
1535 |
#define VY 1
|
|
1536 |
#define VZ 2
|
|
1537 |
|
|
1538 |
typedef struct { // Fixed 15.16 bits vector
|
|
1539 |
Fixed32 n[3];
|
|
1540 |
} WVEC3, FAR* LPWVEC3;
|
|
1541 |
|
|
1542 |
typedef struct { // Matrix (Fixed 15.16)
|
|
1543 |
WVEC3 v[3];
|
|
1544 |
} WMAT3, FAR* LPWMAT3;
|
|
1545 |
|
|
1546 |
|
|
1547 |
|
2394
|
1548 |
void cdecl VEC3init(LPVEC3 r, double x, double y, double z); // double version
|
|
1549 |
void cdecl VEC3initF(LPWVEC3 r, double x, double y, double z); // Fix32 version
|
|
1550 |
void cdecl VEC3toFix(LPWVEC3 r, LPVEC3 v);
|
|
1551 |
void cdecl VEC3fromFix(LPVEC3 r, LPWVEC3 v);
|
|
1552 |
void cdecl VEC3scaleFix(LPWORD r, LPWVEC3 Scale);
|
|
1553 |
void cdecl VEC3swap(LPVEC3 a, LPVEC3 b);
|
|
1554 |
void cdecl VEC3divK(LPVEC3 r, LPVEC3 v, double d);
|
|
1555 |
void cdecl VEC3perK(LPVEC3 r, LPVEC3 v, double d);
|
|
1556 |
void cdecl VEC3minus(LPVEC3 r, LPVEC3 a, LPVEC3 b);
|
|
1557 |
void cdecl VEC3perComp(LPVEC3 r, LPVEC3 a, LPVEC3 b);
|
|
1558 |
LCMSBOOL cdecl VEC3equal(LPWVEC3 a, LPWVEC3 b, double Tolerance);
|
|
1559 |
LCMSBOOL cdecl VEC3equalF(LPVEC3 a, LPVEC3 b, double Tolerance);
|
|
1560 |
void cdecl VEC3scaleAndCut(LPWVEC3 r, LPVEC3 v, double d);
|
|
1561 |
void cdecl VEC3cross(LPVEC3 r, LPVEC3 u, LPVEC3 v);
|
|
1562 |
void cdecl VEC3saturate(LPVEC3 v);
|
|
1563 |
double cdecl VEC3distance(LPVEC3 a, LPVEC3 b);
|
|
1564 |
double cdecl VEC3length(LPVEC3 a);
|
|
1565 |
|
|
1566 |
void cdecl MAT3identity(LPMAT3 a);
|
|
1567 |
void cdecl MAT3per(LPMAT3 r, LPMAT3 a, LPMAT3 b);
|
|
1568 |
void cdecl MAT3perK(LPMAT3 r, LPMAT3 v, double d);
|
|
1569 |
int cdecl MAT3inverse(LPMAT3 a, LPMAT3 b);
|
|
1570 |
LCMSBOOL cdecl MAT3solve(LPVEC3 x, LPMAT3 a, LPVEC3 b);
|
|
1571 |
double cdecl MAT3det(LPMAT3 m);
|
|
1572 |
void cdecl MAT3eval(LPVEC3 r, LPMAT3 a, LPVEC3 v);
|
|
1573 |
void cdecl MAT3toFix(LPWMAT3 r, LPMAT3 v);
|
|
1574 |
void cdecl MAT3fromFix(LPMAT3 r, LPWMAT3 v);
|
|
1575 |
void cdecl MAT3evalW(LPWVEC3 r, LPWMAT3 a, LPWVEC3 v);
|
|
1576 |
LCMSBOOL cdecl MAT3isIdentity(LPWMAT3 a, double Tolerance);
|
|
1577 |
void cdecl MAT3scaleAndCut(LPWMAT3 r, LPMAT3 v, double d);
|
2
|
1578 |
|
|
1579 |
// Is a table linear?
|
|
1580 |
|
|
1581 |
int cdecl cmsIsLinear(WORD Table[], int nEntries);
|
|
1582 |
|
|
1583 |
// I hold this structures describing domain
|
|
1584 |
// details mainly for optimization purposes.
|
|
1585 |
|
|
1586 |
struct _lcms_l16params_struc;
|
|
1587 |
|
|
1588 |
typedef void (* _cms3DLERP)(WORD Input[],
|
|
1589 |
WORD Output[],
|
|
1590 |
WORD LutTable[],
|
|
1591 |
struct _lcms_l16params_struc* p);
|
|
1592 |
|
|
1593 |
|
|
1594 |
|
|
1595 |
typedef struct _lcms_l8opt_struc { // Used on 8 bit interpolations
|
|
1596 |
|
|
1597 |
unsigned int X0[256], Y0[256], Z0[256];
|
|
1598 |
WORD rx[256], ry[256], rz[256];
|
|
1599 |
|
|
1600 |
} L8PARAMS, FAR* LPL8PARAMS;
|
|
1601 |
|
|
1602 |
typedef struct _lcms_l16params_struc { // Used on 16 bits interpolations
|
|
1603 |
|
|
1604 |
int nSamples; // Valid on all kinds of tables
|
|
1605 |
int nInputs; // != 1 only in 3D interpolation
|
|
1606 |
int nOutputs; // != 1 only in 3D interpolation
|
|
1607 |
|
|
1608 |
WORD Domain;
|
|
1609 |
|
|
1610 |
int opta1, opta2;
|
|
1611 |
int opta3, opta4; // Optimization for 3D LUT
|
|
1612 |
int opta5, opta6;
|
|
1613 |
int opta7, opta8;
|
|
1614 |
|
|
1615 |
_cms3DLERP Interp3D; // The interpolation routine
|
|
1616 |
|
|
1617 |
LPL8PARAMS p8; // Points to some tables for 8-bit speedup
|
|
1618 |
|
|
1619 |
} L16PARAMS, *LPL16PARAMS;
|
|
1620 |
|
|
1621 |
|
|
1622 |
void cdecl cmsCalcL16Params(int nSamples, LPL16PARAMS p);
|
|
1623 |
void cdecl cmsCalcCLUT16Params(int nSamples, int InputChan, int OutputChan, LPL16PARAMS p);
|
|
1624 |
void cdecl cmsCalcCLUT16ParamsEx(int nSamples, int InputChan, int OutputChan,
|
2394
|
1625 |
LCMSBOOL lUseTetrahedral, LPL16PARAMS p);
|
2
|
1626 |
|
|
1627 |
WORD cdecl cmsLinearInterpLUT16(WORD Value, WORD LutTable[], LPL16PARAMS p);
|
|
1628 |
Fixed32 cdecl cmsLinearInterpFixed(WORD Value1, WORD LutTable[], LPL16PARAMS p);
|
|
1629 |
WORD cdecl cmsReverseLinearInterpLUT16(WORD Value, WORD LutTable[], LPL16PARAMS p);
|
|
1630 |
|
|
1631 |
void cdecl cmsTrilinearInterp16(WORD Input[],
|
|
1632 |
WORD Output[],
|
|
1633 |
WORD LutTable[],
|
|
1634 |
LPL16PARAMS p);
|
|
1635 |
|
|
1636 |
void cdecl cmsTetrahedralInterp16(WORD Input[],
|
|
1637 |
WORD Output[],
|
|
1638 |
WORD LutTable[], LPL16PARAMS p);
|
|
1639 |
|
|
1640 |
void cdecl cmsTetrahedralInterp8(WORD Input[],
|
|
1641 |
WORD Output[],
|
|
1642 |
WORD LutTable[], LPL16PARAMS p);
|
|
1643 |
|
|
1644 |
// LUT handling
|
|
1645 |
|
|
1646 |
#define LUT_HASMATRIX 0x0001 // Do-op Flags
|
|
1647 |
#define LUT_HASTL1 0x0002
|
|
1648 |
#define LUT_HASTL2 0x0008
|
|
1649 |
#define LUT_HAS3DGRID 0x0010
|
|
1650 |
|
|
1651 |
// New in rev 4.0 of ICC spec
|
|
1652 |
|
|
1653 |
#define LUT_HASMATRIX3 0x0020 // Matrix + offset for LutAToB
|
|
1654 |
#define LUT_HASMATRIX4 0x0040 // Matrix + offset for LutBToA
|
|
1655 |
|
|
1656 |
#define LUT_HASTL3 0x0100 // '3' curves for LutAToB
|
|
1657 |
#define LUT_HASTL4 0x0200 // '4' curves for LutBToA
|
|
1658 |
|
|
1659 |
// V4 emulation
|
|
1660 |
|
|
1661 |
#define LUT_V4_OUTPUT_EMULATE_V2 0x10000 // Is a V4 output LUT, emulating V2
|
|
1662 |
#define LUT_V4_INPUT_EMULATE_V2 0x20000 // Is a V4 input LUT, emulating V2
|
|
1663 |
#define LUT_V2_OUTPUT_EMULATE_V4 0x40000 // Is a V2 output LUT, emulating V4
|
|
1664 |
#define LUT_V2_INPUT_EMULATE_V4 0x80000 // Is a V2 input LUT, emulating V4
|
|
1665 |
|
|
1666 |
|
|
1667 |
struct _lcms_LUT_struc {
|
|
1668 |
|
|
1669 |
DWORD wFlags;
|
|
1670 |
WMAT3 Matrix; // 15fixed16 matrix
|
|
1671 |
|
|
1672 |
unsigned int InputChan;
|
|
1673 |
unsigned int OutputChan;
|
|
1674 |
unsigned int InputEntries;
|
|
1675 |
unsigned int OutputEntries;
|
|
1676 |
unsigned int cLutPoints;
|
|
1677 |
|
|
1678 |
|
|
1679 |
LPWORD L1[MAXCHANNELS]; // First linearization
|
|
1680 |
LPWORD L2[MAXCHANNELS]; // Last linearization
|
|
1681 |
|
|
1682 |
LPWORD T; // 3D CLUT
|
|
1683 |
unsigned int Tsize; // CLUT size in bytes
|
|
1684 |
|
|
1685 |
// Parameters & Optimizations
|
|
1686 |
|
|
1687 |
L16PARAMS In16params;
|
|
1688 |
L16PARAMS Out16params;
|
|
1689 |
L16PARAMS CLut16params;
|
|
1690 |
|
|
1691 |
int Intent; // Accomplished intent
|
|
1692 |
|
|
1693 |
// New for Rev 4.0 of spec (reserved)
|
|
1694 |
|
|
1695 |
WMAT3 Mat3;
|
|
1696 |
WVEC3 Ofs3;
|
|
1697 |
LPWORD L3[MAXCHANNELS];
|
|
1698 |
L16PARAMS L3params;
|
|
1699 |
unsigned int L3Entries;
|
|
1700 |
|
|
1701 |
WMAT3 Mat4;
|
|
1702 |
WVEC3 Ofs4;
|
|
1703 |
LPWORD L4[MAXCHANNELS];
|
|
1704 |
L16PARAMS L4params;
|
|
1705 |
unsigned int L4Entries;
|
|
1706 |
|
|
1707 |
// Gray axes fixup. Only on v2 8-bit Lab LUT
|
|
1708 |
|
2394
|
1709 |
LCMSBOOL FixGrayAxes;
|
|
1710 |
|
|
1711 |
|
|
1712 |
// Parameters used for curve creation
|
|
1713 |
|
|
1714 |
LCMSGAMMAPARAMS LCurvesSeed[4][MAXCHANNELS];
|
2
|
1715 |
|
|
1716 |
|
|
1717 |
}; // LUT, FAR* LPLUT;
|
|
1718 |
|
|
1719 |
|
2394
|
1720 |
LCMSBOOL cdecl _cmsSmoothEndpoints(LPWORD Table, int nEntries);
|
2
|
1721 |
|
|
1722 |
|
|
1723 |
// CRC of gamma tables
|
|
1724 |
|
|
1725 |
unsigned int _cmsCrc32OfGammaTable(LPGAMMATABLE Table);
|
|
1726 |
|
|
1727 |
// Sampled curves
|
|
1728 |
|
|
1729 |
LPSAMPLEDCURVE cdecl cmsAllocSampledCurve(int nItems);
|
|
1730 |
void cdecl cmsFreeSampledCurve(LPSAMPLEDCURVE p);
|
|
1731 |
LPSAMPLEDCURVE cdecl cmsDupSampledCurve(LPSAMPLEDCURVE p);
|
|
1732 |
|
|
1733 |
LPSAMPLEDCURVE cdecl cmsConvertGammaToSampledCurve(LPGAMMATABLE Gamma, int nPoints);
|
|
1734 |
LPGAMMATABLE cdecl cmsConvertSampledCurveToGamma(LPSAMPLEDCURVE Sampled, double Max);
|
|
1735 |
|
|
1736 |
void cdecl cmsEndpointsOfSampledCurve(LPSAMPLEDCURVE p, double* Min, double* Max);
|
|
1737 |
void cdecl cmsClampSampledCurve(LPSAMPLEDCURVE p, double Min, double Max);
|
2394
|
1738 |
LCMSBOOL cdecl cmsSmoothSampledCurve(LPSAMPLEDCURVE Tab, double SmoothingLambda);
|
2
|
1739 |
void cdecl cmsRescaleSampledCurve(LPSAMPLEDCURVE p, double Min, double Max, int nPoints);
|
|
1740 |
|
|
1741 |
LPSAMPLEDCURVE cdecl cmsJoinSampledCurves(LPSAMPLEDCURVE X, LPSAMPLEDCURVE Y, int nResultingPoints);
|
|
1742 |
|
|
1743 |
// Shaper/Matrix handling
|
|
1744 |
|
|
1745 |
#define MATSHAPER_HASMATRIX 0x0001 // Do-ops flags
|
|
1746 |
#define MATSHAPER_HASSHAPER 0x0002
|
|
1747 |
#define MATSHAPER_INPUT 0x0004 // Behaviour
|
|
1748 |
#define MATSHAPER_OUTPUT 0x0008
|
|
1749 |
#define MATSHAPER_HASINPSHAPER 0x0010
|
|
1750 |
#define MATSHAPER_ALLSMELTED (MATSHAPER_INPUT|MATSHAPER_OUTPUT)
|
|
1751 |
|
|
1752 |
|
|
1753 |
typedef struct {
|
|
1754 |
DWORD dwFlags;
|
|
1755 |
|
|
1756 |
WMAT3 Matrix;
|
|
1757 |
|
|
1758 |
L16PARAMS p16; // Primary curve
|
|
1759 |
LPWORD L[3];
|
|
1760 |
|
|
1761 |
L16PARAMS p2_16; // Secondary curve (used as input in smelted ones)
|
|
1762 |
LPWORD L2[3];
|
|
1763 |
|
|
1764 |
} MATSHAPER, FAR* LPMATSHAPER;
|
|
1765 |
|
|
1766 |
LPMATSHAPER cdecl cmsAllocMatShaper(LPMAT3 matrix, LPGAMMATABLE Shaper[], DWORD Behaviour);
|
|
1767 |
LPMATSHAPER cdecl cmsAllocMatShaper2(LPMAT3 matrix, LPGAMMATABLE In[], LPGAMMATABLE Out[], DWORD Behaviour);
|
|
1768 |
|
|
1769 |
void cdecl cmsFreeMatShaper(LPMATSHAPER MatShaper);
|
|
1770 |
void cdecl cmsEvalMatShaper(LPMATSHAPER MatShaper, WORD In[], WORD Out[]);
|
|
1771 |
|
2394
|
1772 |
LCMSBOOL cdecl cmsReadICCMatrixRGB2XYZ(LPMAT3 r, cmsHPROFILE hProfile);
|
|
1773 |
|
|
1774 |
LPMATSHAPER cdecl cmsBuildInputMatrixShaper(cmsHPROFILE InputProfile);
|
|
1775 |
LPMATSHAPER cdecl cmsBuildOutputMatrixShaper(cmsHPROFILE OutputProfile);
|
2
|
1776 |
|
|
1777 |
|
|
1778 |
|
|
1779 |
// White Point & Primary chromas handling
|
2394
|
1780 |
LCMSBOOL cdecl cmsAdaptationMatrix(LPMAT3 r, LPMAT3 ConeMatrix, LPcmsCIEXYZ FromIll, LPcmsCIEXYZ ToIll);
|
|
1781 |
LCMSBOOL cdecl cmsAdaptMatrixToD50(LPMAT3 r, LPcmsCIExyY SourceWhitePt);
|
|
1782 |
LCMSBOOL cdecl cmsAdaptMatrixFromD50(LPMAT3 r, LPcmsCIExyY DestWhitePt);
|
|
1783 |
|
|
1784 |
LCMSBOOL cdecl cmsReadChromaticAdaptationMatrix(LPMAT3 r, cmsHPROFILE hProfile);
|
2
|
1785 |
|
|
1786 |
// Inter-PCS conversion routines. They assume D50 as white point.
|
|
1787 |
void cdecl cmsXYZ2LabEncoded(WORD XYZ[3], WORD Lab[3]);
|
|
1788 |
void cdecl cmsLab2XYZEncoded(WORD Lab[3], WORD XYZ[3]);
|
|
1789 |
|
|
1790 |
// Retrieve text representation of WP
|
|
1791 |
void cdecl _cmsIdentifyWhitePoint(char *Buffer, LPcmsCIEXYZ WhitePt);
|
|
1792 |
|
|
1793 |
// Quantize to WORD in a (MaxSamples - 1) domain
|
|
1794 |
WORD cdecl _cmsQuantizeVal(double i, int MaxSamples);
|
|
1795 |
|
|
1796 |
LPcmsNAMEDCOLORLIST cdecl cmsAllocNamedColorList(int n);
|
|
1797 |
int cdecl cmsReadICCnamedColorList(cmsHTRANSFORM xform, cmsHPROFILE hProfile, icTagSignature sig);
|
|
1798 |
void cdecl cmsFreeNamedColorList(LPcmsNAMEDCOLORLIST List);
|
2394
|
1799 |
LCMSBOOL cdecl cmsAppendNamedColor(cmsHTRANSFORM xform, const char* Name, WORD PCS[3], WORD Colorant[MAXCHANNELS]);
|
2
|
1800 |
|
|
1801 |
|
|
1802 |
// I/O
|
|
1803 |
|
|
1804 |
#define MAX_TABLE_TAG 100
|
|
1805 |
|
|
1806 |
// This is the internal struct holding profile details.
|
|
1807 |
|
|
1808 |
typedef struct _lcms_iccprofile_struct {
|
|
1809 |
|
|
1810 |
void* stream; // Associated stream. If NULL,
|
|
1811 |
// tags are supposed to be in
|
|
1812 |
// memory rather than in a file.
|
|
1813 |
|
|
1814 |
// Only most important items found in ICC profile
|
|
1815 |
|
|
1816 |
icProfileClassSignature DeviceClass;
|
|
1817 |
icColorSpaceSignature ColorSpace;
|
|
1818 |
icColorSpaceSignature PCS;
|
|
1819 |
icRenderingIntent RenderingIntent;
|
|
1820 |
icUInt32Number flags;
|
2394
|
1821 |
icUInt32Number attributes;
|
2
|
1822 |
cmsCIEXYZ Illuminant;
|
|
1823 |
|
|
1824 |
// Additions for V4 profiles
|
|
1825 |
|
|
1826 |
icUInt32Number Version;
|
|
1827 |
MAT3 ChromaticAdaptation;
|
|
1828 |
cmsCIEXYZ MediaWhitePoint;
|
|
1829 |
cmsCIEXYZ MediaBlackPoint;
|
|
1830 |
BYTE ProfileID[16];
|
|
1831 |
|
|
1832 |
|
|
1833 |
// Dictionary
|
|
1834 |
|
|
1835 |
icInt32Number TagCount;
|
|
1836 |
icTagSignature TagNames[MAX_TABLE_TAG];
|
|
1837 |
size_t TagSizes[MAX_TABLE_TAG];
|
|
1838 |
size_t TagOffsets[MAX_TABLE_TAG];
|
|
1839 |
LPVOID TagPtrs[MAX_TABLE_TAG];
|
|
1840 |
|
|
1841 |
char PhysicalFile[MAX_PATH];
|
|
1842 |
|
2394
|
1843 |
LCMSBOOL IsWrite;
|
|
1844 |
LCMSBOOL SaveAs8Bits;
|
2
|
1845 |
|
|
1846 |
struct tm Created;
|
|
1847 |
|
|
1848 |
// I/O handlers
|
|
1849 |
|
2394
|
1850 |
size_t (* Read)(void *buffer, size_t size, size_t count, struct _lcms_iccprofile_struct* Icc);
|
|
1851 |
|
|
1852 |
LCMSBOOL (* Seek)(struct _lcms_iccprofile_struct* Icc, size_t offset);
|
|
1853 |
LCMSBOOL (* Close)(struct _lcms_iccprofile_struct* Icc);
|
|
1854 |
size_t (* Tell)(struct _lcms_iccprofile_struct* Icc);
|
|
1855 |
LCMSBOOL (* Grow)(struct _lcms_iccprofile_struct* Icc, size_t amount);
|
2
|
1856 |
|
|
1857 |
// Writting
|
|
1858 |
|
2394
|
1859 |
LCMSBOOL (* Write)(struct _lcms_iccprofile_struct* Icc, size_t size, LPVOID Ptr);
|
2
|
1860 |
|
|
1861 |
size_t UsedSpace;
|
|
1862 |
|
|
1863 |
|
|
1864 |
} LCMSICCPROFILE, FAR* LPLCMSICCPROFILE;
|
|
1865 |
|
|
1866 |
|
|
1867 |
// Create an empty template for virtual profiles
|
|
1868 |
cmsHPROFILE cdecl _cmsCreateProfilePlaceholder(void);
|
|
1869 |
|
|
1870 |
// Search into tag dictionary
|
2394
|
1871 |
icInt32Number cdecl _cmsSearchTag(LPLCMSICCPROFILE Profile, icTagSignature sig, LCMSBOOL lSignalError);
|
2
|
1872 |
|
|
1873 |
// Search for a particular tag, replace if found or add new one else
|
|
1874 |
LPVOID _cmsInitTag(LPLCMSICCPROFILE Icc, icTagSignature sig, size_t size, const void* Init);
|
|
1875 |
|
|
1876 |
|
|
1877 |
LPLCMSICCPROFILE cdecl _cmsCreateProfileFromFilePlaceholder(const char* FileName);
|
|
1878 |
LPLCMSICCPROFILE cdecl _cmsCreateProfileFromMemPlaceholder(LPVOID MemPtr, DWORD dwSize);
|
|
1879 |
|
|
1880 |
void _cmsSetSaveToDisk(LPLCMSICCPROFILE Icc, const char* FileName);
|
|
1881 |
void _cmsSetSaveToMemory(LPLCMSICCPROFILE Icc, LPVOID MemPtr, size_t dwSize);
|
|
1882 |
|
|
1883 |
|
|
1884 |
|
|
1885 |
// These macros unpack format specifiers into integers
|
|
1886 |
|
2394
|
1887 |
#define T_DITHER(s) (((s)>>22)&1)
|
2
|
1888 |
#define T_COLORSPACE(s) (((s)>>16)&31)
|
|
1889 |
#define T_SWAPFIRST(s) (((s)>>14)&1)
|
|
1890 |
#define T_FLAVOR(s) (((s)>>13)&1)
|
|
1891 |
#define T_PLANAR(p) (((p)>>12)&1)
|
|
1892 |
#define T_ENDIAN16(e) (((e)>>11)&1)
|
|
1893 |
#define T_DOSWAP(e) (((e)>>10)&1)
|
|
1894 |
#define T_EXTRA(e) (((e)>>7)&7)
|
|
1895 |
#define T_CHANNELS(c) (((c)>>3)&15)
|
|
1896 |
#define T_BYTES(b) ((b)&7)
|
|
1897 |
|
|
1898 |
|
|
1899 |
|
|
1900 |
// Internal XFORM struct
|
|
1901 |
struct _cmstransform_struct;
|
|
1902 |
|
|
1903 |
// Full xform
|
|
1904 |
typedef void (* _cmsCOLORCALLBACKFN)(struct _cmstransform_struct *Transform,
|
|
1905 |
LPVOID InputBuffer,
|
|
1906 |
LPVOID OutputBuffer, unsigned int Size);
|
|
1907 |
|
|
1908 |
// intermediate pass, from WORD[] to WORD[]
|
|
1909 |
|
|
1910 |
typedef void (* _cmsADJFN)(WORD In[], WORD Out[], LPWMAT3 m, LPWVEC3 b);
|
|
1911 |
|
|
1912 |
typedef void (* _cmsTRANSFN)(struct _cmstransform_struct *Transform,
|
|
1913 |
WORD In[], WORD Out[]);
|
|
1914 |
|
|
1915 |
typedef void (* _cmsCNVRT)(WORD In[], WORD Out[]);
|
|
1916 |
|
|
1917 |
typedef LPBYTE (* _cmsFIXFN)(register struct _cmstransform_struct *info,
|
|
1918 |
register WORD ToUnroll[],
|
|
1919 |
register LPBYTE Buffer);
|
|
1920 |
|
|
1921 |
|
|
1922 |
|
|
1923 |
// Transformation
|
|
1924 |
typedef struct _cmstransform_struct {
|
|
1925 |
|
|
1926 |
// Keep formats for further reference
|
|
1927 |
DWORD InputFormat, OutputFormat;
|
|
1928 |
|
|
1929 |
DWORD StrideIn, StrideOut; // Planar support
|
|
1930 |
|
|
1931 |
int Intent, ProofIntent;
|
|
1932 |
int DoGamutCheck;
|
|
1933 |
|
|
1934 |
|
|
1935 |
cmsHPROFILE InputProfile;
|
|
1936 |
cmsHPROFILE OutputProfile;
|
|
1937 |
cmsHPROFILE PreviewProfile;
|
|
1938 |
|
|
1939 |
icColorSpaceSignature EntryColorSpace;
|
|
1940 |
icColorSpaceSignature ExitColorSpace;
|
|
1941 |
|
|
1942 |
DWORD dwOriginalFlags; // Flags as specified by user
|
|
1943 |
|
|
1944 |
WMAT3 m1, m2; // Matrix holding inter PCS operation
|
|
1945 |
WVEC3 of1, of2; // Offset terms
|
|
1946 |
|
|
1947 |
_cmsCOLORCALLBACKFN xform;
|
|
1948 |
|
|
1949 |
// Steps in xFORM
|
|
1950 |
|
|
1951 |
_cmsFIXFN FromInput;
|
|
1952 |
_cmsTRANSFN FromDevice;
|
|
1953 |
_cmsADJFN Stage1;
|
|
1954 |
_cmsADJFN Stage2;
|
|
1955 |
_cmsTRANSFN ToDevice;
|
|
1956 |
_cmsFIXFN ToOutput;
|
|
1957 |
|
|
1958 |
// LUTs
|
|
1959 |
|
|
1960 |
LPLUT Device2PCS;
|
|
1961 |
LPLUT PCS2Device;
|
|
1962 |
LPLUT Gamut; // Gamut check
|
|
1963 |
LPLUT Preview; // Preview (Proof)
|
|
1964 |
|
|
1965 |
LPLUT DeviceLink; // Precalculated grid - device link profile
|
|
1966 |
LPLUT GamutCheck; // Precalculated device -> gamut check
|
|
1967 |
|
|
1968 |
// Matrix/Shapers
|
|
1969 |
|
|
1970 |
LPMATSHAPER InMatShaper;
|
|
1971 |
LPMATSHAPER OutMatShaper;
|
|
1972 |
LPMATSHAPER SmeltMatShaper;
|
|
1973 |
|
|
1974 |
// Phase of Lab/XYZ, Abs/Rel
|
|
1975 |
|
|
1976 |
int Phase1, Phase2, Phase3;
|
|
1977 |
|
|
1978 |
// Named color table
|
|
1979 |
|
|
1980 |
LPcmsNAMEDCOLORLIST NamedColorList;
|
|
1981 |
|
|
1982 |
// Flag for transform involving v4 profiles
|
|
1983 |
|
2394
|
1984 |
LCMSBOOL lInputV4Lab, lOutputV4Lab;
|
2
|
1985 |
|
|
1986 |
|
|
1987 |
// 1-pixel cache
|
|
1988 |
|
|
1989 |
WORD CacheIn[MAXCHANNELS];
|
|
1990 |
WORD CacheOut[MAXCHANNELS];
|
|
1991 |
|
|
1992 |
double AdaptationState; // Figure for v4 incomplete state of adaptation
|
|
1993 |
|
2394
|
1994 |
LCMS_RWLOCK_T rwlock;
|
2
|
1995 |
|
|
1996 |
} _cmsTRANSFORM,FAR *_LPcmsTRANSFORM;
|
|
1997 |
|
|
1998 |
|
|
1999 |
|
|
2000 |
// Packing & Unpacking
|
|
2001 |
|
|
2002 |
_cmsFIXFN cdecl _cmsIdentifyInputFormat(_LPcmsTRANSFORM xform, DWORD dwInput);
|
|
2003 |
_cmsFIXFN cdecl _cmsIdentifyOutputFormat(_LPcmsTRANSFORM xform, DWORD dwOutput);
|
|
2004 |
|
|
2005 |
|
|
2006 |
// Conversion
|
|
2007 |
|
|
2008 |
#define XYZRel 0
|
|
2009 |
#define LabRel 1
|
|
2010 |
|
|
2011 |
|
|
2012 |
int cdecl cmsChooseCnvrt(int Absolute,
|
|
2013 |
int Phase1, LPcmsCIEXYZ BlackPointIn,
|
|
2014 |
LPcmsCIEXYZ WhitePointIn,
|
|
2015 |
LPcmsCIEXYZ IlluminantIn,
|
|
2016 |
LPMAT3 ChromaticAdaptationMatrixIn,
|
|
2017 |
|
|
2018 |
int Phase2, LPcmsCIEXYZ BlackPointOut,
|
|
2019 |
LPcmsCIEXYZ WhitePointOut,
|
|
2020 |
LPcmsCIEXYZ IlluminantOut,
|
|
2021 |
LPMAT3 ChromaticAdaptationMatrixOut,
|
|
2022 |
int DoBPC,
|
|
2023 |
double AdaptationState,
|
|
2024 |
_cmsADJFN *fn1,
|
|
2025 |
LPWMAT3 wm, LPWVEC3 wof);
|
|
2026 |
|
|
2027 |
|
|
2028 |
|
|
2029 |
// Clamping & Gamut handling
|
|
2030 |
|
2394
|
2031 |
LCMSBOOL cdecl _cmsEndPointsBySpace(icColorSpaceSignature Space,
|
2
|
2032 |
WORD **White, WORD **Black, int *nOutputs);
|
|
2033 |
|
|
2034 |
WORD * cdecl _cmsWhiteBySpace(icColorSpaceSignature Space);
|
|
2035 |
|
|
2036 |
|
|
2037 |
|
|
2038 |
WORD cdecl Clamp_L(Fixed32 in);
|
|
2039 |
WORD cdecl Clamp_ab(Fixed32 in);
|
|
2040 |
|
|
2041 |
// Detection of black point
|
|
2042 |
|
|
2043 |
#define LCMS_BPFLAGS_D50_ADAPTED 0x0001
|
|
2044 |
|
|
2045 |
int cdecl cmsDetectBlackPoint(LPcmsCIEXYZ BlackPoint, cmsHPROFILE hProfile, int Intent, DWORD dwFlags);
|
|
2046 |
|
|
2047 |
// choose reasonable resolution
|
|
2048 |
int cdecl _cmsReasonableGridpointsByColorspace(icColorSpaceSignature Colorspace, DWORD dwFlags);
|
|
2049 |
|
|
2050 |
// Precalculate device link
|
|
2051 |
LPLUT cdecl _cmsPrecalculateDeviceLink(cmsHTRANSFORM h, DWORD dwFlags);
|
|
2052 |
|
|
2053 |
// Precalculate black preserving device link
|
|
2054 |
LPLUT _cmsPrecalculateBlackPreservingDeviceLink(cmsHTRANSFORM hCMYK2CMYK, DWORD dwFlags);
|
|
2055 |
|
|
2056 |
// Precalculate gamut check
|
|
2057 |
LPLUT cdecl _cmsPrecalculateGamutCheck(cmsHTRANSFORM h);
|
|
2058 |
|
|
2059 |
// Hot fixes bad profiles
|
2394
|
2060 |
LCMSBOOL cdecl _cmsFixWhiteMisalignment(_LPcmsTRANSFORM p);
|
2
|
2061 |
|
|
2062 |
// Marks LUT as 8 bit on input
|
|
2063 |
LPLUT cdecl _cmsBlessLUT8(LPLUT Lut);
|
|
2064 |
|
|
2065 |
// Compute gamut boundary
|
|
2066 |
LPLUT cdecl _cmsComputeGamutLUT(cmsHPROFILE hProfile, int Intent);
|
|
2067 |
|
|
2068 |
// Compute softproof
|
|
2069 |
LPLUT cdecl _cmsComputeSoftProofLUT(cmsHPROFILE hProfile, int nIntent);
|
|
2070 |
|
|
2071 |
// Find a suitable prelinearization tables, matching the given transform
|
|
2072 |
void cdecl _cmsComputePrelinearizationTablesFromXFORM(cmsHTRANSFORM h[], int nTransforms, LPLUT Grid);
|
|
2073 |
|
|
2074 |
|
|
2075 |
// Build a tone curve for K->K' if possible (only works on CMYK)
|
|
2076 |
LPGAMMATABLE _cmsBuildKToneCurve(cmsHTRANSFORM hCMYK2CMYK, int nPoints);
|
|
2077 |
|
2394
|
2078 |
// Validates a LUT
|
|
2079 |
LCMSBOOL cdecl _cmsValidateLUT(LPLUT NewLUT);
|
|
2080 |
|
|
2081 |
|
2
|
2082 |
// These are two VITAL macros, from converting between 8 and 16 bit
|
|
2083 |
// representation.
|
|
2084 |
|
|
2085 |
#define RGB_8_TO_16(rgb) (WORD) ((((WORD) (rgb)) << 8)|(rgb))
|
|
2086 |
#define RGB_16_TO_8(rgb) (BYTE) ((((rgb) * 65281 + 8388608) >> 24) & 0xFF)
|
|
2087 |
|
|
2088 |
|
|
2089 |
#endif // LCMS_APIONLY
|
|
2090 |
|
|
2091 |
|
|
2092 |
#define __cms_H
|
|
2093 |
|
|
2094 |
#ifdef __cplusplus
|
|
2095 |
}
|
|
2096 |
#endif
|
|
2097 |
|
|
2098 |
#endif
|
2394
|
2099 |
|