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