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