Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/lcms2/include/lcms2.h
4391 views
1
//---------------------------------------------------------------------------------
2
//
3
// Little Color Management System
4
// Copyright (c) 1998-2025 Marti Maria Saguer
5
//
6
// Permission is hereby granted, free of charge, to any person obtaining
7
// a copy of this software and associated documentation files (the "Software"),
8
// to deal in the Software without restriction, including without limitation
9
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
// and/or sell copies of the Software, and to permit persons to whom the Software
11
// is furnished to do so, subject to the following conditions:
12
//
13
// The above copyright notice and this permission notice shall be included in
14
// all copies or substantial portions of the Software.
15
//
16
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
18
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
//
24
//---------------------------------------------------------------------------------
25
//
26
// Version 2.17
27
//
28
29
#ifndef _lcms2_H
30
31
// ********** Configuration toggles ****************************************
32
33
// Uncomment this one if you are using big endian machines
34
// #define CMS_USE_BIG_ENDIAN 1
35
36
// Uncomment this one if your compiler/machine does NOT support the
37
// "long long" type.
38
// #define CMS_DONT_USE_INT64 1
39
40
// Uncomment this if your compiler doesn't work with fast floor function
41
// #define CMS_DONT_USE_FAST_FLOOR 1
42
43
// Uncomment this line if you want lcms to use the black point tag in profile,
44
// if commented, lcms will compute the black point by its own.
45
// It is safer to leave it commented out
46
// #define CMS_USE_PROFILE_BLACK_POINT_TAG 1
47
48
// Uncomment this line if you are compiling as C++ and want a C++ API
49
// #define CMS_USE_CPP_API
50
51
// Uncomment this line if you need strict CGATS syntax. Makes CGATS files to
52
// require "KEYWORD" on undefined identifiers, keep it commented out unless needed
53
// #define CMS_STRICT_CGATS 1
54
55
// Uncomment to get rid of the tables for "half" float support
56
// #define CMS_NO_HALF_SUPPORT 1
57
58
// Uncomment to get rid of pthreads/windows dependency
59
// #define CMS_NO_PTHREADS 1
60
61
// Uncomment this for special windows mutex initialization (see lcms2_internal.h)
62
// #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
63
64
// Uncomment this to remove the "register" storage class
65
// #define CMS_NO_REGISTER_KEYWORD 1
66
67
// Uncomment this to remove visibility attribute when building shared objects
68
// #define CMS_NO_VISIBILITY 1
69
70
// ********** End of configuration toggles ******************************
71
72
// Needed for streams
73
#include <stdio.h>
74
75
// Needed for portability (C99 per 7.1.2)
76
#include <limits.h>
77
#include <time.h>
78
#include <stddef.h>
79
80
#ifndef CMS_USE_CPP_API
81
# ifdef __cplusplus
82
# if __cplusplus >= 201703L
83
# define CMS_NO_REGISTER_KEYWORD 1
84
# endif
85
extern "C" {
86
# endif
87
#endif
88
89
// Version/release
90
#define LCMS_VERSION 2170
91
92
// I will give the chance of redefining basic types for compilers that are not fully C99 compliant
93
#ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
94
95
// Base types
96
typedef unsigned char cmsUInt8Number; // That is guaranteed by the C99 spec
97
typedef signed char cmsInt8Number; // That is guaranteed by the C99 spec
98
99
#if CHAR_BIT != 8
100
# error "Unable to find 8 bit type, unsupported compiler"
101
#endif
102
103
// IEEE float storage numbers
104
typedef float cmsFloat32Number;
105
typedef double cmsFloat64Number;
106
107
// 16-bit base types
108
#if (USHRT_MAX == 65535U)
109
typedef unsigned short cmsUInt16Number;
110
#elif (UINT_MAX == 65535U)
111
typedef unsigned int cmsUInt16Number;
112
#else
113
# error "Unable to find 16 bits unsigned type, unsupported compiler"
114
#endif
115
116
#if (SHRT_MAX == 32767)
117
typedef short cmsInt16Number;
118
#elif (INT_MAX == 32767)
119
typedef int cmsInt16Number;
120
#else
121
# error "Unable to find 16 bits signed type, unsupported compiler"
122
#endif
123
124
// 32-bit base type
125
#if (UINT_MAX == 4294967295U)
126
typedef unsigned int cmsUInt32Number;
127
#elif (ULONG_MAX == 4294967295U)
128
typedef unsigned long cmsUInt32Number;
129
#else
130
# error "Unable to find 32 bit unsigned type, unsupported compiler"
131
#endif
132
133
#if (INT_MAX == +2147483647)
134
typedef int cmsInt32Number;
135
#elif (LONG_MAX == +2147483647)
136
typedef long cmsInt32Number;
137
#else
138
# error "Unable to find 32 bit signed type, unsupported compiler"
139
#endif
140
141
// 64-bit base types
142
#ifndef CMS_DONT_USE_INT64
143
# if (ULONG_MAX == 18446744073709551615U)
144
typedef unsigned long cmsUInt64Number;
145
# elif (ULLONG_MAX == 18446744073709551615U)
146
typedef unsigned long long cmsUInt64Number;
147
# else
148
# define CMS_DONT_USE_INT64 1
149
# endif
150
# if (LONG_MAX == +9223372036854775807)
151
typedef long cmsInt64Number;
152
# elif (LLONG_MAX == +9223372036854775807)
153
typedef long long cmsInt64Number;
154
# else
155
# define CMS_DONT_USE_INT64 1
156
# endif
157
#endif
158
#endif
159
160
// Handle "register" keyword
161
#if defined(CMS_NO_REGISTER_KEYWORD)
162
# define CMSREGISTER
163
#else
164
# define CMSREGISTER register
165
#endif
166
167
// In the case 64 bit numbers are not supported by the compiler
168
#ifdef CMS_DONT_USE_INT64
169
typedef cmsUInt32Number cmsUInt64Number[2];
170
typedef cmsInt32Number cmsInt64Number[2];
171
#endif
172
173
// Derivative types
174
typedef cmsUInt32Number cmsSignature;
175
typedef cmsUInt16Number cmsU8Fixed8Number;
176
typedef cmsInt32Number cmsS15Fixed16Number;
177
typedef cmsUInt32Number cmsU16Fixed16Number;
178
179
// Boolean type, which will be using the native integer
180
typedef int cmsBool;
181
182
// Try to detect windows
183
#if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
184
# define CMS_IS_WINDOWS_ 1
185
#endif
186
187
#ifdef _MSC_VER
188
# define CMS_IS_WINDOWS_ 1
189
#endif
190
191
#ifdef __BORLANDC__
192
# define CMS_IS_WINDOWS_ 1
193
#endif
194
195
// Try to detect big endian platforms. This list can be endless, so primarily rely on the configure script
196
// on Unix-like systems, and allow it to be set on the compiler command line using
197
// -DCMS_USE_BIG_ENDIAN or something similar
198
#ifdef CMS_USE_BIG_ENDIAN // set at compiler command line takes overall precedence
199
200
# if CMS_USE_BIG_ENDIAN == 0
201
# undef CMS_USE_BIG_ENDIAN
202
# endif
203
204
#else // CMS_USE_BIG_ENDIAN
205
206
# ifdef WORDS_BIGENDIAN // set by configure (or explicitly on compiler command line)
207
# define CMS_USE_BIG_ENDIAN 1
208
# else // WORDS_BIGENDIAN
209
// Fall back to platform/compiler specific tests
210
# if defined(__sgi__) || defined(__sgi) || defined(sparc)
211
# define CMS_USE_BIG_ENDIAN 1
212
# endif
213
214
# if defined(__s390__) || defined(__s390x__)
215
# define CMS_USE_BIG_ENDIAN 1
216
# endif
217
218
# ifdef macintosh
219
# ifdef __BIG_ENDIAN__
220
# define CMS_USE_BIG_ENDIAN 1
221
# endif
222
# ifdef __LITTLE_ENDIAN__
223
# undef CMS_USE_BIG_ENDIAN
224
# endif
225
# endif
226
# endif // WORDS_BIGENDIAN
227
228
# if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
229
# define CMS_USE_BIG_ENDIAN 1
230
# endif
231
232
#endif // CMS_USE_BIG_ENDIAN
233
234
235
// Calling convention -- this is hardly platform and compiler dependent
236
#if defined(CMS_IS_WINDOWS_) && !defined(__GNUC__)
237
# if defined(CMS_DLL) || defined(CMS_DLL_BUILD)
238
# ifdef __BORLANDC__
239
# define CMSEXPORT __stdcall _export
240
# define CMSAPI
241
# else
242
# define CMSEXPORT __stdcall
243
# ifdef CMS_DLL_BUILD
244
# define CMSAPI __declspec(dllexport)
245
# else
246
# define CMSAPI __declspec(dllimport)
247
# endif
248
# endif
249
# else
250
# define CMSEXPORT
251
# define CMSAPI
252
# endif
253
#else // not Windows
254
# if defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY) && !defined(CMS_NO_VISIBILITY)
255
# define CMSEXPORT
256
# define CMSAPI __attribute__((visibility("default")))
257
# else
258
# define CMSEXPORT
259
# define CMSAPI
260
# endif
261
#endif // CMS_IS_WINDOWS_
262
263
#ifdef HasTHREADS
264
# if HasTHREADS == 1
265
# undef CMS_NO_PTHREADS
266
# else
267
# define CMS_NO_PTHREADS 1
268
# endif
269
#endif
270
271
// Some common definitions
272
#define cmsMAX_PATH 256
273
274
#ifndef FALSE
275
# define FALSE 0
276
#endif
277
#ifndef TRUE
278
# define TRUE 1
279
#endif
280
281
// D50 XYZ normalized to Y=1.0
282
#define cmsD50X 0.9642
283
#define cmsD50Y 1.0
284
#define cmsD50Z 0.8249
285
286
// V4 perceptual black
287
#define cmsPERCEPTUAL_BLACK_X 0.00336
288
#define cmsPERCEPTUAL_BLACK_Y 0.0034731
289
#define cmsPERCEPTUAL_BLACK_Z 0.00287
290
291
// Definitions in ICC spec
292
#define cmsMagicNumber 0x61637370 // 'acsp'
293
#define lcmsSignature 0x6c636d73 // 'lcms'
294
295
296
// Base ICC type definitions
297
typedef enum {
298
cmsSigChromaticityType = 0x6368726D, // 'chrm'
299
cmsSigcicpType = 0x63696370, // 'cicp'
300
cmsSigColorantOrderType = 0x636C726F, // 'clro'
301
cmsSigColorantTableType = 0x636C7274, // 'clrt'
302
cmsSigCrdInfoType = 0x63726469, // 'crdi'
303
cmsSigCurveType = 0x63757276, // 'curv'
304
cmsSigDataType = 0x64617461, // 'data'
305
cmsSigDictType = 0x64696374, // 'dict'
306
cmsSigDateTimeType = 0x6474696D, // 'dtim'
307
cmsSigDeviceSettingsType = 0x64657673, // 'devs'
308
cmsSigLut16Type = 0x6d667432, // 'mft2'
309
cmsSigLut8Type = 0x6d667431, // 'mft1'
310
cmsSigLutAtoBType = 0x6d414220, // 'mAB '
311
cmsSigLutBtoAType = 0x6d424120, // 'mBA '
312
cmsSigMeasurementType = 0x6D656173, // 'meas'
313
cmsSigMultiLocalizedUnicodeType = 0x6D6C7563, // 'mluc'
314
cmsSigMultiProcessElementType = 0x6D706574, // 'mpet'
315
cmsSigNamedColorType = 0x6E636f6C, // 'ncol' -- DEPRECATED!
316
cmsSigNamedColor2Type = 0x6E636C32, // 'ncl2'
317
cmsSigParametricCurveType = 0x70617261, // 'para'
318
cmsSigProfileSequenceDescType = 0x70736571, // 'pseq'
319
cmsSigProfileSequenceIdType = 0x70736964, // 'psid'
320
cmsSigResponseCurveSet16Type = 0x72637332, // 'rcs2'
321
cmsSigS15Fixed16ArrayType = 0x73663332, // 'sf32'
322
cmsSigScreeningType = 0x7363726E, // 'scrn'
323
cmsSigSignatureType = 0x73696720, // 'sig '
324
cmsSigTextType = 0x74657874, // 'text'
325
cmsSigTextDescriptionType = 0x64657363, // 'desc'
326
cmsSigU16Fixed16ArrayType = 0x75663332, // 'uf32'
327
cmsSigUcrBgType = 0x62666420, // 'bfd '
328
cmsSigUInt16ArrayType = 0x75693136, // 'ui16'
329
cmsSigUInt32ArrayType = 0x75693332, // 'ui32'
330
cmsSigUInt64ArrayType = 0x75693634, // 'ui64'
331
cmsSigUInt8ArrayType = 0x75693038, // 'ui08'
332
cmsSigVcgtType = 0x76636774, // 'vcgt'
333
cmsSigViewingConditionsType = 0x76696577, // 'view'
334
cmsSigXYZType = 0x58595A20, // 'XYZ '
335
cmsSigMHC2Type = 0x4D484332 // 'MHC2'
336
337
338
} cmsTagTypeSignature;
339
340
// Base ICC tag definitions
341
typedef enum {
342
cmsSigAToB0Tag = 0x41324230, // 'A2B0'
343
cmsSigAToB1Tag = 0x41324231, // 'A2B1'
344
cmsSigAToB2Tag = 0x41324232, // 'A2B2'
345
cmsSigBlueColorantTag = 0x6258595A, // 'bXYZ'
346
cmsSigBlueMatrixColumnTag = 0x6258595A, // 'bXYZ'
347
cmsSigBlueTRCTag = 0x62545243, // 'bTRC'
348
cmsSigBToA0Tag = 0x42324130, // 'B2A0'
349
cmsSigBToA1Tag = 0x42324131, // 'B2A1'
350
cmsSigBToA2Tag = 0x42324132, // 'B2A2'
351
cmsSigCalibrationDateTimeTag = 0x63616C74, // 'calt'
352
cmsSigCharTargetTag = 0x74617267, // 'targ'
353
cmsSigChromaticAdaptationTag = 0x63686164, // 'chad'
354
cmsSigChromaticityTag = 0x6368726D, // 'chrm'
355
cmsSigColorantOrderTag = 0x636C726F, // 'clro'
356
cmsSigColorantTableTag = 0x636C7274, // 'clrt'
357
cmsSigColorantTableOutTag = 0x636C6F74, // 'clot'
358
cmsSigColorimetricIntentImageStateTag = 0x63696973, // 'ciis'
359
cmsSigCopyrightTag = 0x63707274, // 'cprt'
360
cmsSigCrdInfoTag = 0x63726469, // 'crdi'
361
cmsSigDataTag = 0x64617461, // 'data'
362
cmsSigDateTimeTag = 0x6474696D, // 'dtim'
363
cmsSigDeviceMfgDescTag = 0x646D6E64, // 'dmnd'
364
cmsSigDeviceModelDescTag = 0x646D6464, // 'dmdd'
365
cmsSigDeviceSettingsTag = 0x64657673, // 'devs'
366
cmsSigDToB0Tag = 0x44324230, // 'D2B0'
367
cmsSigDToB1Tag = 0x44324231, // 'D2B1'
368
cmsSigDToB2Tag = 0x44324232, // 'D2B2'
369
cmsSigDToB3Tag = 0x44324233, // 'D2B3'
370
cmsSigBToD0Tag = 0x42324430, // 'B2D0'
371
cmsSigBToD1Tag = 0x42324431, // 'B2D1'
372
cmsSigBToD2Tag = 0x42324432, // 'B2D2'
373
cmsSigBToD3Tag = 0x42324433, // 'B2D3'
374
cmsSigGamutTag = 0x67616D74, // 'gamt'
375
cmsSigGrayTRCTag = 0x6b545243, // 'kTRC'
376
cmsSigGreenColorantTag = 0x6758595A, // 'gXYZ'
377
cmsSigGreenMatrixColumnTag = 0x6758595A, // 'gXYZ'
378
cmsSigGreenTRCTag = 0x67545243, // 'gTRC'
379
cmsSigLuminanceTag = 0x6C756d69, // 'lumi'
380
cmsSigMeasurementTag = 0x6D656173, // 'meas'
381
cmsSigMediaBlackPointTag = 0x626B7074, // 'bkpt'
382
cmsSigMediaWhitePointTag = 0x77747074, // 'wtpt'
383
cmsSigNamedColorTag = 0x6E636f6C, // 'ncol' // Deprecated by the ICC
384
cmsSigNamedColor2Tag = 0x6E636C32, // 'ncl2'
385
cmsSigOutputResponseTag = 0x72657370, // 'resp'
386
cmsSigPerceptualRenderingIntentGamutTag = 0x72696730, // 'rig0'
387
cmsSigPreview0Tag = 0x70726530, // 'pre0'
388
cmsSigPreview1Tag = 0x70726531, // 'pre1'
389
cmsSigPreview2Tag = 0x70726532, // 'pre2'
390
cmsSigProfileDescriptionTag = 0x64657363, // 'desc'
391
cmsSigProfileDescriptionMLTag = 0x6473636d, // 'dscm'
392
cmsSigProfileSequenceDescTag = 0x70736571, // 'pseq'
393
cmsSigProfileSequenceIdTag = 0x70736964, // 'psid'
394
cmsSigPs2CRD0Tag = 0x70736430, // 'psd0'
395
cmsSigPs2CRD1Tag = 0x70736431, // 'psd1'
396
cmsSigPs2CRD2Tag = 0x70736432, // 'psd2'
397
cmsSigPs2CRD3Tag = 0x70736433, // 'psd3'
398
cmsSigPs2CSATag = 0x70733273, // 'ps2s'
399
cmsSigPs2RenderingIntentTag = 0x70733269, // 'ps2i'
400
cmsSigRedColorantTag = 0x7258595A, // 'rXYZ'
401
cmsSigRedMatrixColumnTag = 0x7258595A, // 'rXYZ'
402
cmsSigRedTRCTag = 0x72545243, // 'rTRC'
403
cmsSigSaturationRenderingIntentGamutTag = 0x72696732, // 'rig2'
404
cmsSigScreeningDescTag = 0x73637264, // 'scrd'
405
cmsSigScreeningTag = 0x7363726E, // 'scrn'
406
cmsSigTechnologyTag = 0x74656368, // 'tech'
407
cmsSigUcrBgTag = 0x62666420, // 'bfd '
408
cmsSigViewingCondDescTag = 0x76756564, // 'vued'
409
cmsSigViewingConditionsTag = 0x76696577, // 'view'
410
cmsSigVcgtTag = 0x76636774, // 'vcgt'
411
cmsSigMetaTag = 0x6D657461, // 'meta'
412
cmsSigcicpTag = 0x63696370, // 'cicp'
413
cmsSigArgyllArtsTag = 0x61727473, // 'arts'
414
cmsSigMHC2Tag = 0x4D484332 // 'MHC2'
415
416
} cmsTagSignature;
417
418
419
// ICC Technology tag
420
typedef enum {
421
cmsSigDigitalCamera = 0x6463616D, // 'dcam'
422
cmsSigFilmScanner = 0x6673636E, // 'fscn'
423
cmsSigReflectiveScanner = 0x7273636E, // 'rscn'
424
cmsSigInkJetPrinter = 0x696A6574, // 'ijet'
425
cmsSigThermalWaxPrinter = 0x74776178, // 'twax'
426
cmsSigElectrophotographicPrinter = 0x6570686F, // 'epho'
427
cmsSigElectrostaticPrinter = 0x65737461, // 'esta'
428
cmsSigDyeSublimationPrinter = 0x64737562, // 'dsub'
429
cmsSigPhotographicPaperPrinter = 0x7270686F, // 'rpho'
430
cmsSigFilmWriter = 0x6670726E, // 'fprn'
431
cmsSigVideoMonitor = 0x7669646D, // 'vidm'
432
cmsSigVideoCamera = 0x76696463, // 'vidc'
433
cmsSigProjectionTelevision = 0x706A7476, // 'pjtv'
434
cmsSigCRTDisplay = 0x43525420, // 'CRT '
435
cmsSigPMDisplay = 0x504D4420, // 'PMD '
436
cmsSigAMDisplay = 0x414D4420, // 'AMD '
437
cmsSigPhotoCD = 0x4B504344, // 'KPCD'
438
cmsSigPhotoImageSetter = 0x696D6773, // 'imgs'
439
cmsSigGravure = 0x67726176, // 'grav'
440
cmsSigOffsetLithography = 0x6F666673, // 'offs'
441
cmsSigSilkscreen = 0x73696C6B, // 'silk'
442
cmsSigFlexography = 0x666C6578, // 'flex'
443
cmsSigMotionPictureFilmScanner = 0x6D706673, // 'mpfs'
444
cmsSigMotionPictureFilmRecorder = 0x6D706672, // 'mpfr'
445
cmsSigDigitalMotionPictureCamera = 0x646D7063, // 'dmpc'
446
cmsSigDigitalCinemaProjector = 0x64636A70 // 'dcpj'
447
448
} cmsTechnologySignature;
449
450
451
// ICC Color spaces
452
typedef enum {
453
cmsSigXYZData = 0x58595A20, // 'XYZ '
454
cmsSigLabData = 0x4C616220, // 'Lab '
455
cmsSigLuvData = 0x4C757620, // 'Luv '
456
cmsSigYCbCrData = 0x59436272, // 'YCbr'
457
cmsSigYxyData = 0x59787920, // 'Yxy '
458
cmsSigRgbData = 0x52474220, // 'RGB '
459
cmsSigGrayData = 0x47524159, // 'GRAY'
460
cmsSigHsvData = 0x48535620, // 'HSV '
461
cmsSigHlsData = 0x484C5320, // 'HLS '
462
cmsSigCmykData = 0x434D594B, // 'CMYK'
463
cmsSigCmyData = 0x434D5920, // 'CMY '
464
cmsSigMCH1Data = 0x4D434831, // 'MCH1'
465
cmsSigMCH2Data = 0x4D434832, // 'MCH2'
466
cmsSigMCH3Data = 0x4D434833, // 'MCH3'
467
cmsSigMCH4Data = 0x4D434834, // 'MCH4'
468
cmsSigMCH5Data = 0x4D434835, // 'MCH5'
469
cmsSigMCH6Data = 0x4D434836, // 'MCH6'
470
cmsSigMCH7Data = 0x4D434837, // 'MCH7'
471
cmsSigMCH8Data = 0x4D434838, // 'MCH8'
472
cmsSigMCH9Data = 0x4D434839, // 'MCH9'
473
cmsSigMCHAData = 0x4D434841, // 'MCHA'
474
cmsSigMCHBData = 0x4D434842, // 'MCHB'
475
cmsSigMCHCData = 0x4D434843, // 'MCHC'
476
cmsSigMCHDData = 0x4D434844, // 'MCHD'
477
cmsSigMCHEData = 0x4D434845, // 'MCHE'
478
cmsSigMCHFData = 0x4D434846, // 'MCHF'
479
cmsSigNamedData = 0x6e6d636c, // 'nmcl'
480
cmsSig1colorData = 0x31434C52, // '1CLR'
481
cmsSig2colorData = 0x32434C52, // '2CLR'
482
cmsSig3colorData = 0x33434C52, // '3CLR'
483
cmsSig4colorData = 0x34434C52, // '4CLR'
484
cmsSig5colorData = 0x35434C52, // '5CLR'
485
cmsSig6colorData = 0x36434C52, // '6CLR'
486
cmsSig7colorData = 0x37434C52, // '7CLR'
487
cmsSig8colorData = 0x38434C52, // '8CLR'
488
cmsSig9colorData = 0x39434C52, // '9CLR'
489
cmsSig10colorData = 0x41434C52, // 'ACLR'
490
cmsSig11colorData = 0x42434C52, // 'BCLR'
491
cmsSig12colorData = 0x43434C52, // 'CCLR'
492
cmsSig13colorData = 0x44434C52, // 'DCLR'
493
cmsSig14colorData = 0x45434C52, // 'ECLR'
494
cmsSig15colorData = 0x46434C52, // 'FCLR'
495
cmsSigLuvKData = 0x4C75764B // 'LuvK'
496
497
} cmsColorSpaceSignature;
498
499
// ICC Profile Class
500
typedef enum {
501
cmsSigInputClass = 0x73636E72, // 'scnr'
502
cmsSigDisplayClass = 0x6D6E7472, // 'mntr'
503
cmsSigOutputClass = 0x70727472, // 'prtr'
504
cmsSigLinkClass = 0x6C696E6B, // 'link'
505
cmsSigAbstractClass = 0x61627374, // 'abst'
506
cmsSigColorSpaceClass = 0x73706163, // 'spac'
507
cmsSigNamedColorClass = 0x6e6d636c // 'nmcl'
508
509
} cmsProfileClassSignature;
510
511
// ICC Platforms
512
typedef enum {
513
cmsSigMacintosh = 0x4150504C, // 'APPL'
514
cmsSigMicrosoft = 0x4D534654, // 'MSFT'
515
cmsSigSolaris = 0x53554E57, // 'SUNW'
516
cmsSigSGI = 0x53474920, // 'SGI '
517
cmsSigTaligent = 0x54474E54, // 'TGNT'
518
cmsSigUnices = 0x2A6E6978 // '*nix' // From argyll -- Not official
519
520
} cmsPlatformSignature;
521
522
// Reference gamut
523
#define cmsSigPerceptualReferenceMediumGamut 0x70726d67 //'prmg'
524
525
// For cmsSigColorimetricIntentImageStateTag
526
#define cmsSigSceneColorimetryEstimates 0x73636F65 //'scoe'
527
#define cmsSigSceneAppearanceEstimates 0x73617065 //'sape'
528
#define cmsSigFocalPlaneColorimetryEstimates 0x66706365 //'fpce'
529
#define cmsSigReflectionHardcopyOriginalColorimetry 0x72686F63 //'rhoc'
530
#define cmsSigReflectionPrintOutputColorimetry 0x72706F63 //'rpoc'
531
532
// Multi process elements types
533
typedef enum {
534
cmsSigCurveSetElemType = 0x63767374, //'cvst'
535
cmsSigMatrixElemType = 0x6D617466, //'matf'
536
cmsSigCLutElemType = 0x636C7574, //'clut'
537
538
cmsSigBAcsElemType = 0x62414353, // 'bACS'
539
cmsSigEAcsElemType = 0x65414353, // 'eACS'
540
541
// Custom from here, not in the ICC Spec
542
cmsSigXYZ2LabElemType = 0x6C327820, // 'l2x '
543
cmsSigLab2XYZElemType = 0x78326C20, // 'x2l '
544
cmsSigNamedColorElemType = 0x6E636C20, // 'ncl '
545
cmsSigLabV2toV4 = 0x32203420, // '2 4 '
546
cmsSigLabV4toV2 = 0x34203220, // '4 2 '
547
548
// Identities
549
cmsSigIdentityElemType = 0x69646E20, // 'idn '
550
551
// Float to floatPCS
552
cmsSigLab2FloatPCS = 0x64326C20, // 'd2l '
553
cmsSigFloatPCS2Lab = 0x6C326420, // 'l2d '
554
cmsSigXYZ2FloatPCS = 0x64327820, // 'd2x '
555
cmsSigFloatPCS2XYZ = 0x78326420, // 'x2d '
556
cmsSigClipNegativesElemType = 0x636c7020 // 'clp '
557
558
} cmsStageSignature;
559
560
// Types of CurveElements
561
typedef enum {
562
563
cmsSigFormulaCurveSeg = 0x70617266, // 'parf'
564
cmsSigSampledCurveSeg = 0x73616D66, // 'samf'
565
cmsSigSegmentedCurve = 0x63757266 // 'curf'
566
567
} cmsCurveSegSignature;
568
569
// Used in ResponseCurveType
570
#define cmsSigStatusA 0x53746141 //'StaA'
571
#define cmsSigStatusE 0x53746145 //'StaE'
572
#define cmsSigStatusI 0x53746149 //'StaI'
573
#define cmsSigStatusT 0x53746154 //'StaT'
574
#define cmsSigStatusM 0x5374614D //'StaM'
575
#define cmsSigDN 0x444E2020 //'DN '
576
#define cmsSigDNP 0x444E2050 //'DN P'
577
#define cmsSigDNN 0x444E4E20 //'DNN '
578
#define cmsSigDNNP 0x444E4E50 //'DNNP'
579
580
// Device attributes, currently defined values correspond to the low 4 bytes
581
// of the 8 byte attribute quantity
582
#define cmsReflective 0
583
#define cmsTransparency 1
584
#define cmsGlossy 0
585
#define cmsMatte 2
586
587
// Common structures in ICC tags
588
typedef struct {
589
cmsUInt32Number len;
590
cmsUInt32Number flag;
591
cmsUInt8Number data[1];
592
593
} cmsICCData;
594
595
// ICC date time
596
typedef struct {
597
cmsUInt16Number year;
598
cmsUInt16Number month;
599
cmsUInt16Number day;
600
cmsUInt16Number hours;
601
cmsUInt16Number minutes;
602
cmsUInt16Number seconds;
603
604
} cmsDateTimeNumber;
605
606
// ICC XYZ
607
typedef struct {
608
cmsS15Fixed16Number X;
609
cmsS15Fixed16Number Y;
610
cmsS15Fixed16Number Z;
611
612
} cmsEncodedXYZNumber;
613
614
615
// Profile ID as computed by MD5 algorithm
616
typedef union {
617
cmsUInt8Number ID8[16];
618
cmsUInt16Number ID16[8];
619
cmsUInt32Number ID32[4];
620
621
} cmsProfileID;
622
623
624
// ----------------------------------------------------------------------------------------------
625
// ICC profile internal base types. Strictly, shouldn't be declared in this header, but maybe
626
// somebody want to use this info for accessing profile header directly, so here it is.
627
628
// Profile header -- it is 32-bit aligned, so no issues are expected on alignment
629
typedef struct {
630
cmsUInt32Number size; // Profile size in bytes
631
cmsSignature cmmId; // CMM for this profile
632
cmsUInt32Number version; // Format version number
633
cmsProfileClassSignature deviceClass; // Type of profile
634
cmsColorSpaceSignature colorSpace; // Color space of data
635
cmsColorSpaceSignature pcs; // PCS, XYZ or Lab only
636
cmsDateTimeNumber date; // Date profile was created
637
cmsSignature magic; // Magic Number to identify an ICC profile
638
cmsPlatformSignature platform; // Primary Platform
639
cmsUInt32Number flags; // Various bit settings
640
cmsSignature manufacturer; // Device manufacturer
641
cmsUInt32Number model; // Device model number
642
cmsUInt64Number attributes; // Device attributes
643
cmsUInt32Number renderingIntent;// Rendering intent
644
cmsEncodedXYZNumber illuminant; // Profile illuminant
645
cmsSignature creator; // Profile creator
646
cmsProfileID profileID; // Profile ID using MD5
647
cmsInt8Number reserved[28]; // Reserved for future use
648
649
} cmsICCHeader;
650
651
// ICC base tag
652
typedef struct {
653
cmsTagTypeSignature sig;
654
cmsInt8Number reserved[4];
655
656
} cmsTagBase;
657
658
// A tag entry in directory
659
typedef struct {
660
cmsTagSignature sig; // The tag signature
661
cmsUInt32Number offset; // Start of tag
662
cmsUInt32Number size; // Size in bytes
663
664
} cmsTagEntry;
665
666
// ----------------------------------------------------------------------------------------------
667
668
// Little CMS specific typedefs
669
670
typedef void* cmsHANDLE ; // Generic handle
671
typedef void* cmsHPROFILE; // Opaque typedefs to hide internals
672
typedef void* cmsHTRANSFORM;
673
674
#define cmsMAXCHANNELS 16 // Maximum number of channels in ICC profiles
675
676
// Format of pixel is defined by one cmsUInt32Number, using bit fields as follows
677
//
678
// 2 1 0
679
// 4 3 2 10987 6 5 4 3 2 1 098 7654 321
680
// M A O TTTTT U Y F P X S EEE CCCC BBB
681
//
682
// M: Premultiplied alpha (only works when extra samples is 1)
683
// A: Floating point -- With this flag we can differentiate 16 bits as float and as int
684
// O: Optimized -- previous optimization already returns the final 8-bit value
685
// T: Pixeltype
686
// F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
687
// P: Planar? 0=Chunky, 1=Planar
688
// X: swap 16 bps endianness?
689
// S: Do swap? ie, BGR, KYMC
690
// E: Extra samples
691
// C: Channels (Samples per pixel)
692
// B: bytes per sample
693
// Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
694
695
#define PREMUL_SH(m) ((m) << 23)
696
#define FLOAT_SH(a) ((a) << 22)
697
#define OPTIMIZED_SH(s) ((s) << 21)
698
#define COLORSPACE_SH(s) ((s) << 16)
699
#define SWAPFIRST_SH(s) ((s) << 14)
700
#define FLAVOR_SH(s) ((s) << 13)
701
#define PLANAR_SH(p) ((p) << 12)
702
#define ENDIAN16_SH(e) ((e) << 11)
703
#define DOSWAP_SH(e) ((e) << 10)
704
#define EXTRA_SH(e) ((e) << 7)
705
#define CHANNELS_SH(c) ((c) << 3)
706
#define BYTES_SH(b) (b)
707
708
// These macros unpack format specifiers into integers
709
#define T_PREMUL(m) (((m)>>23)&1)
710
#define T_FLOAT(a) (((a)>>22)&1)
711
#define T_OPTIMIZED(o) (((o)>>21)&1)
712
#define T_COLORSPACE(s) (((s)>>16)&31)
713
#define T_SWAPFIRST(s) (((s)>>14)&1)
714
#define T_FLAVOR(s) (((s)>>13)&1)
715
#define T_PLANAR(p) (((p)>>12)&1)
716
#define T_ENDIAN16(e) (((e)>>11)&1)
717
#define T_DOSWAP(e) (((e)>>10)&1)
718
#define T_EXTRA(e) (((e)>>7)&7)
719
#define T_CHANNELS(c) (((c)>>3)&15)
720
#define T_BYTES(b) ((b)&7)
721
722
723
// Pixel types
724
#define PT_ANY 0 // Don't check colorspace
725
// 1 & 2 are reserved
726
#define PT_GRAY 3
727
#define PT_RGB 4
728
#define PT_CMY 5
729
#define PT_CMYK 6
730
#define PT_YCbCr 7
731
#define PT_YUV 8 // Lu'v'
732
#define PT_XYZ 9
733
#define PT_Lab 10
734
#define PT_YUVK 11 // Lu'v'K
735
#define PT_HSV 12
736
#define PT_HLS 13
737
#define PT_Yxy 14
738
#define PT_MCH1 15
739
#define PT_MCH2 16
740
#define PT_MCH3 17
741
#define PT_MCH4 18
742
#define PT_MCH5 19
743
#define PT_MCH6 20
744
#define PT_MCH7 21
745
#define PT_MCH8 22
746
#define PT_MCH9 23
747
#define PT_MCH10 24
748
#define PT_MCH11 25
749
#define PT_MCH12 26
750
#define PT_MCH13 27
751
#define PT_MCH14 28
752
#define PT_MCH15 29
753
#define PT_LabV2 30 // Identical to PT_Lab, but using the V2 old encoding
754
755
// Some (not all!) representations
756
757
#ifndef TYPE_RGB_8 // TYPE_RGB_8 is a very common identifier, so don't include ours
758
// if user has it already defined.
759
760
#define TYPE_GRAY_8 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1))
761
#define TYPE_GRAY_8_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1))
762
#define TYPE_GRAY_16 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
763
#define TYPE_GRAY_16_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1))
764
#define TYPE_GRAY_16_SE (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
765
#define TYPE_GRAYA_8 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1))
766
#define TYPE_GRAYA_8_PREMUL (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PREMUL_SH(1))
767
#define TYPE_GRAYA_16 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2))
768
#define TYPE_GRAYA_16_PREMUL (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PREMUL_SH(1))
769
#define TYPE_GRAYA_16_SE (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
770
#define TYPE_GRAYA_8_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PLANAR_SH(1))
771
#define TYPE_GRAYA_16_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1))
772
773
#define TYPE_RGB_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1))
774
#define TYPE_RGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
775
#define TYPE_BGR_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
776
#define TYPE_BGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
777
#define TYPE_RGB_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
778
#define TYPE_RGB_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
779
#define TYPE_RGB_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
780
#define TYPE_BGR_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
781
#define TYPE_BGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
782
#define TYPE_BGR_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
783
784
#define TYPE_RGBA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1))
785
#define TYPE_RGBA_8_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PREMUL_SH(1))
786
#define TYPE_RGBA_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
787
#define TYPE_RGBA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
788
#define TYPE_RGBA_16_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PREMUL_SH(1))
789
#define TYPE_RGBA_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
790
#define TYPE_RGBA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
791
792
#define TYPE_ARGB_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1))
793
#define TYPE_ARGB_8_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)|PREMUL_SH(1))
794
#define TYPE_ARGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)|PLANAR_SH(1))
795
#define TYPE_ARGB_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
796
#define TYPE_ARGB_16_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)|PREMUL_SH(1))
797
798
#define TYPE_ABGR_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
799
#define TYPE_ABGR_8_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PREMUL_SH(1))
800
#define TYPE_ABGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
801
#define TYPE_ABGR_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
802
#define TYPE_ABGR_16_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PREMUL_SH(1))
803
#define TYPE_ABGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
804
#define TYPE_ABGR_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
805
806
#define TYPE_BGRA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
807
#define TYPE_BGRA_8_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|PREMUL_SH(1))
808
#define TYPE_BGRA_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|PLANAR_SH(1))
809
#define TYPE_BGRA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
810
#define TYPE_BGRA_16_PREMUL (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|PREMUL_SH(1))
811
#define TYPE_BGRA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
812
813
#define TYPE_CMY_8 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1))
814
#define TYPE_CMY_8_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
815
#define TYPE_CMY_16 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2))
816
#define TYPE_CMY_16_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
817
#define TYPE_CMY_16_SE (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
818
819
#define TYPE_CMYK_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1))
820
#define TYPE_CMYKA_8 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1))
821
#define TYPE_CMYK_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1))
822
#define TYPE_YUVK_8 TYPE_CMYK_8_REV
823
#define TYPE_CMYK_8_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|PLANAR_SH(1))
824
#define TYPE_CMYK_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
825
#define TYPE_CMYK_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1))
826
#define TYPE_YUVK_16 TYPE_CMYK_16_REV
827
#define TYPE_CMYK_16_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|PLANAR_SH(1))
828
#define TYPE_CMYK_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1))
829
830
#define TYPE_KYMC_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1))
831
#define TYPE_KYMC_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1))
832
#define TYPE_KYMC_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
833
834
#define TYPE_KCMY_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1))
835
#define TYPE_KCMY_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
836
#define TYPE_KCMY_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1))
837
#define TYPE_KCMY_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
838
#define TYPE_KCMY_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
839
840
#define TYPE_CMYK5_8 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1))
841
#define TYPE_CMYK5_16 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2))
842
#define TYPE_CMYK5_16_SE (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|ENDIAN16_SH(1))
843
#define TYPE_KYMC5_8 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1)|DOSWAP_SH(1))
844
#define TYPE_KYMC5_16 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1))
845
#define TYPE_KYMC5_16_SE (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
846
#define TYPE_CMYK6_8 (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1))
847
#define TYPE_CMYK6_8_PLANAR (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1)|PLANAR_SH(1))
848
#define TYPE_CMYK6_16 (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2))
849
#define TYPE_CMYK6_16_PLANAR (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|PLANAR_SH(1))
850
#define TYPE_CMYK6_16_SE (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|ENDIAN16_SH(1))
851
#define TYPE_CMYK7_8 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1))
852
#define TYPE_CMYK7_16 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2))
853
#define TYPE_CMYK7_16_SE (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|ENDIAN16_SH(1))
854
#define TYPE_KYMC7_8 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1)|DOSWAP_SH(1))
855
#define TYPE_KYMC7_16 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1))
856
#define TYPE_KYMC7_16_SE (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
857
#define TYPE_CMYK8_8 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1))
858
#define TYPE_CMYK8_16 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2))
859
#define TYPE_CMYK8_16_SE (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|ENDIAN16_SH(1))
860
#define TYPE_KYMC8_8 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1)|DOSWAP_SH(1))
861
#define TYPE_KYMC8_16 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1))
862
#define TYPE_KYMC8_16_SE (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
863
#define TYPE_CMYK9_8 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1))
864
#define TYPE_CMYK9_16 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2))
865
#define TYPE_CMYK9_16_SE (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|ENDIAN16_SH(1))
866
#define TYPE_KYMC9_8 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1)|DOSWAP_SH(1))
867
#define TYPE_KYMC9_16 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1))
868
#define TYPE_KYMC9_16_SE (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
869
#define TYPE_CMYK10_8 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1))
870
#define TYPE_CMYK10_16 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2))
871
#define TYPE_CMYK10_16_SE (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|ENDIAN16_SH(1))
872
#define TYPE_KYMC10_8 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1)|DOSWAP_SH(1))
873
#define TYPE_KYMC10_16 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1))
874
#define TYPE_KYMC10_16_SE (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
875
#define TYPE_CMYK11_8 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1))
876
#define TYPE_CMYK11_16 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2))
877
#define TYPE_CMYK11_16_SE (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|ENDIAN16_SH(1))
878
#define TYPE_KYMC11_8 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1)|DOSWAP_SH(1))
879
#define TYPE_KYMC11_16 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1))
880
#define TYPE_KYMC11_16_SE (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
881
#define TYPE_CMYK12_8 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1))
882
#define TYPE_CMYK12_16 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2))
883
#define TYPE_CMYK12_16_SE (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|ENDIAN16_SH(1))
884
#define TYPE_KYMC12_8 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1)|DOSWAP_SH(1))
885
#define TYPE_KYMC12_16 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1))
886
#define TYPE_KYMC12_16_SE (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
887
888
// Colorimetric
889
#define TYPE_XYZ_16 (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2))
890
#define TYPE_Lab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1))
891
#define TYPE_LabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1))
892
893
#define TYPE_ALab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1))
894
#define TYPE_ALabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1))
895
#define TYPE_Lab_16 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2))
896
#define TYPE_LabV2_16 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(2))
897
#define TYPE_Yxy_16 (COLORSPACE_SH(PT_Yxy)|CHANNELS_SH(3)|BYTES_SH(2))
898
899
// YCbCr
900
#define TYPE_YCbCr_8 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1))
901
#define TYPE_YCbCr_8_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
902
#define TYPE_YCbCr_16 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2))
903
#define TYPE_YCbCr_16_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
904
#define TYPE_YCbCr_16_SE (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
905
906
// YUV
907
#define TYPE_YUV_8 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1))
908
#define TYPE_YUV_8_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
909
#define TYPE_YUV_16 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2))
910
#define TYPE_YUV_16_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
911
#define TYPE_YUV_16_SE (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
912
913
// HLS
914
#define TYPE_HLS_8 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1))
915
#define TYPE_HLS_8_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
916
#define TYPE_HLS_16 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2))
917
#define TYPE_HLS_16_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
918
#define TYPE_HLS_16_SE (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
919
920
// HSV
921
#define TYPE_HSV_8 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1))
922
#define TYPE_HSV_8_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
923
#define TYPE_HSV_16 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2))
924
#define TYPE_HSV_16_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
925
#define TYPE_HSV_16_SE (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
926
927
// Named color index. Only 16 bits is allowed (don't check colorspace)
928
#define TYPE_NAMED_COLOR_INDEX (CHANNELS_SH(1)|BYTES_SH(2))
929
930
// Float formatters.
931
#define TYPE_XYZ_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(4))
932
#define TYPE_Lab_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(4))
933
#define TYPE_LabA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
934
#define TYPE_GRAY_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4))
935
#define TYPE_GRAYA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4)|EXTRA_SH(1))
936
#define TYPE_GRAYA_FLT_PREMUL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4)|EXTRA_SH(1)|PREMUL_SH(1))
937
#define TYPE_RGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4))
938
939
#define TYPE_RGBA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
940
#define TYPE_RGBA_FLT_PREMUL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|PREMUL_SH(1))
941
#define TYPE_ARGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
942
#define TYPE_ARGB_FLT_PREMUL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1)|PREMUL_SH(1))
943
#define TYPE_BGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
944
#define TYPE_BGRA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
945
#define TYPE_BGRA_FLT_PREMUL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|SWAPFIRST_SH(1)|PREMUL_SH(1))
946
#define TYPE_ABGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
947
#define TYPE_ABGR_FLT_PREMUL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|PREMUL_SH(1))
948
949
#define TYPE_CMYK_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
950
951
// Floating point formatters.
952
// NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
953
#define TYPE_XYZ_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
954
#define TYPE_Lab_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
955
#define TYPE_GRAY_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
956
#define TYPE_RGB_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
957
#define TYPE_BGR_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)|DOSWAP_SH(1))
958
#define TYPE_CMYK_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))
959
#define TYPE_OKLAB_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_MCH3)|CHANNELS_SH(3)|BYTES_SH(0))
960
961
// IEEE 754-2008 "half"
962
#define TYPE_GRAY_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
963
#define TYPE_RGB_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
964
#define TYPE_CMYK_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
965
966
#define TYPE_RGBA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
967
#define TYPE_ARGB_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
968
#define TYPE_BGR_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
969
#define TYPE_BGRA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
970
#define TYPE_ABGR_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
971
972
#endif
973
974
// Colorspaces
975
typedef struct {
976
cmsFloat64Number X;
977
cmsFloat64Number Y;
978
cmsFloat64Number Z;
979
980
} cmsCIEXYZ;
981
982
typedef struct {
983
cmsFloat64Number x;
984
cmsFloat64Number y;
985
cmsFloat64Number Y;
986
987
} cmsCIExyY;
988
989
typedef struct {
990
cmsFloat64Number L;
991
cmsFloat64Number a;
992
cmsFloat64Number b;
993
994
} cmsCIELab;
995
996
typedef struct {
997
cmsFloat64Number L;
998
cmsFloat64Number C;
999
cmsFloat64Number h;
1000
1001
} cmsCIELCh;
1002
1003
typedef struct {
1004
cmsFloat64Number J;
1005
cmsFloat64Number C;
1006
cmsFloat64Number h;
1007
1008
} cmsJCh;
1009
1010
typedef struct {
1011
cmsCIEXYZ Red;
1012
cmsCIEXYZ Green;
1013
cmsCIEXYZ Blue;
1014
1015
} cmsCIEXYZTRIPLE;
1016
1017
typedef struct {
1018
cmsCIExyY Red;
1019
cmsCIExyY Green;
1020
cmsCIExyY Blue;
1021
1022
} cmsCIExyYTRIPLE;
1023
1024
// Illuminant types for structs below
1025
#define cmsILLUMINANT_TYPE_UNKNOWN 0x0000000
1026
#define cmsILLUMINANT_TYPE_D50 0x0000001
1027
#define cmsILLUMINANT_TYPE_D65 0x0000002
1028
#define cmsILLUMINANT_TYPE_D93 0x0000003
1029
#define cmsILLUMINANT_TYPE_F2 0x0000004
1030
#define cmsILLUMINANT_TYPE_D55 0x0000005
1031
#define cmsILLUMINANT_TYPE_A 0x0000006
1032
#define cmsILLUMINANT_TYPE_E 0x0000007
1033
#define cmsILLUMINANT_TYPE_F8 0x0000008
1034
1035
typedef struct {
1036
cmsUInt32Number Observer; // 0 = unknown, 1=CIE 1931, 2=CIE 1964
1037
cmsCIEXYZ Backing; // Value of backing
1038
cmsUInt32Number Geometry; // 0=unknown, 1=45/0, 0/45 2=0d, d/0
1039
cmsFloat64Number Flare; // 0..1.0
1040
cmsUInt32Number IlluminantType;
1041
1042
} cmsICCMeasurementConditions;
1043
1044
typedef struct {
1045
cmsCIEXYZ IlluminantXYZ; // Not the same struct as CAM02,
1046
cmsCIEXYZ SurroundXYZ; // This is for storing the tag
1047
cmsUInt32Number IlluminantType; // viewing condition
1048
1049
} cmsICCViewingConditions;
1050
1051
typedef struct {
1052
cmsUInt8Number ColourPrimaries; // Recommendation ITU-T H.273
1053
cmsUInt8Number TransferCharacteristics; // (ISO/IEC 23091-2)
1054
cmsUInt8Number MatrixCoefficients;
1055
cmsUInt8Number VideoFullRangeFlag;
1056
1057
} cmsVideoSignalType;
1058
1059
typedef struct {
1060
cmsUInt32Number CurveEntries;
1061
cmsFloat64Number* RedCurve;
1062
cmsFloat64Number* GreenCurve;
1063
cmsFloat64Number* BlueCurve;
1064
1065
cmsFloat64Number MinLuminance; // ST.2086 min luminance in nits
1066
cmsFloat64Number PeakLuminance; // ST.2086 peak luminance in nits
1067
1068
cmsFloat64Number XYZ2XYZmatrix[3][4];
1069
1070
} cmsMHC2Type;
1071
1072
1073
1074
// Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
1075
1076
CMSAPI int CMSEXPORT cmsGetEncodedCMMversion(void);
1077
1078
// Support of non-standard functions --------------------------------------------------------------------------------------
1079
1080
CMSAPI int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
1081
CMSAPI long int CMSEXPORT cmsfilelength(FILE* f);
1082
1083
1084
// Context handling --------------------------------------------------------------------------------------------------------
1085
1086
// Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1087
// though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1088
1089
typedef struct _cmsContext_struct* cmsContext;
1090
1091
CMSAPI cmsContext CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);
1092
CMSAPI void CMSEXPORT cmsDeleteContext(cmsContext ContextID);
1093
CMSAPI cmsContext CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData);
1094
CMSAPI void* CMSEXPORT cmsGetContextUserData(cmsContext ContextID);
1095
1096
// Plug-In registering --------------------------------------------------------------------------------------------------
1097
1098
CMSAPI cmsBool CMSEXPORT cmsPlugin(void* Plugin);
1099
CMSAPI cmsBool CMSEXPORT cmsPluginTHR(cmsContext ContextID, void* Plugin);
1100
CMSAPI void CMSEXPORT cmsUnregisterPlugins(void);
1101
CMSAPI void CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID);
1102
1103
// Error logging ----------------------------------------------------------------------------------------------------------
1104
1105
// There is no error handling at all. When a function fails, it returns proper value.
1106
// For example, all create functions does return NULL on failure. Other may return FALSE.
1107
// It may be interesting, for the developer, to know why the function is failing.
1108
// for that reason, lcms2 does offer a logging function. This function will get
1109
// an ENGLISH string with some clues on what is going wrong. You can show this
1110
// info to the end user if you wish, or just create some sort of log on disk.
1111
// The logging function should NOT terminate the program, as this obviously can leave
1112
// unfreed resources. It is the programmer's responsibility to check each function
1113
// return code to make sure it didn't fail.
1114
1115
#define cmsERROR_UNDEFINED 0
1116
#define cmsERROR_FILE 1
1117
#define cmsERROR_RANGE 2
1118
#define cmsERROR_INTERNAL 3
1119
#define cmsERROR_NULL 4
1120
#define cmsERROR_READ 5
1121
#define cmsERROR_SEEK 6
1122
#define cmsERROR_WRITE 7
1123
#define cmsERROR_UNKNOWN_EXTENSION 8
1124
#define cmsERROR_COLORSPACE_CHECK 9
1125
#define cmsERROR_ALREADY_DEFINED 10
1126
#define cmsERROR_BAD_SIGNATURE 11
1127
#define cmsERROR_CORRUPTION_DETECTED 12
1128
#define cmsERROR_NOT_SUITABLE 13
1129
1130
// Error logger is called with the ContextID when a message is raised. This gives the
1131
// chance to know which thread is responsible of the warning and any environment associated
1132
// with it. Non-multithreading applications may safely ignore this parameter.
1133
// Note that under certain special circumstances, ContextID may be NULL.
1134
typedef void (* cmsLogErrorHandlerFunction)(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text);
1135
1136
// Allows user to set any specific logger
1137
CMSAPI void CMSEXPORT cmsSetLogErrorHandler(cmsLogErrorHandlerFunction Fn);
1138
CMSAPI void CMSEXPORT cmsSetLogErrorHandlerTHR(cmsContext ContextID, cmsLogErrorHandlerFunction Fn);
1139
1140
// Conversions --------------------------------------------------------------------------------------------------------------
1141
1142
// Returns pointers to constant structs
1143
CMSAPI const cmsCIEXYZ* CMSEXPORT cmsD50_XYZ(void);
1144
CMSAPI const cmsCIExyY* CMSEXPORT cmsD50_xyY(void);
1145
1146
// Colorimetric space conversions
1147
CMSAPI void CMSEXPORT cmsXYZ2xyY(cmsCIExyY* Dest, const cmsCIEXYZ* Source);
1148
CMSAPI void CMSEXPORT cmsxyY2XYZ(cmsCIEXYZ* Dest, const cmsCIExyY* Source);
1149
CMSAPI void CMSEXPORT cmsXYZ2Lab(const cmsCIEXYZ* WhitePoint, cmsCIELab* Lab, const cmsCIEXYZ* xyz);
1150
CMSAPI void CMSEXPORT cmsLab2XYZ(const cmsCIEXYZ* WhitePoint, cmsCIEXYZ* xyz, const cmsCIELab* Lab);
1151
CMSAPI void CMSEXPORT cmsLab2LCh(cmsCIELCh*LCh, const cmsCIELab* Lab);
1152
CMSAPI void CMSEXPORT cmsLCh2Lab(cmsCIELab* Lab, const cmsCIELCh* LCh);
1153
1154
// Encoding /Decoding on PCS
1155
CMSAPI void CMSEXPORT cmsLabEncoded2Float(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1156
CMSAPI void CMSEXPORT cmsLabEncoded2FloatV2(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1157
CMSAPI void CMSEXPORT cmsFloat2LabEncoded(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1158
CMSAPI void CMSEXPORT cmsFloat2LabEncodedV2(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1159
CMSAPI void CMSEXPORT cmsXYZEncoded2Float(cmsCIEXYZ* fxyz, const cmsUInt16Number XYZ[3]);
1160
CMSAPI void CMSEXPORT cmsFloat2XYZEncoded(cmsUInt16Number XYZ[3], const cmsCIEXYZ* fXYZ);
1161
1162
// DeltaE metrics
1163
CMSAPI cmsFloat64Number CMSEXPORT cmsDeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1164
CMSAPI cmsFloat64Number CMSEXPORT cmsCIE94DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1165
CMSAPI cmsFloat64Number CMSEXPORT cmsBFDdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1166
CMSAPI cmsFloat64Number CMSEXPORT cmsCMCdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number l, cmsFloat64Number c);
1167
CMSAPI cmsFloat64Number CMSEXPORT cmsCIE2000DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number Kl, cmsFloat64Number Kc, cmsFloat64Number Kh);
1168
1169
// Temperature <-> Chromaticity (Black body)
1170
CMSAPI cmsBool CMSEXPORT cmsWhitePointFromTemp(cmsCIExyY* WhitePoint, cmsFloat64Number TempK);
1171
CMSAPI cmsBool CMSEXPORT cmsTempFromWhitePoint(cmsFloat64Number* TempK, const cmsCIExyY* WhitePoint);
1172
1173
// Chromatic adaptation
1174
CMSAPI cmsBool CMSEXPORT cmsAdaptToIlluminant(cmsCIEXYZ* Result, const cmsCIEXYZ* SourceWhitePt,
1175
const cmsCIEXYZ* Illuminant,
1176
const cmsCIEXYZ* Value);
1177
1178
// CIECAM02 ---------------------------------------------------------------------------------------------------
1179
1180
// Viewing conditions. Please note those are CAM model viewing conditions, and not the ICC tag viewing
1181
// conditions, which I'm naming cmsICCViewingConditions to make differences evident. Unfortunately, the tag
1182
// cannot deal with surround La, Yb and D value so is basically useless to store CAM02 viewing conditions.
1183
1184
1185
#define AVG_SURROUND 1
1186
#define DIM_SURROUND 2
1187
#define DARK_SURROUND 3
1188
#define CUTSHEET_SURROUND 4
1189
1190
#define D_CALCULATE (-1)
1191
1192
typedef struct {
1193
cmsCIEXYZ whitePoint;
1194
cmsFloat64Number Yb;
1195
cmsFloat64Number La;
1196
cmsUInt32Number surround;
1197
cmsFloat64Number D_value;
1198
1199
} cmsViewingConditions;
1200
1201
CMSAPI cmsHANDLE CMSEXPORT cmsCIECAM02Init(cmsContext ContextID, const cmsViewingConditions* pVC);
1202
CMSAPI void CMSEXPORT cmsCIECAM02Done(cmsHANDLE hModel);
1203
CMSAPI void CMSEXPORT cmsCIECAM02Forward(cmsHANDLE hModel, const cmsCIEXYZ* pIn, cmsJCh* pOut);
1204
CMSAPI void CMSEXPORT cmsCIECAM02Reverse(cmsHANDLE hModel, const cmsJCh* pIn, cmsCIEXYZ* pOut);
1205
1206
1207
// Tone curves -----------------------------------------------------------------------------------------
1208
1209
// This describes a curve segment. For a table of supported types, see the manual. User can increase the number of
1210
// available types by using a proper plug-in. Parametric segments allow 10 parameters at most
1211
1212
typedef struct {
1213
cmsFloat32Number x0, x1; // Domain; for x0 < x <= x1
1214
cmsInt32Number Type; // Parametric type, Type == 0 means sampled segment. Negative values are reserved
1215
cmsFloat64Number Params[10]; // Parameters if Type != 0
1216
cmsUInt32Number nGridPoints; // Number of grid points if Type == 0
1217
cmsFloat32Number* SampledPoints; // Points to an array of floats if Type == 0
1218
1219
} cmsCurveSegment;
1220
1221
// The internal representation is none of your business.
1222
typedef struct _cms_curve_struct cmsToneCurve;
1223
1224
CMSAPI cmsToneCurve* CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]);
1225
CMSAPI cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1226
CMSAPI cmsToneCurve* CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1227
CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]);
1228
CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1229
CMSAPI void CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1230
CMSAPI void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1231
CMSAPI cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1232
CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1233
CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma);
1234
CMSAPI cmsToneCurve* CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X, const cmsToneCurve* Y, cmsUInt32Number nPoints);
1235
CMSAPI cmsBool CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1236
CMSAPI cmsFloat32Number CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1237
CMSAPI cmsUInt16Number CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1238
CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1239
CMSAPI cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1240
CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1241
CMSAPI cmsBool CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1242
CMSAPI cmsInt32Number CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1243
CMSAPI cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1244
1245
CMSAPI const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t);
1246
1247
// Tone curve tabular estimation
1248
CMSAPI cmsUInt32Number CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1249
CMSAPI const cmsUInt16Number* CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1250
1251
1252
// Implements pipelines of multi-processing elements -------------------------------------------------------------
1253
1254
// Nothing to see here, move along
1255
typedef struct _cmsPipeline_struct cmsPipeline;
1256
typedef struct _cmsStage_struct cmsStage;
1257
1258
// Those are hi-level pipelines
1259
CMSAPI cmsPipeline* CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1260
CMSAPI void CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1261
CMSAPI cmsPipeline* CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1262
1263
CMSAPI cmsContext CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1264
CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1265
CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);
1266
1267
CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineStageCount(const cmsPipeline* lut);
1268
CMSAPI cmsStage* CMSEXPORT cmsPipelineGetPtrToFirstStage(const cmsPipeline* lut);
1269
CMSAPI cmsStage* CMSEXPORT cmsPipelineGetPtrToLastStage(const cmsPipeline* lut);
1270
1271
CMSAPI void CMSEXPORT cmsPipelineEval16(const cmsUInt16Number In[], cmsUInt16Number Out[], const cmsPipeline* lut);
1272
CMSAPI void CMSEXPORT cmsPipelineEvalFloat(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsPipeline* lut);
1273
CMSAPI cmsBool CMSEXPORT cmsPipelineEvalReverseFloat(cmsFloat32Number Target[], cmsFloat32Number Result[], cmsFloat32Number Hint[], const cmsPipeline* lut);
1274
CMSAPI cmsBool CMSEXPORT cmsPipelineCat(cmsPipeline* l1, const cmsPipeline* l2);
1275
CMSAPI cmsBool CMSEXPORT cmsPipelineSetSaveAs8bitsFlag(cmsPipeline* lut, cmsBool On);
1276
1277
// Where to place/locate the stages in the pipeline chain
1278
typedef enum { cmsAT_BEGIN, cmsAT_END } cmsStageLoc;
1279
1280
CMSAPI cmsBool CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage* mpe);
1281
CMSAPI void CMSEXPORT cmsPipelineUnlinkStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage** mpe);
1282
1283
// This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements
1284
// that conform the Pipeline. It should be called with the Pipeline, the number of expected elements and
1285
// then a list of expected types followed with a list of double pointers to Stage elements. If
1286
// the function founds a match with current pipeline, it fills the pointers and returns TRUE
1287
// if not, returns FALSE without touching anything.
1288
CMSAPI cmsBool CMSEXPORT cmsPipelineCheckAndRetreiveStages(const cmsPipeline* Lut, cmsUInt32Number n, ...);
1289
1290
// Matrix has double precision and CLUT has only float precision. That is because an ICC profile can encode
1291
// matrices with far more precision that CLUTS
1292
CMSAPI cmsStage* CMSEXPORT cmsStageAllocIdentity(cmsContext ContextID, cmsUInt32Number nChannels);
1293
CMSAPI cmsStage* CMSEXPORT cmsStageAllocToneCurves(cmsContext ContextID, cmsUInt32Number nChannels, cmsToneCurve* const Curves[]);
1294
CMSAPI cmsStage* CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number Rows, cmsUInt32Number Cols, const cmsFloat64Number* Matrix, const cmsFloat64Number* Offset);
1295
1296
CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLut16bit(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1297
CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLutFloat(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1298
1299
CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1300
CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1301
1302
CMSAPI cmsStage* CMSEXPORT cmsStageDup(cmsStage* mpe);
1303
CMSAPI void CMSEXPORT cmsStageFree(cmsStage* mpe);
1304
CMSAPI cmsStage* CMSEXPORT cmsStageNext(const cmsStage* mpe);
1305
1306
CMSAPI cmsUInt32Number CMSEXPORT cmsStageInputChannels(const cmsStage* mpe);
1307
CMSAPI cmsUInt32Number CMSEXPORT cmsStageOutputChannels(const cmsStage* mpe);
1308
CMSAPI cmsStageSignature CMSEXPORT cmsStageType(const cmsStage* mpe);
1309
CMSAPI void* CMSEXPORT cmsStageData(const cmsStage* mpe);
1310
CMSAPI cmsContext CMSEXPORT cmsGetStageContextID(const cmsStage* mpe);
1311
1312
// Sampling
1313
typedef cmsInt32Number (* cmsSAMPLER16) (CMSREGISTER const cmsUInt16Number In[],
1314
CMSREGISTER cmsUInt16Number Out[],
1315
CMSREGISTER void * Cargo);
1316
1317
typedef cmsInt32Number (* cmsSAMPLERFLOAT)(CMSREGISTER const cmsFloat32Number In[],
1318
CMSREGISTER cmsFloat32Number Out[],
1319
CMSREGISTER void * Cargo);
1320
1321
// Use this flag to prevent changes being written to destination
1322
#define SAMPLER_INSPECT 0x01000000
1323
1324
// For CLUT only
1325
CMSAPI cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1326
CMSAPI cmsBool CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1327
1328
// Slicers
1329
CMSAPI cmsBool CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1330
cmsSAMPLER16 Sampler, void * Cargo);
1331
1332
CMSAPI cmsBool CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1333
cmsSAMPLERFLOAT Sampler, void * Cargo);
1334
1335
// Multilocalized Unicode management ---------------------------------------------------------------------------------------
1336
1337
typedef struct _cms_MLU_struct cmsMLU;
1338
1339
#define cmsNoLanguage "\0\0"
1340
#define cmsNoCountry "\0\0"
1341
1342
// Special language/country to retrieve unicode field for description in V2 profiles. Use with care.
1343
#define cmsV2Unicode "\xff\xff"
1344
1345
CMSAPI cmsMLU* CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems);
1346
CMSAPI void CMSEXPORT cmsMLUfree(cmsMLU* mlu);
1347
CMSAPI cmsMLU* CMSEXPORT cmsMLUdup(const cmsMLU* mlu);
1348
1349
CMSAPI cmsBool CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu,
1350
const char LanguageCode[3], const char CountryCode[3],
1351
const char* ASCIIString);
1352
CMSAPI cmsBool CMSEXPORT cmsMLUsetWide(cmsMLU* mlu,
1353
const char LanguageCode[3], const char CountryCode[3],
1354
const wchar_t* WideString);
1355
CMSAPI cmsBool CMSEXPORT cmsMLUsetUTF8(cmsMLU* mlu,
1356
const char LanguageCode[3], const char CountryCode[3],
1357
const char* UTF8String);
1358
1359
CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
1360
const char LanguageCode[3], const char CountryCode[3],
1361
char* Buffer, cmsUInt32Number BufferSize);
1362
1363
CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
1364
const char LanguageCode[3], const char CountryCode[3],
1365
wchar_t* Buffer, cmsUInt32Number BufferSize);
1366
CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetUTF8(const cmsMLU* mlu,
1367
const char LanguageCode[3], const char CountryCode[3],
1368
char* Buffer, cmsUInt32Number BufferSize);
1369
1370
1371
CMSAPI cmsBool CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
1372
const char LanguageCode[3], const char CountryCode[3],
1373
char ObtainedLanguage[3], char ObtainedCountry[3]);
1374
1375
CMSAPI cmsUInt32Number CMSEXPORT cmsMLUtranslationsCount(const cmsMLU* mlu);
1376
1377
CMSAPI cmsBool CMSEXPORT cmsMLUtranslationsCodes(const cmsMLU* mlu,
1378
cmsUInt32Number idx,
1379
char LanguageCode[3],
1380
char CountryCode[3]);
1381
1382
// Undercolorremoval & black generation -------------------------------------------------------------------------------------
1383
1384
typedef struct {
1385
cmsToneCurve* Ucr;
1386
cmsToneCurve* Bg;
1387
cmsMLU* Desc;
1388
1389
} cmsUcrBg;
1390
1391
// Screening ----------------------------------------------------------------------------------------------------------------
1392
1393
#define cmsPRINTER_DEFAULT_SCREENS 0x0001
1394
#define cmsFREQUENCE_UNITS_LINES_CM 0x0000
1395
#define cmsFREQUENCE_UNITS_LINES_INCH 0x0002
1396
1397
#define cmsSPOT_UNKNOWN 0
1398
#define cmsSPOT_PRINTER_DEFAULT 1
1399
#define cmsSPOT_ROUND 2
1400
#define cmsSPOT_DIAMOND 3
1401
#define cmsSPOT_ELLIPSE 4
1402
#define cmsSPOT_LINE 5
1403
#define cmsSPOT_SQUARE 6
1404
#define cmsSPOT_CROSS 7
1405
1406
typedef struct {
1407
cmsFloat64Number Frequency;
1408
cmsFloat64Number ScreenAngle;
1409
cmsUInt32Number SpotShape;
1410
1411
} cmsScreeningChannel;
1412
1413
typedef struct {
1414
cmsUInt32Number Flag;
1415
cmsUInt32Number nChannels;
1416
cmsScreeningChannel Channels[cmsMAXCHANNELS];
1417
1418
} cmsScreening;
1419
1420
1421
// Named color -----------------------------------------------------------------------------------------------------------------
1422
1423
typedef struct _cms_NAMEDCOLORLIST_struct cmsNAMEDCOLORLIST;
1424
1425
CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsContext ContextID,
1426
cmsUInt32Number n,
1427
cmsUInt32Number ColorantCount,
1428
const char* Prefix, const char* Suffix);
1429
1430
CMSAPI void CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v);
1431
CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v);
1432
CMSAPI cmsBool CMSEXPORT cmsAppendNamedColor(cmsNAMEDCOLORLIST* v, const char* Name,
1433
cmsUInt16Number PCS[3],
1434
cmsUInt16Number Colorant[cmsMAXCHANNELS]);
1435
1436
CMSAPI cmsUInt32Number CMSEXPORT cmsNamedColorCount(const cmsNAMEDCOLORLIST* v);
1437
CMSAPI cmsInt32Number CMSEXPORT cmsNamedColorIndex(const cmsNAMEDCOLORLIST* v, const char* Name);
1438
1439
CMSAPI cmsBool CMSEXPORT cmsNamedColorInfo(const cmsNAMEDCOLORLIST* NamedColorList, cmsUInt32Number nColor,
1440
char* Name,
1441
char* Prefix,
1442
char* Suffix,
1443
cmsUInt16Number* PCS,
1444
cmsUInt16Number* Colorant);
1445
1446
// Retrieve named color list from transform
1447
CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsGetNamedColorList(cmsHTRANSFORM xform);
1448
1449
// Profile sequence -----------------------------------------------------------------------------------------------------
1450
1451
// Profile sequence descriptor. Some fields come from profile sequence descriptor tag, others
1452
// come from Profile Sequence Identifier Tag
1453
typedef struct {
1454
1455
cmsSignature deviceMfg;
1456
cmsSignature deviceModel;
1457
cmsUInt64Number attributes;
1458
cmsTechnologySignature technology;
1459
cmsProfileID ProfileID;
1460
cmsMLU* Manufacturer;
1461
cmsMLU* Model;
1462
cmsMLU* Description;
1463
1464
} cmsPSEQDESC;
1465
1466
typedef struct {
1467
1468
cmsUInt32Number n;
1469
cmsContext ContextID;
1470
cmsPSEQDESC* seq;
1471
1472
} cmsSEQ;
1473
1474
CMSAPI cmsSEQ* CMSEXPORT cmsAllocProfileSequenceDescription(cmsContext ContextID, cmsUInt32Number n);
1475
CMSAPI cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq);
1476
CMSAPI void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq);
1477
1478
// Dictionaries --------------------------------------------------------------------------------------------------------
1479
1480
typedef struct _cmsDICTentry_struct {
1481
1482
struct _cmsDICTentry_struct* Next;
1483
1484
cmsMLU *DisplayName;
1485
cmsMLU *DisplayValue;
1486
wchar_t* Name;
1487
wchar_t* Value;
1488
1489
} cmsDICTentry;
1490
1491
CMSAPI cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID);
1492
CMSAPI void CMSEXPORT cmsDictFree(cmsHANDLE hDict);
1493
CMSAPI cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict);
1494
1495
CMSAPI cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue);
1496
CMSAPI const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict);
1497
CMSAPI const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e);
1498
1499
// Access to Profile data ----------------------------------------------------------------------------------------------
1500
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateProfilePlaceholder(cmsContext ContextID);
1501
1502
CMSAPI cmsContext CMSEXPORT cmsGetProfileContextID(cmsHPROFILE hProfile);
1503
CMSAPI cmsInt32Number CMSEXPORT cmsGetTagCount(cmsHPROFILE hProfile);
1504
CMSAPI cmsTagSignature CMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, cmsUInt32Number n);
1505
CMSAPI cmsBool CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1506
1507
// Read and write pre-formatted data
1508
CMSAPI void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1509
CMSAPI cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data);
1510
CMSAPI cmsBool CMSEXPORT cmsLinkTag(cmsHPROFILE hProfile, cmsTagSignature sig, cmsTagSignature dest);
1511
CMSAPI cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig);
1512
1513
// Read and write raw data
1514
CMSAPI cmsUInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize);
1515
CMSAPI cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size);
1516
1517
// Access header data
1518
#define cmsEmbeddedProfileFalse 0x00000000
1519
#define cmsEmbeddedProfileTrue 0x00000001
1520
#define cmsUseAnywhere 0x00000000
1521
#define cmsUseWithEmbeddedDataOnly 0x00000002
1522
1523
CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderFlags(cmsHPROFILE hProfile);
1524
CMSAPI void CMSEXPORT cmsGetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number* Flags);
1525
CMSAPI void CMSEXPORT cmsGetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1526
CMSAPI cmsBool CMSEXPORT cmsGetHeaderCreationDateTime(cmsHPROFILE hProfile, struct tm *Dest);
1527
CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderRenderingIntent(cmsHPROFILE hProfile);
1528
1529
CMSAPI void CMSEXPORT cmsSetHeaderFlags(cmsHPROFILE hProfile, cmsUInt32Number Flags);
1530
CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderManufacturer(cmsHPROFILE hProfile);
1531
CMSAPI void CMSEXPORT cmsSetHeaderManufacturer(cmsHPROFILE hProfile, cmsUInt32Number manufacturer);
1532
CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderCreator(cmsHPROFILE hProfile);
1533
CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderModel(cmsHPROFILE hProfile);
1534
CMSAPI void CMSEXPORT cmsSetHeaderModel(cmsHPROFILE hProfile, cmsUInt32Number model);
1535
CMSAPI void CMSEXPORT cmsSetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number Flags);
1536
CMSAPI void CMSEXPORT cmsSetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1537
CMSAPI void CMSEXPORT cmsSetHeaderRenderingIntent(cmsHPROFILE hProfile, cmsUInt32Number RenderingIntent);
1538
1539
CMSAPI cmsColorSpaceSignature
1540
CMSEXPORT cmsGetPCS(cmsHPROFILE hProfile);
1541
CMSAPI void CMSEXPORT cmsSetPCS(cmsHPROFILE hProfile, cmsColorSpaceSignature pcs);
1542
CMSAPI cmsColorSpaceSignature
1543
CMSEXPORT cmsGetColorSpace(cmsHPROFILE hProfile);
1544
CMSAPI void CMSEXPORT cmsSetColorSpace(cmsHPROFILE hProfile, cmsColorSpaceSignature sig);
1545
CMSAPI cmsProfileClassSignature
1546
CMSEXPORT cmsGetDeviceClass(cmsHPROFILE hProfile);
1547
CMSAPI void CMSEXPORT cmsSetDeviceClass(cmsHPROFILE hProfile, cmsProfileClassSignature sig);
1548
CMSAPI void CMSEXPORT cmsSetProfileVersion(cmsHPROFILE hProfile, cmsFloat64Number Version);
1549
CMSAPI cmsFloat64Number CMSEXPORT cmsGetProfileVersion(cmsHPROFILE hProfile);
1550
1551
CMSAPI cmsUInt32Number CMSEXPORT cmsGetEncodedICCversion(cmsHPROFILE hProfile);
1552
CMSAPI void CMSEXPORT cmsSetEncodedICCversion(cmsHPROFILE hProfile, cmsUInt32Number Version);
1553
1554
// How profiles may be used
1555
#define LCMS_USED_AS_INPUT 0
1556
#define LCMS_USED_AS_OUTPUT 1
1557
#define LCMS_USED_AS_PROOF 2
1558
1559
CMSAPI cmsBool CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1560
CMSAPI cmsBool CMSEXPORT cmsIsMatrixShaper(cmsHPROFILE hProfile);
1561
CMSAPI cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1562
1563
// Translate form/to our notation to ICC
1564
CMSAPI cmsColorSpaceSignature CMSEXPORT _cmsICCcolorSpace(int OurNotation);
1565
CMSAPI int CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignature ProfileSpace);
1566
1567
// Deprecated, use cmsChannelsOfColorSpace instead
1568
CMSAPI cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace);
1569
1570
// Get number of channels of color space or -1 if color space is not listed/supported
1571
CMSAPI cmsInt32Number CMSEXPORT cmsChannelsOfColorSpace(cmsColorSpaceSignature ColorSpace);
1572
1573
// Build a suitable formatter for the colorspace of this profile. nBytes=1 means 8 bits, nBytes=2 means 16 bits.
1574
CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1575
CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1576
1577
1578
// Localized info
1579
typedef enum {
1580
cmsInfoDescription = 0,
1581
cmsInfoManufacturer = 1,
1582
cmsInfoModel = 2,
1583
cmsInfoCopyright = 3
1584
} cmsInfoType;
1585
1586
CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfo(cmsHPROFILE hProfile, cmsInfoType Info,
1587
const char LanguageCode[3], const char CountryCode[3],
1588
wchar_t* Buffer, cmsUInt32Number BufferSize);
1589
1590
CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
1591
const char LanguageCode[3], const char CountryCode[3],
1592
char* Buffer, cmsUInt32Number BufferSize);
1593
1594
CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfoUTF8(cmsHPROFILE hProfile, cmsInfoType Info,
1595
const char LanguageCode[3], const char CountryCode[3],
1596
char* Buffer, cmsUInt32Number BufferSize);
1597
1598
// IO handlers ----------------------------------------------------------------------------------------------------------
1599
1600
typedef struct _cms_io_handler cmsIOHANDLER;
1601
1602
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const char* FileName, const char* AccessMode);
1603
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
1604
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
1605
CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
1606
CMSAPI cmsIOHANDLER* CMSEXPORT cmsGetProfileIOhandler(cmsHPROFILE hProfile);
1607
CMSAPI cmsBool CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);
1608
1609
// MD5 message digest --------------------------------------------------------------------------------------------------
1610
1611
CMSAPI cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile);
1612
1613
// Profile high level functions ------------------------------------------------------------------------------------------
1614
1615
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
1616
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess);
1617
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char* sAccess);
1618
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromStreamTHR(cmsContext ContextID, FILE* ICCProfile, const char* sAccess);
1619
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromMem(const void * MemPtr, cmsUInt32Number dwSize);
1620
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromMemTHR(cmsContext ContextID, const void * MemPtr, cmsUInt32Number dwSize);
1621
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromIOhandlerTHR(cmsContext ContextID, cmsIOHANDLER* io);
1622
CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromIOhandler2THR(cmsContext ContextID, cmsIOHANDLER* io, cmsBool write);
1623
CMSAPI cmsBool CMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile);
1624
1625
CMSAPI cmsBool CMSEXPORT cmsSaveProfileToFile(cmsHPROFILE hProfile, const char* FileName);
1626
CMSAPI cmsBool CMSEXPORT cmsSaveProfileToStream(cmsHPROFILE hProfile, FILE* Stream);
1627
CMSAPI cmsBool CMSEXPORT cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr, cmsUInt32Number* BytesNeeded);
1628
CMSAPI cmsUInt32Number CMSEXPORT cmsSaveProfileToIOhandler(cmsHPROFILE hProfile, cmsIOHANDLER* io);
1629
1630
// Predefined virtual profiles ------------------------------------------------------------------------------------------
1631
1632
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateRGBProfileTHR(cmsContext ContextID,
1633
const cmsCIExyY* WhitePoint,
1634
const cmsCIExyYTRIPLE* Primaries,
1635
cmsToneCurve* const TransferFunction[3]);
1636
1637
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateRGBProfile(const cmsCIExyY* WhitePoint,
1638
const cmsCIExyYTRIPLE* Primaries,
1639
cmsToneCurve* const TransferFunction[3]);
1640
1641
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
1642
const cmsCIExyY* WhitePoint,
1643
const cmsToneCurve* TransferFunction);
1644
1645
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateGrayProfile(const cmsCIExyY* WhitePoint,
1646
const cmsToneCurve* TransferFunction);
1647
1648
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
1649
cmsColorSpaceSignature ColorSpace,
1650
cmsToneCurve* const TransferFunctions[]);
1651
1652
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLink(cmsColorSpaceSignature ColorSpace,
1653
cmsToneCurve* const TransferFunctions[]);
1654
1655
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
1656
cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1657
1658
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLink(cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1659
1660
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateDeviceLinkFromCubeFile(const char* cFileName);
1661
1662
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateDeviceLinkFromCubeFileTHR(cmsContext ContextID, const char* cFileName);
1663
1664
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1665
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab2Profile(const cmsCIExyY* WhitePoint);
1666
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1667
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab4Profile(const cmsCIExyY* WhitePoint);
1668
1669
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID);
1670
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateXYZProfile(void);
1671
1672
CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfileTHR(cmsContext ContextID);
1673
CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfile(void);
1674
1675
CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_OkLabProfile(cmsContext ctx);
1676
1677
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
1678
cmsUInt32Number nLUTPoints,
1679
cmsFloat64Number Bright,
1680
cmsFloat64Number Contrast,
1681
cmsFloat64Number Hue,
1682
cmsFloat64Number Saturation,
1683
cmsUInt32Number TempSrc,
1684
cmsUInt32Number TempDest);
1685
1686
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(cmsUInt32Number nLUTPoints,
1687
cmsFloat64Number Bright,
1688
cmsFloat64Number Contrast,
1689
cmsFloat64Number Hue,
1690
cmsFloat64Number Saturation,
1691
cmsUInt32Number TempSrc,
1692
cmsUInt32Number TempDest);
1693
1694
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID);
1695
CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfile(void);
1696
1697
// Converts a transform to a devicelink profile
1698
CMSAPI cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat64Number Version, cmsUInt32Number dwFlags);
1699
1700
// Intents ----------------------------------------------------------------------------------------------
1701
1702
// ICC Intents
1703
#define INTENT_PERCEPTUAL 0
1704
#define INTENT_RELATIVE_COLORIMETRIC 1
1705
#define INTENT_SATURATION 2
1706
#define INTENT_ABSOLUTE_COLORIMETRIC 3
1707
1708
// Non-ICC intents
1709
#define INTENT_PRESERVE_K_ONLY_PERCEPTUAL 10
1710
#define INTENT_PRESERVE_K_ONLY_RELATIVE_COLORIMETRIC 11
1711
#define INTENT_PRESERVE_K_ONLY_SATURATION 12
1712
#define INTENT_PRESERVE_K_PLANE_PERCEPTUAL 13
1713
#define INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC 14
1714
#define INTENT_PRESERVE_K_PLANE_SATURATION 15
1715
1716
// Call with NULL as parameters to get the intent count
1717
CMSAPI cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1718
CMSAPI cmsUInt32Number CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID, cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1719
1720
// Flags
1721
1722
#define cmsFLAGS_NOCACHE 0x0040 // Inhibit 1-pixel cache
1723
#define cmsFLAGS_NOOPTIMIZE 0x0100 // Inhibit optimizations
1724
#define cmsFLAGS_NULLTRANSFORM 0x0200 // Don't transform anyway
1725
1726
// Proofing flags
1727
#define cmsFLAGS_GAMUTCHECK 0x1000 // Out of Gamut alarm
1728
#define cmsFLAGS_SOFTPROOFING 0x4000 // Do softproofing
1729
1730
// Misc
1731
#define cmsFLAGS_BLACKPOINTCOMPENSATION 0x2000
1732
#define cmsFLAGS_NOWHITEONWHITEFIXUP 0x0004 // Don't fix scum dot
1733
#define cmsFLAGS_HIGHRESPRECALC 0x0400 // Use more memory to give better accuracy
1734
#define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resources
1735
1736
// For devicelink creation
1737
#define cmsFLAGS_8BITS_DEVICELINK 0x0008 // Create 8 bits devicelinks
1738
#define cmsFLAGS_GUESSDEVICECLASS 0x0020 // Guess device class (for transform2devicelink)
1739
#define cmsFLAGS_KEEP_SEQUENCE 0x0080 // Keep profile sequence for devicelink creation
1740
1741
// Specific to a particular optimizations
1742
#define cmsFLAGS_FORCE_CLUT 0x0002 // Force CLUT optimization
1743
#define cmsFLAGS_CLUT_POST_LINEARIZATION 0x0001 // create postlinearization tables if possible
1744
#define cmsFLAGS_CLUT_PRE_LINEARIZATION 0x0010 // create prelinearization tables if possible
1745
1746
// Specific to unbounded mode
1747
#define cmsFLAGS_NONEGATIVES 0x8000 // Prevent negative numbers in floating point transforms
1748
1749
// Copy alpha channels when transforming
1750
#define cmsFLAGS_COPY_ALPHA 0x04000000 // Alpha channels are copied on cmsDoTransform()
1751
1752
// Fine-tune control over number of gridpoints
1753
#define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16)
1754
1755
// CRD special
1756
#define cmsFLAGS_NODEFAULTRESOURCEDEF 0x01000000
1757
1758
// Transforms ---------------------------------------------------------------------------------------------------
1759
1760
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransformTHR(cmsContext ContextID,
1761
cmsHPROFILE Input,
1762
cmsUInt32Number InputFormat,
1763
cmsHPROFILE Output,
1764
cmsUInt32Number OutputFormat,
1765
cmsUInt32Number Intent,
1766
cmsUInt32Number dwFlags);
1767
1768
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransform(cmsHPROFILE Input,
1769
cmsUInt32Number InputFormat,
1770
cmsHPROFILE Output,
1771
cmsUInt32Number OutputFormat,
1772
cmsUInt32Number Intent,
1773
cmsUInt32Number dwFlags);
1774
1775
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransformTHR(cmsContext ContextID,
1776
cmsHPROFILE Input,
1777
cmsUInt32Number InputFormat,
1778
cmsHPROFILE Output,
1779
cmsUInt32Number OutputFormat,
1780
cmsHPROFILE Proofing,
1781
cmsUInt32Number Intent,
1782
cmsUInt32Number ProofingIntent,
1783
cmsUInt32Number dwFlags);
1784
1785
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransform(cmsHPROFILE Input,
1786
cmsUInt32Number InputFormat,
1787
cmsHPROFILE Output,
1788
cmsUInt32Number OutputFormat,
1789
cmsHPROFILE Proofing,
1790
cmsUInt32Number Intent,
1791
cmsUInt32Number ProofingIntent,
1792
cmsUInt32Number dwFlags);
1793
1794
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransformTHR(cmsContext ContextID,
1795
cmsHPROFILE hProfiles[],
1796
cmsUInt32Number nProfiles,
1797
cmsUInt32Number InputFormat,
1798
cmsUInt32Number OutputFormat,
1799
cmsUInt32Number Intent,
1800
cmsUInt32Number dwFlags);
1801
1802
1803
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[],
1804
cmsUInt32Number nProfiles,
1805
cmsUInt32Number InputFormat,
1806
cmsUInt32Number OutputFormat,
1807
cmsUInt32Number Intent,
1808
cmsUInt32Number dwFlags);
1809
1810
1811
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
1812
cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[],
1813
cmsBool BPC[],
1814
cmsUInt32Number Intents[],
1815
cmsFloat64Number AdaptationStates[],
1816
cmsHPROFILE hGamutProfile,
1817
cmsUInt32Number nGamutPCSposition,
1818
cmsUInt32Number InputFormat,
1819
cmsUInt32Number OutputFormat,
1820
cmsUInt32Number dwFlags);
1821
1822
CMSAPI void CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform);
1823
1824
CMSAPI void CMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform,
1825
const void * InputBuffer,
1826
void * OutputBuffer,
1827
cmsUInt32Number Size);
1828
1829
CMSAPI void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform, // Deprecated
1830
const void * InputBuffer,
1831
void * OutputBuffer,
1832
cmsUInt32Number Size,
1833
cmsUInt32Number Stride);
1834
1835
CMSAPI void CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM Transform,
1836
const void* InputBuffer,
1837
void* OutputBuffer,
1838
cmsUInt32Number PixelsPerLine,
1839
cmsUInt32Number LineCount,
1840
cmsUInt32Number BytesPerLineIn,
1841
cmsUInt32Number BytesPerLineOut,
1842
cmsUInt32Number BytesPerPlaneIn,
1843
cmsUInt32Number BytesPerPlaneOut);
1844
1845
1846
CMSAPI void CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1847
CMSAPI void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1848
1849
1850
CMSAPI void CMSEXPORT cmsSetAlarmCodesTHR(cmsContext ContextID,
1851
const cmsUInt16Number AlarmCodes[cmsMAXCHANNELS]);
1852
CMSAPI void CMSEXPORT cmsGetAlarmCodesTHR(cmsContext ContextID,
1853
cmsUInt16Number AlarmCodes[cmsMAXCHANNELS]);
1854
1855
1856
1857
// Adaptation state for absolute colorimetric intent
1858
CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d);
1859
CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationStateTHR(cmsContext ContextID, cmsFloat64Number d);
1860
1861
1862
1863
// Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed
1864
CMSAPI cmsContext CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform);
1865
1866
// Grab the input/output formats
1867
CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform);
1868
CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform);
1869
1870
// For backwards compatibility
1871
CMSAPI cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform,
1872
cmsUInt32Number InputFormat,
1873
cmsUInt32Number OutputFormat);
1874
1875
1876
1877
// PostScript ColorRenderingDictionary and ColorSpaceArray ----------------------------------------------------
1878
1879
typedef enum { cmsPS_RESOURCE_CSA, cmsPS_RESOURCE_CRD } cmsPSResourceType;
1880
1881
// lcms2 unified method to access postscript color resources
1882
CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptColorResource(cmsContext ContextID,
1883
cmsPSResourceType Type,
1884
cmsHPROFILE hProfile,
1885
cmsUInt32Number Intent,
1886
cmsUInt32Number dwFlags,
1887
cmsIOHANDLER* io);
1888
1889
CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptCSA(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1890
CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptCRD(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1891
1892
1893
// IT8.7 / CGATS.17-200x handling -----------------------------------------------------------------------------
1894
1895
CMSAPI cmsHANDLE CMSEXPORT cmsIT8Alloc(cmsContext ContextID);
1896
CMSAPI void CMSEXPORT cmsIT8Free(cmsHANDLE hIT8);
1897
1898
// Tables
1899
CMSAPI cmsUInt32Number CMSEXPORT cmsIT8TableCount(cmsHANDLE hIT8);
1900
CMSAPI cmsInt32Number CMSEXPORT cmsIT8SetTable(cmsHANDLE hIT8, cmsUInt32Number nTable);
1901
1902
// Persistence
1903
CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromFile(cmsContext ContextID, const char* cFileName);
1904
CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, const void *Ptr, cmsUInt32Number len);
1905
// CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromIOhandler(cmsContext ContextID, cmsIOHANDLER* io);
1906
1907
CMSAPI cmsBool CMSEXPORT cmsIT8SaveToFile(cmsHANDLE hIT8, const char* cFileName);
1908
CMSAPI cmsBool CMSEXPORT cmsIT8SaveToMem(cmsHANDLE hIT8, void *MemPtr, cmsUInt32Number* BytesNeeded);
1909
1910
// Properties
1911
CMSAPI const char* CMSEXPORT cmsIT8GetSheetType(cmsHANDLE hIT8);
1912
CMSAPI cmsBool CMSEXPORT cmsIT8SetSheetType(cmsHANDLE hIT8, const char* Type);
1913
1914
CMSAPI cmsBool CMSEXPORT cmsIT8SetComment(cmsHANDLE hIT8, const char* cComment);
1915
1916
CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyStr(cmsHANDLE hIT8, const char* cProp, const char *Str);
1917
CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val);
1918
CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyHex(cmsHANDLE hIT8, const char* cProp, cmsUInt32Number Val);
1919
CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char* SubKey, const char *Buffer);
1920
CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyUncooked(cmsHANDLE hIT8, const char* Key, const char* Buffer);
1921
1922
1923
CMSAPI const char* CMSEXPORT cmsIT8GetProperty(cmsHANDLE hIT8, const char* cProp);
1924
CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetPropertyDbl(cmsHANDLE hIT8, const char* cProp);
1925
CMSAPI const char* CMSEXPORT cmsIT8GetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char *SubKey);
1926
CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumProperties(cmsHANDLE hIT8, char ***PropertyNames);
1927
CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumPropertyMulti(cmsHANDLE hIT8, const char* cProp, const char ***SubpropertyNames);
1928
1929
// Datasets
1930
CMSAPI const char* CMSEXPORT cmsIT8GetDataRowCol(cmsHANDLE hIT8, int row, int col);
1931
CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataRowColDbl(cmsHANDLE hIT8, int row, int col);
1932
1933
CMSAPI cmsBool CMSEXPORT cmsIT8SetDataRowCol(cmsHANDLE hIT8, int row, int col,
1934
const char* Val);
1935
1936
CMSAPI cmsBool CMSEXPORT cmsIT8SetDataRowColDbl(cmsHANDLE hIT8, int row, int col,
1937
cmsFloat64Number Val);
1938
1939
CMSAPI const char* CMSEXPORT cmsIT8GetData(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1940
1941
1942
CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1943
1944
CMSAPI cmsBool CMSEXPORT cmsIT8SetData(cmsHANDLE hIT8, const char* cPatch,
1945
const char* cSample,
1946
const char *Val);
1947
1948
CMSAPI cmsBool CMSEXPORT cmsIT8SetDataDbl(cmsHANDLE hIT8, const char* cPatch,
1949
const char* cSample,
1950
cmsFloat64Number Val);
1951
1952
CMSAPI int CMSEXPORT cmsIT8FindDataFormat(cmsHANDLE hIT8, const char* cSample);
1953
CMSAPI cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE hIT8, int n, const char *Sample);
1954
CMSAPI int CMSEXPORT cmsIT8EnumDataFormat(cmsHANDLE hIT8, char ***SampleNames);
1955
1956
CMSAPI const char* CMSEXPORT cmsIT8GetPatchName(cmsHANDLE hIT8, int nPatch, char* buffer);
1957
CMSAPI int CMSEXPORT cmsIT8GetPatchByName(cmsHANDLE hIT8, const char *cPatch);
1958
1959
// The LABEL extension
1960
CMSAPI int CMSEXPORT cmsIT8SetTableByLabel(cmsHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType);
1961
1962
CMSAPI cmsBool CMSEXPORT cmsIT8SetIndexColumn(cmsHANDLE hIT8, const char* cSample);
1963
1964
// Formatter for double
1965
CMSAPI void CMSEXPORT cmsIT8DefineDblFormat(cmsHANDLE hIT8, const char* Formatter);
1966
1967
// Gamut boundary description routines ------------------------------------------------------------------------------
1968
1969
CMSAPI cmsHANDLE CMSEXPORT cmsGBDAlloc(cmsContext ContextID);
1970
CMSAPI void CMSEXPORT cmsGBDFree(cmsHANDLE hGBD);
1971
CMSAPI cmsBool CMSEXPORT cmsGDBAddPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1972
CMSAPI cmsBool CMSEXPORT cmsGDBCompute(cmsHANDLE hGDB, cmsUInt32Number dwFlags);
1973
CMSAPI cmsBool CMSEXPORT cmsGDBCheckPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1974
1975
// Feature detection ----------------------------------------------------------------------------------------------
1976
1977
// Estimate the black point
1978
CMSAPI cmsBool CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1979
CMSAPI cmsBool CMSEXPORT cmsDetectDestinationBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1980
1981
// Estimate total area coverage
1982
CMSAPI cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile);
1983
1984
// Estimate gamma space, always positive. Returns -1 on error.
1985
CMSAPI cmsFloat64Number CMSEXPORT cmsDetectRGBProfileGamma(cmsHPROFILE hProfile, cmsFloat64Number threshold);
1986
1987
// Poor man's gamut mapping
1988
CMSAPI cmsBool CMSEXPORT cmsDesaturateLab(cmsCIELab* Lab,
1989
double amax, double amin,
1990
double bmax, double bmin);
1991
1992
#ifndef CMS_USE_CPP_API
1993
# ifdef __cplusplus
1994
}
1995
# endif
1996
#endif
1997
1998
#define _lcms2_H
1999
#endif
2000
2001