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