1 //---------------------------------------------------------------------------------
3 // Little Color Management System
4 // Copyright (c) 1998-2011 Marti Maria Saguer
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:
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
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.
24 //---------------------------------------------------------------------------------
31 // ********** Configuration toggles ****************************************
33 // Uncomment this one if you are using big endian machines
34 // #define CMS_USE_BIG_ENDIAN 1
36 // Uncomment this one if your compiler/machine does NOT support the
38 // #define CMS_DONT_USE_INT64 1
40 // Uncomment this if your compiler doesn't work with fast floor function
41 // #define CMS_DONT_USE_FAST_FLOOR 1
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
48 // Uncomment this line if you are compiling as C++ and want a C++ API
49 // #define CMS_USE_CPP_API
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
55 // Uncomment to get rid of the tables for "half" float support
56 // #define CMS_NO_HALF_SUPPORT 1
58 // ********** End of configuration toggles ******************************
63 // Needed for portability (C99 per 7.1.2)
68 #ifndef CMS_USE_CPP_API
75 #define LCMS_VERSION 2040
77 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
78 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
81 typedef unsigned char cmsUInt8Number; // That is guaranteed by the C99 spec
82 typedef signed char cmsInt8Number; // That is guaranteed by the C99 spec
85 # error "Unable to find 8 bit type, unsupported compiler"
88 // IEEE float storage numbers
89 typedef float cmsFloat32Number;
90 typedef double cmsFloat64Number;
93 #if (USHRT_MAX == 65535U)
94 typedef unsigned short cmsUInt16Number;
95 #elif (UINT_MAX == 65535U)
96 typedef unsigned int cmsUInt16Number;
98 # error "Unable to find 16 bits unsigned type, unsupported compiler"
101 #if (SHRT_MAX == 32767)
102 typedef short cmsInt16Number;
103 #elif (INT_MAX == 32767)
104 typedef int cmsInt16Number;
106 # error "Unable to find 16 bits signed type, unsupported compiler"
110 #if (UINT_MAX == 4294967295U)
111 typedef unsigned int cmsUInt32Number;
112 #elif (ULONG_MAX == 4294967295U)
113 typedef unsigned long cmsUInt32Number;
115 # error "Unable to find 32 bit unsigned type, unsupported compiler"
118 #if (INT_MAX == +2147483647)
119 typedef int cmsInt32Number;
120 #elif (LONG_MAX == +2147483647)
121 typedef long cmsInt32Number;
123 # error "Unable to find 32 bit signed type, unsupported compiler"
127 #ifndef CMS_DONT_USE_INT64
128 # if (ULONG_MAX == 18446744073709551615U)
129 typedef unsigned long cmsUInt64Number;
130 # elif (ULLONG_MAX == 18446744073709551615U)
131 typedef unsigned long long cmsUInt64Number;
133 # define CMS_DONT_USE_INT64 1
135 # if (LONG_MAX == +9223372036854775807)
136 typedef long cmsInt64Number;
137 # elif (LLONG_MAX == +9223372036854775807)
138 typedef long long cmsInt64Number;
140 # define CMS_DONT_USE_INT64 1
145 // In the case 64 bit numbers are not supported by the compiler
146 #ifdef CMS_DONT_USE_INT64
147 typedef cmsUInt32Number cmsUInt64Number[2];
148 typedef cmsInt32Number cmsInt64Number[2];
152 typedef cmsUInt32Number cmsSignature;
153 typedef cmsUInt16Number cmsU8Fixed8Number;
154 typedef cmsInt32Number cmsS15Fixed16Number;
155 typedef cmsUInt32Number cmsU16Fixed16Number;
157 // Boolean type, which will be using the native integer
160 // Try to detect windows
161 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
162 # define CMS_IS_WINDOWS_ 1
166 # define CMS_IS_WINDOWS_ 1
170 # define CMS_IS_WINDOWS_ 1
173 // Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
174 // you can pass this toggle to the compiler by using -DCMS_USE_BIG_ENDIAN or something similar
176 #if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
177 # define CMS_USE_BIG_ENDIAN 1
180 #if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc)
181 # define CMS_USE_BIG_ENDIAN 1
184 #if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
185 # define CMS_USE_BIG_ENDIAN 1
188 #ifdef TARGET_CPU_PPC
190 # define CMS_USE_BIG_ENDIAN 1
195 # ifdef __BIG_ENDIAN__
196 # define CMS_USE_BIG_ENDIAN 1
200 // Calling convention -- this is hardly platform and compiler dependent
201 #ifdef CMS_IS_WINDOWS_
202 # if defined(CMS_DLL) || defined(CMS_DLL_BUILD)
204 # define CMSEXPORT __stdcall _export
207 # define CMSEXPORT _stdcall
208 # ifdef CMS_DLL_BUILD
209 # define CMSAPI __declspec(dllexport)
211 # define CMSAPI __declspec(dllimport)
223 // Some common definitions
224 #define cmsMAX_PATH 256
233 // D50 XYZ normalized to Y=1.0
234 #define cmsD50X 0.9642
236 #define cmsD50Z 0.8249
238 // V4 perceptual black
239 #define cmsPERCEPTUAL_BLACK_X 0.00336
240 #define cmsPERCEPTUAL_BLACK_Y 0.0034731
241 #define cmsPERCEPTUAL_BLACK_Z 0.00287
243 // Definitions in ICC spec
244 #define cmsMagicNumber 0x61637370 // 'acsp'
245 #define lcmsSignature 0x6c636d73 // 'lcms'
248 // Base ICC type definitions
250 cmsSigChromaticityType = 0x6368726D, // 'chrm'
251 cmsSigColorantOrderType = 0x636C726F, // 'clro'
252 cmsSigColorantTableType = 0x636C7274, // 'clrt'
253 cmsSigCrdInfoType = 0x63726469, // 'crdi'
254 cmsSigCurveType = 0x63757276, // 'curv'
255 cmsSigDataType = 0x64617461, // 'data'
256 cmsSigDictType = 0x64696374, // 'dict'
257 cmsSigDateTimeType = 0x6474696D, // 'dtim'
258 cmsSigDeviceSettingsType = 0x64657673, // 'devs'
259 cmsSigLut16Type = 0x6d667432, // 'mft2'
260 cmsSigLut8Type = 0x6d667431, // 'mft1'
261 cmsSigLutAtoBType = 0x6d414220, // 'mAB '
262 cmsSigLutBtoAType = 0x6d424120, // 'mBA '
263 cmsSigMeasurementType = 0x6D656173, // 'meas'
264 cmsSigMultiLocalizedUnicodeType = 0x6D6C7563, // 'mluc'
265 cmsSigMultiProcessElementType = 0x6D706574, // 'mpet'
266 cmsSigNamedColorType = 0x6E636f6C, // 'ncol' -- DEPRECATED!
267 cmsSigNamedColor2Type = 0x6E636C32, // 'ncl2'
268 cmsSigParametricCurveType = 0x70617261, // 'para'
269 cmsSigProfileSequenceDescType = 0x70736571, // 'pseq'
270 cmsSigProfileSequenceIdType = 0x70736964, // 'psid'
271 cmsSigResponseCurveSet16Type = 0x72637332, // 'rcs2'
272 cmsSigS15Fixed16ArrayType = 0x73663332, // 'sf32'
273 cmsSigScreeningType = 0x7363726E, // 'scrn'
274 cmsSigSignatureType = 0x73696720, // 'sig '
275 cmsSigTextType = 0x74657874, // 'text'
276 cmsSigTextDescriptionType = 0x64657363, // 'desc'
277 cmsSigU16Fixed16ArrayType = 0x75663332, // 'uf32'
278 cmsSigUcrBgType = 0x62666420, // 'bfd '
279 cmsSigUInt16ArrayType = 0x75693136, // 'ui16'
280 cmsSigUInt32ArrayType = 0x75693332, // 'ui32'
281 cmsSigUInt64ArrayType = 0x75693634, // 'ui64'
282 cmsSigUInt8ArrayType = 0x75693038, // 'ui08'
283 cmsSigVcgtType = 0x76636774, // 'vcgt'
284 cmsSigViewingConditionsType = 0x76696577, // 'view'
285 cmsSigXYZType = 0x58595A20 // 'XYZ '
288 } cmsTagTypeSignature;
290 // Base ICC tag definitions
292 cmsSigAToB0Tag = 0x41324230, // 'A2B0'
293 cmsSigAToB1Tag = 0x41324231, // 'A2B1'
294 cmsSigAToB2Tag = 0x41324232, // 'A2B2'
295 cmsSigBlueColorantTag = 0x6258595A, // 'bXYZ'
296 cmsSigBlueMatrixColumnTag = 0x6258595A, // 'bXYZ'
297 cmsSigBlueTRCTag = 0x62545243, // 'bTRC'
298 cmsSigBToA0Tag = 0x42324130, // 'B2A0'
299 cmsSigBToA1Tag = 0x42324131, // 'B2A1'
300 cmsSigBToA2Tag = 0x42324132, // 'B2A2'
301 cmsSigCalibrationDateTimeTag = 0x63616C74, // 'calt'
302 cmsSigCharTargetTag = 0x74617267, // 'targ'
303 cmsSigChromaticAdaptationTag = 0x63686164, // 'chad'
304 cmsSigChromaticityTag = 0x6368726D, // 'chrm'
305 cmsSigColorantOrderTag = 0x636C726F, // 'clro'
306 cmsSigColorantTableTag = 0x636C7274, // 'clrt'
307 cmsSigColorantTableOutTag = 0x636C6F74, // 'clot'
308 cmsSigColorimetricIntentImageStateTag = 0x63696973, // 'ciis'
309 cmsSigCopyrightTag = 0x63707274, // 'cprt'
310 cmsSigCrdInfoTag = 0x63726469, // 'crdi'
311 cmsSigDataTag = 0x64617461, // 'data'
312 cmsSigDateTimeTag = 0x6474696D, // 'dtim'
313 cmsSigDeviceMfgDescTag = 0x646D6E64, // 'dmnd'
314 cmsSigDeviceModelDescTag = 0x646D6464, // 'dmdd'
315 cmsSigDeviceSettingsTag = 0x64657673, // 'devs'
316 cmsSigDToB0Tag = 0x44324230, // 'D2B0'
317 cmsSigDToB1Tag = 0x44324231, // 'D2B1'
318 cmsSigDToB2Tag = 0x44324232, // 'D2B2'
319 cmsSigDToB3Tag = 0x44324233, // 'D2B3'
320 cmsSigBToD0Tag = 0x42324430, // 'B2D0'
321 cmsSigBToD1Tag = 0x42324431, // 'B2D1'
322 cmsSigBToD2Tag = 0x42324432, // 'B2D2'
323 cmsSigBToD3Tag = 0x42324433, // 'B2D3'
324 cmsSigGamutTag = 0x67616D74, // 'gamt'
325 cmsSigGrayTRCTag = 0x6b545243, // 'kTRC'
326 cmsSigGreenColorantTag = 0x6758595A, // 'gXYZ'
327 cmsSigGreenMatrixColumnTag = 0x6758595A, // 'gXYZ'
328 cmsSigGreenTRCTag = 0x67545243, // 'gTRC'
329 cmsSigLuminanceTag = 0x6C756d69, // 'lumi'
330 cmsSigMeasurementTag = 0x6D656173, // 'meas'
331 cmsSigMediaBlackPointTag = 0x626B7074, // 'bkpt'
332 cmsSigMediaWhitePointTag = 0x77747074, // 'wtpt'
333 cmsSigNamedColorTag = 0x6E636f6C, // 'ncol' // Deprecated by the ICC
334 cmsSigNamedColor2Tag = 0x6E636C32, // 'ncl2'
335 cmsSigOutputResponseTag = 0x72657370, // 'resp'
336 cmsSigPerceptualRenderingIntentGamutTag = 0x72696730, // 'rig0'
337 cmsSigPreview0Tag = 0x70726530, // 'pre0'
338 cmsSigPreview1Tag = 0x70726531, // 'pre1'
339 cmsSigPreview2Tag = 0x70726532, // 'pre2'
340 cmsSigProfileDescriptionTag = 0x64657363, // 'desc'
341 cmsSigProfileSequenceDescTag = 0x70736571, // 'pseq'
342 cmsSigProfileSequenceIdTag = 0x70736964, // 'psid'
343 cmsSigPs2CRD0Tag = 0x70736430, // 'psd0'
344 cmsSigPs2CRD1Tag = 0x70736431, // 'psd1'
345 cmsSigPs2CRD2Tag = 0x70736432, // 'psd2'
346 cmsSigPs2CRD3Tag = 0x70736433, // 'psd3'
347 cmsSigPs2CSATag = 0x70733273, // 'ps2s'
348 cmsSigPs2RenderingIntentTag = 0x70733269, // 'ps2i'
349 cmsSigRedColorantTag = 0x7258595A, // 'rXYZ'
350 cmsSigRedMatrixColumnTag = 0x7258595A, // 'rXYZ'
351 cmsSigRedTRCTag = 0x72545243, // 'rTRC'
352 cmsSigSaturationRenderingIntentGamutTag = 0x72696732, // 'rig2'
353 cmsSigScreeningDescTag = 0x73637264, // 'scrd'
354 cmsSigScreeningTag = 0x7363726E, // 'scrn'
355 cmsSigTechnologyTag = 0x74656368, // 'tech'
356 cmsSigUcrBgTag = 0x62666420, // 'bfd '
357 cmsSigViewingCondDescTag = 0x76756564, // 'vued'
358 cmsSigViewingConditionsTag = 0x76696577, // 'view'
359 cmsSigVcgtTag = 0x76636774, // 'vcgt'
360 cmsSigMetaTag = 0x6D657461 // 'meta'
365 // ICC Technology tag
367 cmsSigDigitalCamera = 0x6463616D, // 'dcam'
368 cmsSigFilmScanner = 0x6673636E, // 'fscn'
369 cmsSigReflectiveScanner = 0x7273636E, // 'rscn'
370 cmsSigInkJetPrinter = 0x696A6574, // 'ijet'
371 cmsSigThermalWaxPrinter = 0x74776178, // 'twax'
372 cmsSigElectrophotographicPrinter = 0x6570686F, // 'epho'
373 cmsSigElectrostaticPrinter = 0x65737461, // 'esta'
374 cmsSigDyeSublimationPrinter = 0x64737562, // 'dsub'
375 cmsSigPhotographicPaperPrinter = 0x7270686F, // 'rpho'
376 cmsSigFilmWriter = 0x6670726E, // 'fprn'
377 cmsSigVideoMonitor = 0x7669646D, // 'vidm'
378 cmsSigVideoCamera = 0x76696463, // 'vidc'
379 cmsSigProjectionTelevision = 0x706A7476, // 'pjtv'
380 cmsSigCRTDisplay = 0x43525420, // 'CRT '
381 cmsSigPMDisplay = 0x504D4420, // 'PMD '
382 cmsSigAMDisplay = 0x414D4420, // 'AMD '
383 cmsSigPhotoCD = 0x4B504344, // 'KPCD'
384 cmsSigPhotoImageSetter = 0x696D6773, // 'imgs'
385 cmsSigGravure = 0x67726176, // 'grav'
386 cmsSigOffsetLithography = 0x6F666673, // 'offs'
387 cmsSigSilkscreen = 0x73696C6B, // 'silk'
388 cmsSigFlexography = 0x666C6578, // 'flex'
389 cmsSigMotionPictureFilmScanner = 0x6D706673, // 'mpfs'
390 cmsSigMotionPictureFilmRecorder = 0x6D706672, // 'mpfr'
391 cmsSigDigitalMotionPictureCamera = 0x646D7063, // 'dmpc'
392 cmsSigDigitalCinemaProjector = 0x64636A70 // 'dcpj'
394 } cmsTechnologySignature;
399 cmsSigXYZData = 0x58595A20, // 'XYZ '
400 cmsSigLabData = 0x4C616220, // 'Lab '
401 cmsSigLuvData = 0x4C757620, // 'Luv '
402 cmsSigYCbCrData = 0x59436272, // 'YCbr'
403 cmsSigYxyData = 0x59787920, // 'Yxy '
404 cmsSigRgbData = 0x52474220, // 'RGB '
405 cmsSigGrayData = 0x47524159, // 'GRAY'
406 cmsSigHsvData = 0x48535620, // 'HSV '
407 cmsSigHlsData = 0x484C5320, // 'HLS '
408 cmsSigCmykData = 0x434D594B, // 'CMYK'
409 cmsSigCmyData = 0x434D5920, // 'CMY '
410 cmsSigMCH1Data = 0x4D434831, // 'MCH1'
411 cmsSigMCH2Data = 0x4D434832, // 'MCH2'
412 cmsSigMCH3Data = 0x4D434833, // 'MCH3'
413 cmsSigMCH4Data = 0x4D434834, // 'MCH4'
414 cmsSigMCH5Data = 0x4D434835, // 'MCH5'
415 cmsSigMCH6Data = 0x4D434836, // 'MCH6'
416 cmsSigMCH7Data = 0x4D434837, // 'MCH7'
417 cmsSigMCH8Data = 0x4D434838, // 'MCH8'
418 cmsSigMCH9Data = 0x4D434839, // 'MCH9'
419 cmsSigMCHAData = 0x4D434841, // 'MCHA'
420 cmsSigMCHBData = 0x4D434842, // 'MCHB'
421 cmsSigMCHCData = 0x4D434843, // 'MCHC'
422 cmsSigMCHDData = 0x4D434844, // 'MCHD'
423 cmsSigMCHEData = 0x4D434845, // 'MCHE'
424 cmsSigMCHFData = 0x4D434846, // 'MCHF'
425 cmsSigNamedData = 0x6e6d636c, // 'nmcl'
426 cmsSig1colorData = 0x31434C52, // '1CLR'
427 cmsSig2colorData = 0x32434C52, // '2CLR'
428 cmsSig3colorData = 0x33434C52, // '3CLR'
429 cmsSig4colorData = 0x34434C52, // '4CLR'
430 cmsSig5colorData = 0x35434C52, // '5CLR'
431 cmsSig6colorData = 0x36434C52, // '6CLR'
432 cmsSig7colorData = 0x37434C52, // '7CLR'
433 cmsSig8colorData = 0x38434C52, // '8CLR'
434 cmsSig9colorData = 0x39434C52, // '9CLR'
435 cmsSig10colorData = 0x41434C52, // 'ACLR'
436 cmsSig11colorData = 0x42434C52, // 'BCLR'
437 cmsSig12colorData = 0x43434C52, // 'CCLR'
438 cmsSig13colorData = 0x44434C52, // 'DCLR'
439 cmsSig14colorData = 0x45434C52, // 'ECLR'
440 cmsSig15colorData = 0x46434C52, // 'FCLR'
441 cmsSigLuvKData = 0x4C75764B // 'LuvK'
443 } cmsColorSpaceSignature;
447 cmsSigInputClass = 0x73636E72, // 'scnr'
448 cmsSigDisplayClass = 0x6D6E7472, // 'mntr'
449 cmsSigOutputClass = 0x70727472, // 'prtr'
450 cmsSigLinkClass = 0x6C696E6B, // 'link'
451 cmsSigAbstractClass = 0x61627374, // 'abst'
452 cmsSigColorSpaceClass = 0x73706163, // 'spac'
453 cmsSigNamedColorClass = 0x6e6d636c // 'nmcl'
455 } cmsProfileClassSignature;
459 cmsSigMacintosh = 0x4150504C, // 'APPL'
460 cmsSigMicrosoft = 0x4D534654, // 'MSFT'
461 cmsSigSolaris = 0x53554E57, // 'SUNW'
462 cmsSigSGI = 0x53474920, // 'SGI '
463 cmsSigTaligent = 0x54474E54, // 'TGNT'
464 cmsSigUnices = 0x2A6E6978 // '*nix' // From argyll -- Not official
466 } cmsPlatformSignature;
469 #define cmsSigPerceptualReferenceMediumGamut 0x70726d67 //'prmg'
471 // For cmsSigColorimetricIntentImageStateTag
472 #define cmsSigSceneColorimetryEstimates 0x73636F65 //'scoe'
473 #define cmsSigSceneAppearanceEstimates 0x73617065 //'sape'
474 #define cmsSigFocalPlaneColorimetryEstimates 0x66706365 //'fpce'
475 #define cmsSigReflectionHardcopyOriginalColorimetry 0x72686F63 //'rhoc'
476 #define cmsSigReflectionPrintOutputColorimetry 0x72706F63 //'rpoc'
478 // Multi process elements types
480 cmsSigCurveSetElemType = 0x63767374, //'cvst'
481 cmsSigMatrixElemType = 0x6D617466, //'matf'
482 cmsSigCLutElemType = 0x636C7574, //'clut'
484 cmsSigBAcsElemType = 0x62414353, // 'bACS'
485 cmsSigEAcsElemType = 0x65414353, // 'eACS'
487 // Custom from here, not in the ICC Spec
488 cmsSigXYZ2LabElemType = 0x6C327820, // 'l2x '
489 cmsSigLab2XYZElemType = 0x78326C20, // 'x2l '
490 cmsSigNamedColorElemType = 0x6E636C20, // 'ncl '
491 cmsSigLabV2toV4 = 0x32203420, // '2 4 '
492 cmsSigLabV4toV2 = 0x34203220, // '4 2 '
495 cmsSigIdentityElemType = 0x69646E20, // 'idn '
498 cmsSigLab2FloatPCS = 0x64326C20, // 'd2l '
499 cmsSigFloatPCS2Lab = 0x6C326420, // 'l2d '
500 cmsSigXYZ2FloatPCS = 0x64327820, // 'd2x '
501 cmsSigFloatPCS2XYZ = 0x78326420 // 'x2d '
505 // Types of CurveElements
508 cmsSigFormulaCurveSeg = 0x70617266, // 'parf'
509 cmsSigSampledCurveSeg = 0x73616D66, // 'samf'
510 cmsSigSegmentedCurve = 0x63757266 // 'curf'
512 } cmsCurveSegSignature;
514 // Used in ResponseCurveType
515 #define cmsSigStatusA 0x53746141 //'StaA'
516 #define cmsSigStatusE 0x53746145 //'StaE'
517 #define cmsSigStatusI 0x53746149 //'StaI'
518 #define cmsSigStatusT 0x53746154 //'StaT'
519 #define cmsSigStatusM 0x5374614D //'StaM'
520 #define cmsSigDN 0x444E2020 //'DN '
521 #define cmsSigDNP 0x444E2050 //'DN P'
522 #define cmsSigDNN 0x444E4E20 //'DNN '
523 #define cmsSigDNNP 0x444E4E50 //'DNNP'
525 // Device attributes, currently defined values correspond to the low 4 bytes
526 // of the 8 byte attribute quantity
527 #define cmsReflective 0
528 #define cmsTransparency 1
532 // Common structures in ICC tags
535 cmsUInt32Number flag;
536 cmsUInt8Number data[1];
542 cmsUInt16Number year;
543 cmsUInt16Number month;
545 cmsUInt16Number hours;
546 cmsUInt16Number minutes;
547 cmsUInt16Number seconds;
553 cmsS15Fixed16Number X;
554 cmsS15Fixed16Number Y;
555 cmsS15Fixed16Number Z;
557 } cmsEncodedXYZNumber;
560 // Profile ID as computed by MD5 algorithm
562 cmsUInt8Number ID8[16];
563 cmsUInt16Number ID16[8];
564 cmsUInt32Number ID32[4];
569 // ----------------------------------------------------------------------------------------------
570 // ICC profile internal base types. Strictly, shouldn't be declared in this header, but maybe
571 // somebody want to use this info for accessing profile header directly, so here it is.
573 // Profile header -- it is 32-bit aligned, so no issues are expected on alignment
575 cmsUInt32Number size; // Profile size in bytes
576 cmsSignature cmmId; // CMM for this profile
577 cmsUInt32Number version; // Format version number
578 cmsProfileClassSignature deviceClass; // Type of profile
579 cmsColorSpaceSignature colorSpace; // Color space of data
580 cmsColorSpaceSignature pcs; // PCS, XYZ or Lab only
581 cmsDateTimeNumber date; // Date profile was created
582 cmsSignature magic; // Magic Number to identify an ICC profile
583 cmsPlatformSignature platform; // Primary Platform
584 cmsUInt32Number flags; // Various bit settings
585 cmsSignature manufacturer; // Device manufacturer
586 cmsUInt32Number model; // Device model number
587 cmsUInt64Number attributes; // Device attributes
588 cmsUInt32Number renderingIntent;// Rendering intent
589 cmsEncodedXYZNumber illuminant; // Profile illuminant
590 cmsSignature creator; // Profile creator
591 cmsProfileID profileID; // Profile ID using MD5
592 cmsInt8Number reserved[28]; // Reserved for future use
598 cmsTagTypeSignature sig;
599 cmsInt8Number reserved[4];
603 // A tag entry in directory
605 cmsTagSignature sig; // The tag signature
606 cmsUInt32Number offset; // Start of tag
607 cmsUInt32Number size; // Size in bytes
611 // ----------------------------------------------------------------------------------------------
613 // Little CMS specific typedefs
615 typedef void* cmsContext; // Context identifier for multithreaded environments
616 typedef void* cmsHANDLE ; // Generic handle
617 typedef void* cmsHPROFILE; // Opaque typedefs to hide internals
618 typedef void* cmsHTRANSFORM;
620 #define cmsMAXCHANNELS 16 // Maximum number of channels in ICC profiles
622 // Format of pixel is defined by one cmsUInt32Number, using bit fields as follows
625 // 3 2 10987 6 5 4 3 2 1 098 7654 321
626 // A O TTTTT U Y F P X S EEE CCCC BBB
628 // A: Floating point -- With this flag we can differentiate 16 bits as float and as int
629 // O: Optimized -- previous optimization already returns the final 8-bit value
631 // F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
632 // P: Planar? 0=Chunky, 1=Planar
633 // X: swap 16 bps endianess?
634 // S: Do swap? ie, BGR, KYMC
636 // C: Channels (Samples per pixel)
637 // B: bytes per sample
638 // Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
640 #define FLOAT_SH(a) ((a) << 22)
641 #define OPTIMIZED_SH(s) ((s) << 21)
642 #define COLORSPACE_SH(s) ((s) << 16)
643 #define SWAPFIRST_SH(s) ((s) << 14)
644 #define FLAVOR_SH(s) ((s) << 13)
645 #define PLANAR_SH(p) ((p) << 12)
646 #define ENDIAN16_SH(e) ((e) << 11)
647 #define DOSWAP_SH(e) ((e) << 10)
648 #define EXTRA_SH(e) ((e) << 7)
649 #define CHANNELS_SH(c) ((c) << 3)
650 #define BYTES_SH(b) (b)
652 // These macros unpack format specifiers into integers
653 #define T_FLOAT(a) (((a)>>22)&1)
654 #define T_OPTIMIZED(o) (((o)>>21)&1)
655 #define T_COLORSPACE(s) (((s)>>16)&31)
656 #define T_SWAPFIRST(s) (((s)>>14)&1)
657 #define T_FLAVOR(s) (((s)>>13)&1)
658 #define T_PLANAR(p) (((p)>>12)&1)
659 #define T_ENDIAN16(e) (((e)>>11)&1)
660 #define T_DOSWAP(e) (((e)>>10)&1)
661 #define T_EXTRA(e) (((e)>>7)&7)
662 #define T_CHANNELS(c) (((c)>>3)&15)
663 #define T_BYTES(b) ((b)&7)
667 #define PT_ANY 0 // Don't check colorspace
668 // 1 & 2 are reserved
674 #define PT_YUV 8 // Lu'v'
677 #define PT_YUVK 11 // Lu'v'K
698 #define PT_LabV2 30 // Identical to PT_Lab, but using the V2 old encoding
700 // Some (not all!) representations
702 #ifndef TYPE_RGB_8 // TYPE_RGB_8 is a very common identifier, so don't include ours
703 // if user has it already defined.
705 #define TYPE_GRAY_8 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1))
706 #define TYPE_GRAY_8_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1))
707 #define TYPE_GRAY_16 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
708 #define TYPE_GRAY_16_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1))
709 #define TYPE_GRAY_16_SE (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
710 #define TYPE_GRAYA_8 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1))
711 #define TYPE_GRAYA_16 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2))
712 #define TYPE_GRAYA_16_SE (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
713 #define TYPE_GRAYA_8_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PLANAR_SH(1))
714 #define TYPE_GRAYA_16_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1))
716 #define TYPE_RGB_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1))
717 #define TYPE_RGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
718 #define TYPE_BGR_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
719 #define TYPE_BGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
720 #define TYPE_RGB_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
721 #define TYPE_RGB_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
722 #define TYPE_RGB_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
723 #define TYPE_BGR_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
724 #define TYPE_BGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
725 #define TYPE_BGR_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
727 #define TYPE_RGBA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1))
728 #define TYPE_RGBA_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
729 #define TYPE_RGBA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
730 #define TYPE_RGBA_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
731 #define TYPE_RGBA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
733 #define TYPE_ARGB_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1))
734 #define TYPE_ARGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)|PLANAR_SH(1))
735 #define TYPE_ARGB_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
737 #define TYPE_ABGR_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
738 #define TYPE_ABGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
739 #define TYPE_ABGR_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
740 #define TYPE_ABGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
741 #define TYPE_ABGR_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
743 #define TYPE_BGRA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
744 #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))
745 #define TYPE_BGRA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
746 #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))
748 #define TYPE_CMY_8 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1))
749 #define TYPE_CMY_8_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
750 #define TYPE_CMY_16 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2))
751 #define TYPE_CMY_16_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
752 #define TYPE_CMY_16_SE (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
754 #define TYPE_CMYK_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1))
755 #define TYPE_CMYKA_8 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1))
756 #define TYPE_CMYK_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1))
757 #define TYPE_YUVK_8 TYPE_CMYK_8_REV
758 #define TYPE_CMYK_8_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|PLANAR_SH(1))
759 #define TYPE_CMYK_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
760 #define TYPE_CMYK_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1))
761 #define TYPE_YUVK_16 TYPE_CMYK_16_REV
762 #define TYPE_CMYK_16_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|PLANAR_SH(1))
763 #define TYPE_CMYK_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1))
765 #define TYPE_KYMC_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1))
766 #define TYPE_KYMC_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1))
767 #define TYPE_KYMC_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
769 #define TYPE_KCMY_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1))
770 #define TYPE_KCMY_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
771 #define TYPE_KCMY_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1))
772 #define TYPE_KCMY_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
773 #define TYPE_KCMY_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
775 #define TYPE_CMYK5_8 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1))
776 #define TYPE_CMYK5_16 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2))
777 #define TYPE_CMYK5_16_SE (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|ENDIAN16_SH(1))
778 #define TYPE_KYMC5_8 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1)|DOSWAP_SH(1))
779 #define TYPE_KYMC5_16 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1))
780 #define TYPE_KYMC5_16_SE (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
781 #define TYPE_CMYK6_8 (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1))
782 #define TYPE_CMYK6_8_PLANAR (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1)|PLANAR_SH(1))
783 #define TYPE_CMYK6_16 (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2))
784 #define TYPE_CMYK6_16_PLANAR (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|PLANAR_SH(1))
785 #define TYPE_CMYK6_16_SE (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|ENDIAN16_SH(1))
786 #define TYPE_CMYK7_8 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1))
787 #define TYPE_CMYK7_16 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2))
788 #define TYPE_CMYK7_16_SE (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|ENDIAN16_SH(1))
789 #define TYPE_KYMC7_8 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1)|DOSWAP_SH(1))
790 #define TYPE_KYMC7_16 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1))
791 #define TYPE_KYMC7_16_SE (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
792 #define TYPE_CMYK8_8 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1))
793 #define TYPE_CMYK8_16 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2))
794 #define TYPE_CMYK8_16_SE (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|ENDIAN16_SH(1))
795 #define TYPE_KYMC8_8 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1)|DOSWAP_SH(1))
796 #define TYPE_KYMC8_16 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1))
797 #define TYPE_KYMC8_16_SE (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
798 #define TYPE_CMYK9_8 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1))
799 #define TYPE_CMYK9_16 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2))
800 #define TYPE_CMYK9_16_SE (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|ENDIAN16_SH(1))
801 #define TYPE_KYMC9_8 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1)|DOSWAP_SH(1))
802 #define TYPE_KYMC9_16 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1))
803 #define TYPE_KYMC9_16_SE (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
804 #define TYPE_CMYK10_8 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1))
805 #define TYPE_CMYK10_16 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2))
806 #define TYPE_CMYK10_16_SE (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|ENDIAN16_SH(1))
807 #define TYPE_KYMC10_8 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1)|DOSWAP_SH(1))
808 #define TYPE_KYMC10_16 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1))
809 #define TYPE_KYMC10_16_SE (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
810 #define TYPE_CMYK11_8 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1))
811 #define TYPE_CMYK11_16 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2))
812 #define TYPE_CMYK11_16_SE (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|ENDIAN16_SH(1))
813 #define TYPE_KYMC11_8 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1)|DOSWAP_SH(1))
814 #define TYPE_KYMC11_16 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1))
815 #define TYPE_KYMC11_16_SE (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
816 #define TYPE_CMYK12_8 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1))
817 #define TYPE_CMYK12_16 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2))
818 #define TYPE_CMYK12_16_SE (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|ENDIAN16_SH(1))
819 #define TYPE_KYMC12_8 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1)|DOSWAP_SH(1))
820 #define TYPE_KYMC12_16 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1))
821 #define TYPE_KYMC12_16_SE (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
824 #define TYPE_XYZ_16 (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2))
825 #define TYPE_Lab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1))
826 #define TYPE_LabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1))
828 #define TYPE_ALab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1))
829 #define TYPE_ALabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1))
830 #define TYPE_Lab_16 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2))
831 #define TYPE_LabV2_16 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(2))
832 #define TYPE_Yxy_16 (COLORSPACE_SH(PT_Yxy)|CHANNELS_SH(3)|BYTES_SH(2))
835 #define TYPE_YCbCr_8 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1))
836 #define TYPE_YCbCr_8_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
837 #define TYPE_YCbCr_16 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2))
838 #define TYPE_YCbCr_16_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
839 #define TYPE_YCbCr_16_SE (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
842 #define TYPE_YUV_8 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1))
843 #define TYPE_YUV_8_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
844 #define TYPE_YUV_16 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2))
845 #define TYPE_YUV_16_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
846 #define TYPE_YUV_16_SE (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
849 #define TYPE_HLS_8 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1))
850 #define TYPE_HLS_8_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
851 #define TYPE_HLS_16 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2))
852 #define TYPE_HLS_16_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
853 #define TYPE_HLS_16_SE (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
856 #define TYPE_HSV_8 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1))
857 #define TYPE_HSV_8_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
858 #define TYPE_HSV_16 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2))
859 #define TYPE_HSV_16_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
860 #define TYPE_HSV_16_SE (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
862 // Named color index. Only 16 bits allowed (don't check colorspace)
863 #define TYPE_NAMED_COLOR_INDEX (CHANNELS_SH(1)|BYTES_SH(2))
866 #define TYPE_XYZ_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(4))
867 #define TYPE_Lab_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(4))
868 #define TYPE_LabA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
869 #define TYPE_GRAY_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4))
870 #define TYPE_RGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4))
872 #define TYPE_RGBA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
873 #define TYPE_ARGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
874 #define TYPE_BGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
875 #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))
876 #define TYPE_ABGR_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
878 #define TYPE_CMYK_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
880 // Floating point formatters.
881 // NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
882 #define TYPE_XYZ_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
883 #define TYPE_Lab_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
884 #define TYPE_GRAY_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
885 #define TYPE_RGB_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
886 #define TYPE_BGR_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)|DOSWAP_SH(1))
887 #define TYPE_CMYK_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))
889 // IEEE 754-2008 "half"
890 #define TYPE_GRAY_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
891 #define TYPE_RGB_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
892 #define TYPE_RGBA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
893 #define TYPE_CMYK_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
895 #define TYPE_RGBA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
896 #define TYPE_ARGB_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
897 #define TYPE_BGR_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
898 #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))
899 #define TYPE_ABGR_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
953 // Illuminant types for structs below
954 #define cmsILLUMINANT_TYPE_UNKNOWN 0x0000000
955 #define cmsILLUMINANT_TYPE_D50 0x0000001
956 #define cmsILLUMINANT_TYPE_D65 0x0000002
957 #define cmsILLUMINANT_TYPE_D93 0x0000003
958 #define cmsILLUMINANT_TYPE_F2 0x0000004
959 #define cmsILLUMINANT_TYPE_D55 0x0000005
960 #define cmsILLUMINANT_TYPE_A 0x0000006
961 #define cmsILLUMINANT_TYPE_E 0x0000007
962 #define cmsILLUMINANT_TYPE_F8 0x0000008
965 cmsUInt32Number Observer; // 0 = unknown, 1=CIE 1931, 2=CIE 1964
966 cmsCIEXYZ Backing; // Value of backing
967 cmsUInt32Number Geometry; // 0=unknown, 1=45/0, 0/45 2=0d, d/0
968 cmsFloat64Number Flare; // 0..1.0
969 cmsUInt32Number IlluminantType;
971 } cmsICCMeasurementConditions;
974 cmsCIEXYZ IlluminantXYZ; // Not the same struct as CAM02,
975 cmsCIEXYZ SurroundXYZ; // This is for storing the tag
976 cmsUInt32Number IlluminantType; // viewing condition
978 } cmsICCViewingConditions;
980 // Support of non-standard functions --------------------------------------------------------------------------------------
982 CMSAPI int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
983 CMSAPI long int CMSEXPORT cmsfilelength(FILE* f);
985 // Plug-In registering ---------------------------------------------------------------------------------------------------
987 CMSAPI cmsBool CMSEXPORT cmsPlugin(void* Plugin);
988 CMSAPI void CMSEXPORT cmsUnregisterPlugins(void);
990 // Error logging ----------------------------------------------------------------------------------------------------------
992 // There is no error handling at all. When a function fails, it returns proper value.
993 // For example, all create functions does return NULL on failure. Other may return FALSE.
994 // It may be interesting, for the developer, to know why the function is failing.
995 // for that reason, lcms2 does offer a logging function. This function will get
996 // an ENGLISH string with some clues on what is going wrong. You can show this
997 // info to the end user if you wish, or just create some sort of log on disk.
998 // The logging function should NOT terminate the program, as this obviously can leave
999 // unfreed resources. It is the programmer's responsibility to check each function
1000 // return code to make sure it didn't fail.
1002 #define cmsERROR_UNDEFINED 0
1003 #define cmsERROR_FILE 1
1004 #define cmsERROR_RANGE 2
1005 #define cmsERROR_INTERNAL 3
1006 #define cmsERROR_NULL 4
1007 #define cmsERROR_READ 5
1008 #define cmsERROR_SEEK 6
1009 #define cmsERROR_WRITE 7
1010 #define cmsERROR_UNKNOWN_EXTENSION 8
1011 #define cmsERROR_COLORSPACE_CHECK 9
1012 #define cmsERROR_ALREADY_DEFINED 10
1013 #define cmsERROR_BAD_SIGNATURE 11
1014 #define cmsERROR_CORRUPTION_DETECTED 12
1015 #define cmsERROR_NOT_SUITABLE 13
1017 // Error logger is called with the ContextID when a message is raised. This gives the
1018 // chance to know which thread is responsible of the warning and any environment associated
1019 // with it. Non-multithreading applications may safely ignore this parameter.
1020 // Note that under certain special circumstances, ContextID may be NULL.
1021 typedef void (* cmsLogErrorHandlerFunction)(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text);
1023 // Allows user to set any specific logger
1024 CMSAPI void CMSEXPORT cmsSetLogErrorHandler(cmsLogErrorHandlerFunction Fn);
1026 // Conversions --------------------------------------------------------------------------------------------------------------
1028 // Returns pointers to constant structs
1029 CMSAPI const cmsCIEXYZ* CMSEXPORT cmsD50_XYZ(void);
1030 CMSAPI const cmsCIExyY* CMSEXPORT cmsD50_xyY(void);
1032 // Colorimetric space conversions
1033 CMSAPI void CMSEXPORT cmsXYZ2xyY(cmsCIExyY* Dest, const cmsCIEXYZ* Source);
1034 CMSAPI void CMSEXPORT cmsxyY2XYZ(cmsCIEXYZ* Dest, const cmsCIExyY* Source);
1035 CMSAPI void CMSEXPORT cmsXYZ2Lab(const cmsCIEXYZ* WhitePoint, cmsCIELab* Lab, const cmsCIEXYZ* xyz);
1036 CMSAPI void CMSEXPORT cmsLab2XYZ(const cmsCIEXYZ* WhitePoint, cmsCIEXYZ* xyz, const cmsCIELab* Lab);
1037 CMSAPI void CMSEXPORT cmsLab2LCh(cmsCIELCh*LCh, const cmsCIELab* Lab);
1038 CMSAPI void CMSEXPORT cmsLCh2Lab(cmsCIELab* Lab, const cmsCIELCh* LCh);
1040 // Encoding /Decoding on PCS
1041 CMSAPI void CMSEXPORT cmsLabEncoded2Float(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1042 CMSAPI void CMSEXPORT cmsLabEncoded2FloatV2(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1043 CMSAPI void CMSEXPORT cmsFloat2LabEncoded(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1044 CMSAPI void CMSEXPORT cmsFloat2LabEncodedV2(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1045 CMSAPI void CMSEXPORT cmsXYZEncoded2Float(cmsCIEXYZ* fxyz, const cmsUInt16Number XYZ[3]);
1046 CMSAPI void CMSEXPORT cmsFloat2XYZEncoded(cmsUInt16Number XYZ[3], const cmsCIEXYZ* fXYZ);
1049 CMSAPI cmsFloat64Number CMSEXPORT cmsDeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1050 CMSAPI cmsFloat64Number CMSEXPORT cmsCIE94DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1051 CMSAPI cmsFloat64Number CMSEXPORT cmsBFDdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1052 CMSAPI cmsFloat64Number CMSEXPORT cmsCMCdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number l, cmsFloat64Number c);
1053 CMSAPI cmsFloat64Number CMSEXPORT cmsCIE2000DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number Kl, cmsFloat64Number Kc, cmsFloat64Number Kh);
1055 // Temperature <-> Chromaticity (Black body)
1056 CMSAPI cmsBool CMSEXPORT cmsWhitePointFromTemp(cmsCIExyY* WhitePoint, cmsFloat64Number TempK);
1057 CMSAPI cmsBool CMSEXPORT cmsTempFromWhitePoint(cmsFloat64Number* TempK, const cmsCIExyY* WhitePoint);
1059 // Chromatic adaptation
1060 CMSAPI cmsBool CMSEXPORT cmsAdaptToIlluminant(cmsCIEXYZ* Result, const cmsCIEXYZ* SourceWhitePt,
1061 const cmsCIEXYZ* Illuminant,
1062 const cmsCIEXYZ* Value);
1064 // CIECAM02 ---------------------------------------------------------------------------------------------------
1066 // Viewing conditions. Please note those are CAM model viewing conditions, and not the ICC tag viewing
1067 // conditions, which I'm naming cmsICCViewingConditions to make differences evident. Unfortunately, the tag
1068 // cannot deal with surround La, Yb and D value so is basically useless to store CAM02 viewing conditions.
1071 #define AVG_SURROUND 1
1072 #define DIM_SURROUND 2
1073 #define DARK_SURROUND 3
1074 #define CUTSHEET_SURROUND 4
1076 #define D_CALCULATE (-1)
1079 cmsCIEXYZ whitePoint;
1080 cmsFloat64Number Yb;
1081 cmsFloat64Number La;
1083 cmsFloat64Number D_value;
1085 } cmsViewingConditions;
1087 CMSAPI cmsHANDLE CMSEXPORT cmsCIECAM02Init(cmsContext ContextID, const cmsViewingConditions* pVC);
1088 CMSAPI void CMSEXPORT cmsCIECAM02Done(cmsHANDLE hModel);
1089 CMSAPI void CMSEXPORT cmsCIECAM02Forward(cmsHANDLE hModel, const cmsCIEXYZ* pIn, cmsJCh* pOut);
1090 CMSAPI void CMSEXPORT cmsCIECAM02Reverse(cmsHANDLE hModel, const cmsJCh* pIn, cmsCIEXYZ* pOut);
1093 // Tone curves -----------------------------------------------------------------------------------------
1095 // This describes a curve segment. For a table of supported types, see the manual. User can increase the number of
1096 // available types by using a proper plug-in. Parametric segments allow 10 parameters at most
1099 cmsFloat32Number x0, x1; // Domain; for x0 < x <= x1
1100 cmsInt32Number Type; // Parametric type, Type == 0 means sampled segment. Negative values are reserved
1101 cmsFloat64Number Params[10]; // Parameters if Type != 0
1102 cmsUInt32Number nGridPoints; // Number of grid points if Type == 0
1103 cmsFloat32Number* SampledPoints; // Points to an array of floats if Type == 0
1107 // The internal representation is none of your business.
1108 typedef struct _cms_curve_struct cmsToneCurve;
1110 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsInt32Number nSegments, const cmsCurveSegment Segments[]);
1111 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1112 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1113 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsInt32Number nEntries, const cmsUInt16Number values[]);
1114 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1115 CMSAPI void CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1116 CMSAPI void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1117 CMSAPI cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1118 CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1119 CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsInt32Number nResultSamples, const cmsToneCurve* InGamma);
1120 CMSAPI cmsToneCurve* CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X, const cmsToneCurve* Y, cmsUInt32Number nPoints);
1121 CMSAPI cmsBool CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1122 CMSAPI cmsFloat32Number CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1123 CMSAPI cmsUInt16Number CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1124 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1125 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1126 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1127 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1128 CMSAPI cmsInt32Number CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1129 CMSAPI cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1131 // Tone curve tabular estimation
1132 CMSAPI cmsUInt32Number CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1133 CMSAPI const cmsUInt16Number* CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1136 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1138 // Nothing to see here, move along
1139 typedef struct _cmsPipeline_struct cmsPipeline;
1140 typedef struct _cmsStage_struct cmsStage;
1142 // Those are hi-level pipelines
1143 CMSAPI cmsPipeline* CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1144 CMSAPI void CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1145 CMSAPI cmsPipeline* CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1147 CMSAPI cmsContext CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1148 CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1149 CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);
1151 CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineStageCount(const cmsPipeline* lut);
1152 CMSAPI cmsStage* CMSEXPORT cmsPipelineGetPtrToFirstStage(const cmsPipeline* lut);
1153 CMSAPI cmsStage* CMSEXPORT cmsPipelineGetPtrToLastStage(const cmsPipeline* lut);
1155 CMSAPI void CMSEXPORT cmsPipelineEval16(const cmsUInt16Number In[], cmsUInt16Number Out[], const cmsPipeline* lut);
1156 CMSAPI void CMSEXPORT cmsPipelineEvalFloat(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsPipeline* lut);
1157 CMSAPI cmsBool CMSEXPORT cmsPipelineEvalReverseFloat(cmsFloat32Number Target[], cmsFloat32Number Result[], cmsFloat32Number Hint[], const cmsPipeline* lut);
1158 CMSAPI cmsBool CMSEXPORT cmsPipelineCat(cmsPipeline* l1, const cmsPipeline* l2);
1159 CMSAPI cmsBool CMSEXPORT cmsPipelineSetSaveAs8bitsFlag(cmsPipeline* lut, cmsBool On);
1161 // Where to place/locate the stages in the pipeline chain
1162 typedef enum { cmsAT_BEGIN, cmsAT_END } cmsStageLoc;
1164 CMSAPI void CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage* mpe);
1165 CMSAPI void CMSEXPORT cmsPipelineUnlinkStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage** mpe);
1167 // This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements
1168 // that conform the Pipeline. It should be called with the Pipeline, the number of expected elements and
1169 // then a list of expected types followed with a list of double pointers to Stage elements. If
1170 // the function founds a match with current pipeline, it fills the pointers and returns TRUE
1171 // if not, returns FALSE without touching anything.
1172 CMSAPI cmsBool CMSEXPORT cmsPipelineCheckAndRetreiveStages(const cmsPipeline* Lut, cmsUInt32Number n, ...);
1174 // Matrix has double precision and CLUT has only float precision. That is because an ICC profile can encode
1175 // matrices with far more precision that CLUTS
1176 CMSAPI cmsStage* CMSEXPORT cmsStageAllocIdentity(cmsContext ContextID, cmsUInt32Number nChannels);
1177 CMSAPI cmsStage* CMSEXPORT cmsStageAllocToneCurves(cmsContext ContextID, cmsUInt32Number nChannels, cmsToneCurve* const Curves[]);
1178 CMSAPI cmsStage* CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number Rows, cmsUInt32Number Cols, const cmsFloat64Number* Matrix, const cmsFloat64Number* Offset);
1180 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLut16bit(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1181 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLutFloat(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1183 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1184 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1186 CMSAPI cmsStage* CMSEXPORT cmsStageDup(cmsStage* mpe);
1187 CMSAPI void CMSEXPORT cmsStageFree(cmsStage* mpe);
1188 CMSAPI cmsStage* CMSEXPORT cmsStageNext(const cmsStage* mpe);
1190 CMSAPI cmsUInt32Number CMSEXPORT cmsStageInputChannels(const cmsStage* mpe);
1191 CMSAPI cmsUInt32Number CMSEXPORT cmsStageOutputChannels(const cmsStage* mpe);
1192 CMSAPI cmsStageSignature CMSEXPORT cmsStageType(const cmsStage* mpe);
1193 CMSAPI void* CMSEXPORT cmsStageData(const cmsStage* mpe);
1196 typedef cmsInt32Number (* cmsSAMPLER16) (register const cmsUInt16Number In[],
1197 register cmsUInt16Number Out[],
1198 register void * Cargo);
1200 typedef cmsInt32Number (* cmsSAMPLERFLOAT)(register const cmsFloat32Number In[],
1201 register cmsFloat32Number Out[],
1202 register void * Cargo);
1204 // Use this flag to prevent changes being written to destination
1205 #define SAMPLER_INSPECT 0x01000000
1208 CMSAPI cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1209 CMSAPI cmsBool CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1212 CMSAPI cmsBool CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1213 cmsSAMPLER16 Sampler, void * Cargo);
1215 CMSAPI cmsBool CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1216 cmsSAMPLERFLOAT Sampler, void * Cargo);
1218 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1220 typedef struct _cms_MLU_struct cmsMLU;
1222 #define cmsNoLanguage "\0\0"
1223 #define cmsNoCountry "\0\0"
1225 CMSAPI cmsMLU* CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems);
1226 CMSAPI void CMSEXPORT cmsMLUfree(cmsMLU* mlu);
1227 CMSAPI cmsMLU* CMSEXPORT cmsMLUdup(const cmsMLU* mlu);
1229 CMSAPI cmsBool CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu,
1230 const char LanguageCode[3], const char CountryCode[3],
1231 const char* ASCIIString);
1232 CMSAPI cmsBool CMSEXPORT cmsMLUsetWide(cmsMLU* mlu,
1233 const char LanguageCode[3], const char CountryCode[3],
1234 const wchar_t* WideString);
1236 CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
1237 const char LanguageCode[3], const char CountryCode[3],
1238 char* Buffer, cmsUInt32Number BufferSize);
1240 CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
1241 const char LanguageCode[3], const char CountryCode[3],
1242 wchar_t* Buffer, cmsUInt32Number BufferSize);
1244 CMSAPI cmsBool CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
1245 const char LanguageCode[3], const char CountryCode[3],
1246 char ObtainedLanguage[3], char ObtainedCountry[3]);
1248 // Undercolorremoval & black generation -------------------------------------------------------------------------------------
1257 // Screening ----------------------------------------------------------------------------------------------------------------
1259 #define cmsPRINTER_DEFAULT_SCREENS 0x0001
1260 #define cmsFREQUENCE_UNITS_LINES_CM 0x0000
1261 #define cmsFREQUENCE_UNITS_LINES_INCH 0x0002
1263 #define cmsSPOT_UNKNOWN 0
1264 #define cmsSPOT_PRINTER_DEFAULT 1
1265 #define cmsSPOT_ROUND 2
1266 #define cmsSPOT_DIAMOND 3
1267 #define cmsSPOT_ELLIPSE 4
1268 #define cmsSPOT_LINE 5
1269 #define cmsSPOT_SQUARE 6
1270 #define cmsSPOT_CROSS 7
1273 cmsFloat64Number Frequency;
1274 cmsFloat64Number ScreenAngle;
1275 cmsUInt32Number SpotShape;
1277 } cmsScreeningChannel;
1280 cmsUInt32Number Flag;
1281 cmsUInt32Number nChannels;
1282 cmsScreeningChannel Channels[cmsMAXCHANNELS];
1287 // Named color -----------------------------------------------------------------------------------------------------------------
1289 typedef struct _cms_NAMEDCOLORLIST_struct cmsNAMEDCOLORLIST;
1291 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsContext ContextID,
1293 cmsUInt32Number ColorantCount,
1294 const char* Prefix, const char* Suffix);
1296 CMSAPI void CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v);
1297 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v);
1298 CMSAPI cmsBool CMSEXPORT cmsAppendNamedColor(cmsNAMEDCOLORLIST* v, const char* Name,
1299 cmsUInt16Number PCS[3],
1300 cmsUInt16Number Colorant[cmsMAXCHANNELS]);
1302 CMSAPI cmsUInt32Number CMSEXPORT cmsNamedColorCount(const cmsNAMEDCOLORLIST* v);
1303 CMSAPI cmsInt32Number CMSEXPORT cmsNamedColorIndex(const cmsNAMEDCOLORLIST* v, const char* Name);
1305 CMSAPI cmsBool CMSEXPORT cmsNamedColorInfo(const cmsNAMEDCOLORLIST* NamedColorList, cmsUInt32Number nColor,
1309 cmsUInt16Number* PCS,
1310 cmsUInt16Number* Colorant);
1312 // Retrieve named color list from transform
1313 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsGetNamedColorList(cmsHTRANSFORM xform);
1315 // Profile sequence -----------------------------------------------------------------------------------------------------
1317 // Profile sequence descriptor. Some fields come from profile sequence descriptor tag, others
1318 // come from Profile Sequence Identifier Tag
1321 cmsSignature deviceMfg;
1322 cmsSignature deviceModel;
1323 cmsUInt64Number attributes;
1324 cmsTechnologySignature technology;
1325 cmsProfileID ProfileID;
1326 cmsMLU* Manufacturer;
1328 cmsMLU* Description;
1335 cmsContext ContextID;
1340 CMSAPI cmsSEQ* CMSEXPORT cmsAllocProfileSequenceDescription(cmsContext ContextID, cmsUInt32Number n);
1341 CMSAPI cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq);
1342 CMSAPI void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq);
1344 // Dictionaries --------------------------------------------------------------------------------------------------------
1346 typedef struct _cmsDICTentry_struct {
1348 struct _cmsDICTentry_struct* Next;
1350 cmsMLU *DisplayName;
1351 cmsMLU *DisplayValue;
1357 CMSAPI cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID);
1358 CMSAPI void CMSEXPORT cmsDictFree(cmsHANDLE hDict);
1359 CMSAPI cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict);
1361 CMSAPI cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue);
1362 CMSAPI const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict);
1363 CMSAPI const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e);
1365 // Access to Profile data ----------------------------------------------------------------------------------------------
1366 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateProfilePlaceholder(cmsContext ContextID);
1368 CMSAPI cmsContext CMSEXPORT cmsGetProfileContextID(cmsHPROFILE hProfile);
1369 CMSAPI cmsInt32Number CMSEXPORT cmsGetTagCount(cmsHPROFILE hProfile);
1370 CMSAPI cmsTagSignature CMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, cmsUInt32Number n);
1371 CMSAPI cmsBool CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1373 // Read and write pre-formatted data
1374 CMSAPI void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1375 CMSAPI cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data);
1376 CMSAPI cmsBool CMSEXPORT cmsLinkTag(cmsHPROFILE hProfile, cmsTagSignature sig, cmsTagSignature dest);
1377 CMSAPI cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig);
1379 // Read and write raw data
1380 CMSAPI cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize);
1381 CMSAPI cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size);
1383 // Access header data
1384 #define cmsEmbeddedProfileFalse 0x00000000
1385 #define cmsEmbeddedProfileTrue 0x00000001
1386 #define cmsUseAnywhere 0x00000000
1387 #define cmsUseWithEmbeddedDataOnly 0x00000002
1389 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderFlags(cmsHPROFILE hProfile);
1390 CMSAPI void CMSEXPORT cmsGetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number* Flags);
1391 CMSAPI void CMSEXPORT cmsGetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1392 CMSAPI cmsBool CMSEXPORT cmsGetHeaderCreationDateTime(cmsHPROFILE hProfile, struct tm *Dest);
1393 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderRenderingIntent(cmsHPROFILE hProfile);
1395 CMSAPI void CMSEXPORT cmsSetHeaderFlags(cmsHPROFILE hProfile, cmsUInt32Number Flags);
1396 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderManufacturer(cmsHPROFILE hProfile);
1397 CMSAPI void CMSEXPORT cmsSetHeaderManufacturer(cmsHPROFILE hProfile, cmsUInt32Number manufacturer);
1398 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderModel(cmsHPROFILE hProfile);
1399 CMSAPI void CMSEXPORT cmsSetHeaderModel(cmsHPROFILE hProfile, cmsUInt32Number model);
1400 CMSAPI void CMSEXPORT cmsSetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number Flags);
1401 CMSAPI void CMSEXPORT cmsSetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1402 CMSAPI void CMSEXPORT cmsSetHeaderRenderingIntent(cmsHPROFILE hProfile, cmsUInt32Number RenderingIntent);
1404 CMSAPI cmsColorSpaceSignature
1405 CMSEXPORT cmsGetPCS(cmsHPROFILE hProfile);
1406 CMSAPI void CMSEXPORT cmsSetPCS(cmsHPROFILE hProfile, cmsColorSpaceSignature pcs);
1407 CMSAPI cmsColorSpaceSignature
1408 CMSEXPORT cmsGetColorSpace(cmsHPROFILE hProfile);
1409 CMSAPI void CMSEXPORT cmsSetColorSpace(cmsHPROFILE hProfile, cmsColorSpaceSignature sig);
1410 CMSAPI cmsProfileClassSignature
1411 CMSEXPORT cmsGetDeviceClass(cmsHPROFILE hProfile);
1412 CMSAPI void CMSEXPORT cmsSetDeviceClass(cmsHPROFILE hProfile, cmsProfileClassSignature sig);
1413 CMSAPI void CMSEXPORT cmsSetProfileVersion(cmsHPROFILE hProfile, cmsFloat64Number Version);
1414 CMSAPI cmsFloat64Number CMSEXPORT cmsGetProfileVersion(cmsHPROFILE hProfile);
1416 CMSAPI cmsUInt32Number CMSEXPORT cmsGetEncodedICCversion(cmsHPROFILE hProfile);
1417 CMSAPI void CMSEXPORT cmsSetEncodedICCversion(cmsHPROFILE hProfile, cmsUInt32Number Version);
1419 // How profiles may be used
1420 #define LCMS_USED_AS_INPUT 0
1421 #define LCMS_USED_AS_OUTPUT 1
1422 #define LCMS_USED_AS_PROOF 2
1424 CMSAPI cmsBool CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1425 CMSAPI cmsBool CMSEXPORT cmsIsMatrixShaper(cmsHPROFILE hProfile);
1426 CMSAPI cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1428 // Translate form/to our notation to ICC
1429 CMSAPI cmsColorSpaceSignature CMSEXPORT _cmsICCcolorSpace(int OurNotation);
1430 CMSAPI int CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignature ProfileSpace);
1432 CMSAPI cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace);
1434 // Build a suitable formatter for the colorspace of this profile
1435 CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1436 CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1441 cmsInfoDescription = 0,
1442 cmsInfoManufacturer = 1,
1444 cmsInfoCopyright = 3
1447 CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfo(cmsHPROFILE hProfile, cmsInfoType Info,
1448 const char LanguageCode[3], const char CountryCode[3],
1449 wchar_t* Buffer, cmsUInt32Number BufferSize);
1451 CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
1452 const char LanguageCode[3], const char CountryCode[3],
1453 char* Buffer, cmsUInt32Number BufferSize);
1455 // IO handlers ----------------------------------------------------------------------------------------------------------
1457 typedef struct _cms_io_handler cmsIOHANDLER;
1459 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const char* FileName, const char* AccessMode);
1460 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
1461 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
1462 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
1463 CMSAPI cmsBool CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);
1465 // MD5 message digest --------------------------------------------------------------------------------------------------
1467 CMSAPI cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile);
1469 // Profile high level funtions ------------------------------------------------------------------------------------------
1471 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
1472 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess);
1473 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char* sAccess);
1474 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromStreamTHR(cmsContext ContextID, FILE* ICCProfile, const char* sAccess);
1475 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromMem(const void * MemPtr, cmsUInt32Number dwSize);
1476 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromMemTHR(cmsContext ContextID, const void * MemPtr, cmsUInt32Number dwSize);
1477 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromIOhandlerTHR(cmsContext ContextID, cmsIOHANDLER* io);
1478 CMSAPI cmsBool CMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile);
1480 CMSAPI cmsBool CMSEXPORT cmsSaveProfileToFile(cmsHPROFILE hProfile, const char* FileName);
1481 CMSAPI cmsBool CMSEXPORT cmsSaveProfileToStream(cmsHPROFILE hProfile, FILE* Stream);
1482 CMSAPI cmsBool CMSEXPORT cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr, cmsUInt32Number* BytesNeeded);
1483 CMSAPI cmsUInt32Number CMSEXPORT cmsSaveProfileToIOhandler(cmsHPROFILE hProfile, cmsIOHANDLER* io);
1485 // Predefined virtual profiles ------------------------------------------------------------------------------------------
1487 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateRGBProfileTHR(cmsContext ContextID,
1488 const cmsCIExyY* WhitePoint,
1489 const cmsCIExyYTRIPLE* Primaries,
1490 cmsToneCurve* const TransferFunction[3]);
1492 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateRGBProfile(const cmsCIExyY* WhitePoint,
1493 const cmsCIExyYTRIPLE* Primaries,
1494 cmsToneCurve* const TransferFunction[3]);
1496 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
1497 const cmsCIExyY* WhitePoint,
1498 const cmsToneCurve* TransferFunction);
1500 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateGrayProfile(const cmsCIExyY* WhitePoint,
1501 const cmsToneCurve* TransferFunction);
1503 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
1504 cmsColorSpaceSignature ColorSpace,
1505 cmsToneCurve* const TransferFunctions[]);
1507 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLink(cmsColorSpaceSignature ColorSpace,
1508 cmsToneCurve* const TransferFunctions[]);
1510 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
1511 cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1513 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLink(cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1516 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1517 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab2Profile(const cmsCIExyY* WhitePoint);
1518 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1519 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab4Profile(const cmsCIExyY* WhitePoint);
1521 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID);
1522 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateXYZProfile(void);
1524 CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfileTHR(cmsContext ContextID);
1525 CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfile(void);
1527 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
1529 cmsFloat64Number Bright,
1530 cmsFloat64Number Contrast,
1531 cmsFloat64Number Hue,
1532 cmsFloat64Number Saturation,
1536 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(int nLUTPoints,
1537 cmsFloat64Number Bright,
1538 cmsFloat64Number Contrast,
1539 cmsFloat64Number Hue,
1540 cmsFloat64Number Saturation,
1544 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID);
1545 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfile(void);
1547 // Converts a transform to a devicelink profile
1548 CMSAPI cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat64Number Version, cmsUInt32Number dwFlags);
1550 // Intents ----------------------------------------------------------------------------------------------
1553 #define INTENT_PERCEPTUAL 0
1554 #define INTENT_RELATIVE_COLORIMETRIC 1
1555 #define INTENT_SATURATION 2
1556 #define INTENT_ABSOLUTE_COLORIMETRIC 3
1559 #define INTENT_PRESERVE_K_ONLY_PERCEPTUAL 10
1560 #define INTENT_PRESERVE_K_ONLY_RELATIVE_COLORIMETRIC 11
1561 #define INTENT_PRESERVE_K_ONLY_SATURATION 12
1562 #define INTENT_PRESERVE_K_PLANE_PERCEPTUAL 13
1563 #define INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC 14
1564 #define INTENT_PRESERVE_K_PLANE_SATURATION 15
1566 // Call with NULL as parameters to get the intent count
1567 CMSAPI cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1571 #define cmsFLAGS_NOCACHE 0x0040 // Inhibit 1-pixel cache
1572 #define cmsFLAGS_NOOPTIMIZE 0x0100 // Inhibit optimizations
1573 #define cmsFLAGS_NULLTRANSFORM 0x0200 // Don't transform anyway
1576 #define cmsFLAGS_GAMUTCHECK 0x1000 // Out of Gamut alarm
1577 #define cmsFLAGS_SOFTPROOFING 0x4000 // Do softproofing
1580 #define cmsFLAGS_BLACKPOINTCOMPENSATION 0x2000
1581 #define cmsFLAGS_NOWHITEONWHITEFIXUP 0x0004 // Don't fix scum dot
1582 #define cmsFLAGS_HIGHRESPRECALC 0x0400 // Use more memory to give better accurancy
1583 #define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resouces
1585 // For devicelink creation
1586 #define cmsFLAGS_8BITS_DEVICELINK 0x0008 // Create 8 bits devicelinks
1587 #define cmsFLAGS_GUESSDEVICECLASS 0x0020 // Guess device class (for transform2devicelink)
1588 #define cmsFLAGS_KEEP_SEQUENCE 0x0080 // Keep profile sequence for devicelink creation
1590 // Specific to a particular optimizations
1591 #define cmsFLAGS_FORCE_CLUT 0x0002 // Force CLUT optimization
1592 #define cmsFLAGS_CLUT_POST_LINEARIZATION 0x0001 // create postlinearization tables if possible
1593 #define cmsFLAGS_CLUT_PRE_LINEARIZATION 0x0010 // create prelinearization tables if possible
1595 // Fine-tune control over number of gridpoints
1596 #define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16)
1599 #define cmsFLAGS_NODEFAULTRESOURCEDEF 0x01000000
1601 // Transforms ---------------------------------------------------------------------------------------------------
1603 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransformTHR(cmsContext ContextID,
1605 cmsUInt32Number InputFormat,
1607 cmsUInt32Number OutputFormat,
1608 cmsUInt32Number Intent,
1609 cmsUInt32Number dwFlags);
1611 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransform(cmsHPROFILE Input,
1612 cmsUInt32Number InputFormat,
1614 cmsUInt32Number OutputFormat,
1615 cmsUInt32Number Intent,
1616 cmsUInt32Number dwFlags);
1618 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransformTHR(cmsContext ContextID,
1620 cmsUInt32Number InputFormat,
1622 cmsUInt32Number OutputFormat,
1623 cmsHPROFILE Proofing,
1624 cmsUInt32Number Intent,
1625 cmsUInt32Number ProofingIntent,
1626 cmsUInt32Number dwFlags);
1628 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransform(cmsHPROFILE Input,
1629 cmsUInt32Number InputFormat,
1631 cmsUInt32Number OutputFormat,
1632 cmsHPROFILE Proofing,
1633 cmsUInt32Number Intent,
1634 cmsUInt32Number ProofingIntent,
1635 cmsUInt32Number dwFlags);
1637 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransformTHR(cmsContext ContextID,
1638 cmsHPROFILE hProfiles[],
1639 cmsUInt32Number nProfiles,
1640 cmsUInt32Number InputFormat,
1641 cmsUInt32Number OutputFormat,
1642 cmsUInt32Number Intent,
1643 cmsUInt32Number dwFlags);
1646 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[],
1647 cmsUInt32Number nProfiles,
1648 cmsUInt32Number InputFormat,
1649 cmsUInt32Number OutputFormat,
1650 cmsUInt32Number Intent,
1651 cmsUInt32Number dwFlags);
1654 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
1655 cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[],
1657 cmsUInt32Number Intents[],
1658 cmsFloat64Number AdaptationStates[],
1659 cmsHPROFILE hGamutProfile,
1660 cmsUInt32Number nGamutPCSposition,
1661 cmsUInt32Number InputFormat,
1662 cmsUInt32Number OutputFormat,
1663 cmsUInt32Number dwFlags);
1665 CMSAPI void CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform);
1667 CMSAPI void CMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform,
1668 const void * InputBuffer,
1669 void * OutputBuffer,
1670 cmsUInt32Number Size);
1672 CMSAPI void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,
1673 const void * InputBuffer,
1674 void * OutputBuffer,
1675 cmsUInt32Number Size,
1676 cmsUInt32Number Stride);
1679 CMSAPI void CMSEXPORT cmsSetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1680 CMSAPI void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1682 // Adaptation state for absolute colorimetric intent
1683 CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d);
1685 // Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed
1686 CMSAPI cmsContext CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform);
1688 // Grab the input/output formats
1689 CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform);
1690 CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform);
1692 // For backwards compatibility
1693 CMSAPI cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform,
1694 cmsUInt32Number InputFormat,
1695 cmsUInt32Number OutputFormat);
1699 // PostScript ColorRenderingDictionary and ColorSpaceArray ----------------------------------------------------
1701 typedef enum { cmsPS_RESOURCE_CSA, cmsPS_RESOURCE_CRD } cmsPSResourceType;
1703 // lcms2 unified method to access postscript color resources
1704 CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptColorResource(cmsContext ContextID,
1705 cmsPSResourceType Type,
1706 cmsHPROFILE hProfile,
1707 cmsUInt32Number Intent,
1708 cmsUInt32Number dwFlags,
1711 CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptCSA(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1712 CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptCRD(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1715 // IT8.7 / CGATS.17-200x handling -----------------------------------------------------------------------------
1717 CMSAPI cmsHANDLE CMSEXPORT cmsIT8Alloc(cmsContext ContextID);
1718 CMSAPI void CMSEXPORT cmsIT8Free(cmsHANDLE hIT8);
1721 CMSAPI cmsUInt32Number CMSEXPORT cmsIT8TableCount(cmsHANDLE hIT8);
1722 CMSAPI cmsInt32Number CMSEXPORT cmsIT8SetTable(cmsHANDLE hIT8, cmsUInt32Number nTable);
1725 CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromFile(cmsContext ContextID, const char* cFileName);
1726 CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, void *Ptr, cmsUInt32Number len);
1727 // CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromIOhandler(cmsContext ContextID, cmsIOHANDLER* io);
1729 CMSAPI cmsBool CMSEXPORT cmsIT8SaveToFile(cmsHANDLE hIT8, const char* cFileName);
1730 CMSAPI cmsBool CMSEXPORT cmsIT8SaveToMem(cmsHANDLE hIT8, void *MemPtr, cmsUInt32Number* BytesNeeded);
1733 CMSAPI const char* CMSEXPORT cmsIT8GetSheetType(cmsHANDLE hIT8);
1734 CMSAPI cmsBool CMSEXPORT cmsIT8SetSheetType(cmsHANDLE hIT8, const char* Type);
1736 CMSAPI cmsBool CMSEXPORT cmsIT8SetComment(cmsHANDLE hIT8, const char* cComment);
1738 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyStr(cmsHANDLE hIT8, const char* cProp, const char *Str);
1739 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val);
1740 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyHex(cmsHANDLE hIT8, const char* cProp, cmsUInt32Number Val);
1741 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char* SubKey, const char *Buffer);
1742 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyUncooked(cmsHANDLE hIT8, const char* Key, const char* Buffer);
1745 CMSAPI const char* CMSEXPORT cmsIT8GetProperty(cmsHANDLE hIT8, const char* cProp);
1746 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetPropertyDbl(cmsHANDLE hIT8, const char* cProp);
1747 CMSAPI const char* CMSEXPORT cmsIT8GetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char *SubKey);
1748 CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumProperties(cmsHANDLE hIT8, char ***PropertyNames);
1749 CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumPropertyMulti(cmsHANDLE hIT8, const char* cProp, const char ***SubpropertyNames);
1752 CMSAPI const char* CMSEXPORT cmsIT8GetDataRowCol(cmsHANDLE hIT8, int row, int col);
1753 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataRowColDbl(cmsHANDLE hIT8, int row, int col);
1755 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataRowCol(cmsHANDLE hIT8, int row, int col,
1758 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataRowColDbl(cmsHANDLE hIT8, int row, int col,
1759 cmsFloat64Number Val);
1761 CMSAPI const char* CMSEXPORT cmsIT8GetData(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1764 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1766 CMSAPI cmsBool CMSEXPORT cmsIT8SetData(cmsHANDLE hIT8, const char* cPatch,
1767 const char* cSample,
1770 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataDbl(cmsHANDLE hIT8, const char* cPatch,
1771 const char* cSample,
1772 cmsFloat64Number Val);
1774 CMSAPI int CMSEXPORT cmsIT8FindDataFormat(cmsHANDLE hIT8, const char* cSample);
1775 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE hIT8, int n, const char *Sample);
1776 CMSAPI int CMSEXPORT cmsIT8EnumDataFormat(cmsHANDLE hIT8, char ***SampleNames);
1778 CMSAPI const char* CMSEXPORT cmsIT8GetPatchName(cmsHANDLE hIT8, int nPatch, char* buffer);
1779 CMSAPI int CMSEXPORT cmsIT8GetPatchByName(cmsHANDLE hIT8, const char *cPatch);
1781 // The LABEL extension
1782 CMSAPI int CMSEXPORT cmsIT8SetTableByLabel(cmsHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType);
1784 CMSAPI cmsBool CMSEXPORT cmsIT8SetIndexColumn(cmsHANDLE hIT8, const char* cSample);
1786 // Formatter for double
1787 CMSAPI void CMSEXPORT cmsIT8DefineDblFormat(cmsHANDLE hIT8, const char* Formatter);
1789 // Gamut boundary description routines ------------------------------------------------------------------------------
1791 CMSAPI cmsHANDLE CMSEXPORT cmsGBDAlloc(cmsContext ContextID);
1792 CMSAPI void CMSEXPORT cmsGBDFree(cmsHANDLE hGBD);
1793 CMSAPI cmsBool CMSEXPORT cmsGDBAddPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1794 CMSAPI cmsBool CMSEXPORT cmsGDBCompute(cmsHANDLE hGDB, cmsUInt32Number dwFlags);
1795 CMSAPI cmsBool CMSEXPORT cmsGDBCheckPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1797 // Feature detection ----------------------------------------------------------------------------------------------
1799 // Estimate the black point
1800 CMSAPI cmsBool CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1801 CMSAPI cmsBool CMSEXPORT cmsDetectDestinationBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1803 // Estimate total area coverage
1804 CMSAPI cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile);
1807 // Poor man's gamut mapping
1808 CMSAPI cmsBool CMSEXPORT cmsDesaturateLab(cmsCIELab* Lab,
1809 double amax, double amin,
1810 double bmax, double bmin);
1812 #ifndef CMS_USE_CPP_API