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 // ********** End of configuration toggles ******************************
60 // Needed for portability (C99 per 7.1.2)
65 #ifndef CMS_USE_CPP_API
72 #define LCMS_VERSION 2030
74 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
75 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
78 typedef unsigned char cmsUInt8Number; // That is guaranteed by the C99 spec
79 typedef signed char cmsInt8Number; // That is guaranteed by the C99 spec
82 # error "Unable to find 8 bit type, unsupported compiler"
85 // IEEE float storage numbers
86 typedef float cmsFloat32Number;
87 typedef double cmsFloat64Number;
90 #if (USHRT_MAX == 65535U)
91 typedef unsigned short cmsUInt16Number;
92 #elif (UINT_MAX == 65535U)
93 typedef unsigned int cmsUInt16Number;
95 # error "Unable to find 16 bits unsigned type, unsupported compiler"
98 #if (SHRT_MAX == 32767)
99 typedef short cmsInt16Number;
100 #elif (INT_MAX == 32767)
101 typedef int cmsInt16Number;
103 # error "Unable to find 16 bits signed type, unsupported compiler"
107 #if (UINT_MAX == 4294967295U)
108 typedef unsigned int cmsUInt32Number;
109 #elif (ULONG_MAX == 4294967295U)
110 typedef unsigned long cmsUInt32Number;
112 # error "Unable to find 32 bit unsigned type, unsupported compiler"
115 #if (INT_MAX == +2147483647)
116 typedef int cmsInt32Number;
117 #elif (LONG_MAX == +2147483647)
118 typedef long cmsInt32Number;
120 # error "Unable to find 32 bit signed type, unsupported compiler"
124 #ifndef CMS_DONT_USE_INT64
125 # if (ULONG_MAX == 18446744073709551615U)
126 typedef unsigned long cmsUInt64Number;
127 # elif (ULLONG_MAX == 18446744073709551615U)
128 typedef unsigned long long cmsUInt64Number;
130 # define CMS_DONT_USE_INT64 1
132 # if (LONG_MAX == +9223372036854775807)
133 typedef long cmsInt64Number;
134 # elif (LLONG_MAX == +9223372036854775807)
135 typedef long long cmsInt64Number;
137 # define CMS_DONT_USE_INT64 1
142 // In the case 64 bit numbers are not supported by the compiler
143 #ifdef CMS_DONT_USE_INT64
144 typedef cmsUInt32Number cmsUInt64Number[2];
145 typedef cmsInt32Number cmsInt64Number[2];
149 typedef cmsUInt32Number cmsSignature;
150 typedef cmsUInt16Number cmsU8Fixed8Number;
151 typedef cmsInt32Number cmsS15Fixed16Number;
152 typedef cmsUInt32Number cmsU16Fixed16Number;
154 // Boolean type, which will be using the native integer
157 // Try to detect windows
158 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
159 # define CMS_IS_WINDOWS_ 1
163 # define CMS_IS_WINDOWS_ 1
167 # define CMS_IS_WINDOWS_ 1
170 // Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
171 // you can pass this toggle to the compiler by using -DCMS_USE_BIG_ENDIAN or something similar
173 #if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
174 # define CMS_USE_BIG_ENDIAN 1
177 #if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc)
178 # define CMS_USE_BIG_ENDIAN 1
181 #if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
182 # define CMS_USE_BIG_ENDIAN 1
186 # define CMS_USE_BIG_ENDIAN 1
190 # ifdef __BIG_ENDIAN__
191 # define CMS_USE_BIG_ENDIAN 1
195 // Calling convention -- this is hardly platform and compiler dependent
196 #ifdef CMS_IS_WINDOWS_
197 # if defined(CMS_DLL) || defined(CMS_DLL_BUILD)
199 # define CMSEXPORT __stdcall _export
202 # define CMSEXPORT _stdcall
203 # ifdef CMS_DLL_BUILD
204 # define CMSAPI __declspec(dllexport)
206 # define CMSAPI __declspec(dllimport)
218 // Some common definitions
219 #define cmsMAX_PATH 256
228 // D50 XYZ normalized to Y=1.0
229 #define cmsD50X 0.9642
231 #define cmsD50Z 0.8249
233 // V4 perceptual black
234 #define cmsPERCEPTUAL_BLACK_X 0.00336
235 #define cmsPERCEPTUAL_BLACK_Y 0.0034731
236 #define cmsPERCEPTUAL_BLACK_Z 0.00287
238 // Definitions in ICC spec
239 #define cmsMagicNumber 0x61637370 // 'acsp'
240 #define lcmsSignature 0x6c636d73 // 'lcms'
243 // Base ICC type definitions
245 cmsSigChromaticityType = 0x6368726D, // 'chrm'
246 cmsSigColorantOrderType = 0x636C726F, // 'clro'
247 cmsSigColorantTableType = 0x636C7274, // 'clrt'
248 cmsSigCrdInfoType = 0x63726469, // 'crdi'
249 cmsSigCurveType = 0x63757276, // 'curv'
250 cmsSigDataType = 0x64617461, // 'data'
251 cmsSigDictType = 0x64696374, // 'dict'
252 cmsSigDateTimeType = 0x6474696D, // 'dtim'
253 cmsSigDeviceSettingsType = 0x64657673, // 'devs'
254 cmsSigLut16Type = 0x6d667432, // 'mft2'
255 cmsSigLut8Type = 0x6d667431, // 'mft1'
256 cmsSigLutAtoBType = 0x6d414220, // 'mAB '
257 cmsSigLutBtoAType = 0x6d424120, // 'mBA '
258 cmsSigMeasurementType = 0x6D656173, // 'meas'
259 cmsSigMultiLocalizedUnicodeType = 0x6D6C7563, // 'mluc'
260 cmsSigMultiProcessElementType = 0x6D706574, // 'mpet'
261 cmsSigNamedColorType = 0x6E636f6C, // 'ncol' -- DEPRECATED!
262 cmsSigNamedColor2Type = 0x6E636C32, // 'ncl2'
263 cmsSigParametricCurveType = 0x70617261, // 'para'
264 cmsSigProfileSequenceDescType = 0x70736571, // 'pseq'
265 cmsSigProfileSequenceIdType = 0x70736964, // 'psid'
266 cmsSigResponseCurveSet16Type = 0x72637332, // 'rcs2'
267 cmsSigS15Fixed16ArrayType = 0x73663332, // 'sf32'
268 cmsSigScreeningType = 0x7363726E, // 'scrn'
269 cmsSigSignatureType = 0x73696720, // 'sig '
270 cmsSigTextType = 0x74657874, // 'text'
271 cmsSigTextDescriptionType = 0x64657363, // 'desc'
272 cmsSigU16Fixed16ArrayType = 0x75663332, // 'uf32'
273 cmsSigUcrBgType = 0x62666420, // 'bfd '
274 cmsSigUInt16ArrayType = 0x75693136, // 'ui16'
275 cmsSigUInt32ArrayType = 0x75693332, // 'ui32'
276 cmsSigUInt64ArrayType = 0x75693634, // 'ui64'
277 cmsSigUInt8ArrayType = 0x75693038, // 'ui08'
278 cmsSigVcgtType = 0x76636774, // 'vcgt'
279 cmsSigViewingConditionsType = 0x76696577, // 'view'
280 cmsSigXYZType = 0x58595A20 // 'XYZ '
283 } cmsTagTypeSignature;
285 // Base ICC tag definitions
287 cmsSigAToB0Tag = 0x41324230, // 'A2B0'
288 cmsSigAToB1Tag = 0x41324231, // 'A2B1'
289 cmsSigAToB2Tag = 0x41324232, // 'A2B2'
290 cmsSigBlueColorantTag = 0x6258595A, // 'bXYZ'
291 cmsSigBlueMatrixColumnTag = 0x6258595A, // 'bXYZ'
292 cmsSigBlueTRCTag = 0x62545243, // 'bTRC'
293 cmsSigBToA0Tag = 0x42324130, // 'B2A0'
294 cmsSigBToA1Tag = 0x42324131, // 'B2A1'
295 cmsSigBToA2Tag = 0x42324132, // 'B2A2'
296 cmsSigCalibrationDateTimeTag = 0x63616C74, // 'calt'
297 cmsSigCharTargetTag = 0x74617267, // 'targ'
298 cmsSigChromaticAdaptationTag = 0x63686164, // 'chad'
299 cmsSigChromaticityTag = 0x6368726D, // 'chrm'
300 cmsSigColorantOrderTag = 0x636C726F, // 'clro'
301 cmsSigColorantTableTag = 0x636C7274, // 'clrt'
302 cmsSigColorantTableOutTag = 0x636C6F74, // 'clot'
303 cmsSigColorimetricIntentImageStateTag = 0x63696973, // 'ciis'
304 cmsSigCopyrightTag = 0x63707274, // 'cprt'
305 cmsSigCrdInfoTag = 0x63726469, // 'crdi'
306 cmsSigDataTag = 0x64617461, // 'data'
307 cmsSigDateTimeTag = 0x6474696D, // 'dtim'
308 cmsSigDeviceMfgDescTag = 0x646D6E64, // 'dmnd'
309 cmsSigDeviceModelDescTag = 0x646D6464, // 'dmdd'
310 cmsSigDeviceSettingsTag = 0x64657673, // 'devs'
311 cmsSigDToB0Tag = 0x44324230, // 'D2B0'
312 cmsSigDToB1Tag = 0x44324231, // 'D2B1'
313 cmsSigDToB2Tag = 0x44324232, // 'D2B2'
314 cmsSigDToB3Tag = 0x44324233, // 'D2B3'
315 cmsSigBToD0Tag = 0x42324430, // 'B2D0'
316 cmsSigBToD1Tag = 0x42324431, // 'B2D1'
317 cmsSigBToD2Tag = 0x42324432, // 'B2D2'
318 cmsSigBToD3Tag = 0x42324433, // 'B2D3'
319 cmsSigGamutTag = 0x67616D74, // 'gamt'
320 cmsSigGrayTRCTag = 0x6b545243, // 'kTRC'
321 cmsSigGreenColorantTag = 0x6758595A, // 'gXYZ'
322 cmsSigGreenMatrixColumnTag = 0x6758595A, // 'gXYZ'
323 cmsSigGreenTRCTag = 0x67545243, // 'gTRC'
324 cmsSigLuminanceTag = 0x6C756d69, // 'lumi'
325 cmsSigMeasurementTag = 0x6D656173, // 'meas'
326 cmsSigMediaBlackPointTag = 0x626B7074, // 'bkpt'
327 cmsSigMediaWhitePointTag = 0x77747074, // 'wtpt'
328 cmsSigNamedColorTag = 0x6E636f6C, // 'ncol' // Deprecated by the ICC
329 cmsSigNamedColor2Tag = 0x6E636C32, // 'ncl2'
330 cmsSigOutputResponseTag = 0x72657370, // 'resp'
331 cmsSigPerceptualRenderingIntentGamutTag = 0x72696730, // 'rig0'
332 cmsSigPreview0Tag = 0x70726530, // 'pre0'
333 cmsSigPreview1Tag = 0x70726531, // 'pre1'
334 cmsSigPreview2Tag = 0x70726532, // 'pre2'
335 cmsSigProfileDescriptionTag = 0x64657363, // 'desc'
336 cmsSigProfileSequenceDescTag = 0x70736571, // 'pseq'
337 cmsSigProfileSequenceIdTag = 0x70736964, // 'psid'
338 cmsSigPs2CRD0Tag = 0x70736430, // 'psd0'
339 cmsSigPs2CRD1Tag = 0x70736431, // 'psd1'
340 cmsSigPs2CRD2Tag = 0x70736432, // 'psd2'
341 cmsSigPs2CRD3Tag = 0x70736433, // 'psd3'
342 cmsSigPs2CSATag = 0x70733273, // 'ps2s'
343 cmsSigPs2RenderingIntentTag = 0x70733269, // 'ps2i'
344 cmsSigRedColorantTag = 0x7258595A, // 'rXYZ'
345 cmsSigRedMatrixColumnTag = 0x7258595A, // 'rXYZ'
346 cmsSigRedTRCTag = 0x72545243, // 'rTRC'
347 cmsSigSaturationRenderingIntentGamutTag = 0x72696732, // 'rig2'
348 cmsSigScreeningDescTag = 0x73637264, // 'scrd'
349 cmsSigScreeningTag = 0x7363726E, // 'scrn'
350 cmsSigTechnologyTag = 0x74656368, // 'tech'
351 cmsSigUcrBgTag = 0x62666420, // 'bfd '
352 cmsSigViewingCondDescTag = 0x76756564, // 'vued'
353 cmsSigViewingConditionsTag = 0x76696577, // 'view'
354 cmsSigVcgtTag = 0x76636774, // 'vcgt'
355 cmsSigMetaTag = 0x6D657461 // 'meta'
360 // ICC Technology tag
362 cmsSigDigitalCamera = 0x6463616D, // 'dcam'
363 cmsSigFilmScanner = 0x6673636E, // 'fscn'
364 cmsSigReflectiveScanner = 0x7273636E, // 'rscn'
365 cmsSigInkJetPrinter = 0x696A6574, // 'ijet'
366 cmsSigThermalWaxPrinter = 0x74776178, // 'twax'
367 cmsSigElectrophotographicPrinter = 0x6570686F, // 'epho'
368 cmsSigElectrostaticPrinter = 0x65737461, // 'esta'
369 cmsSigDyeSublimationPrinter = 0x64737562, // 'dsub'
370 cmsSigPhotographicPaperPrinter = 0x7270686F, // 'rpho'
371 cmsSigFilmWriter = 0x6670726E, // 'fprn'
372 cmsSigVideoMonitor = 0x7669646D, // 'vidm'
373 cmsSigVideoCamera = 0x76696463, // 'vidc'
374 cmsSigProjectionTelevision = 0x706A7476, // 'pjtv'
375 cmsSigCRTDisplay = 0x43525420, // 'CRT '
376 cmsSigPMDisplay = 0x504D4420, // 'PMD '
377 cmsSigAMDisplay = 0x414D4420, // 'AMD '
378 cmsSigPhotoCD = 0x4B504344, // 'KPCD'
379 cmsSigPhotoImageSetter = 0x696D6773, // 'imgs'
380 cmsSigGravure = 0x67726176, // 'grav'
381 cmsSigOffsetLithography = 0x6F666673, // 'offs'
382 cmsSigSilkscreen = 0x73696C6B, // 'silk'
383 cmsSigFlexography = 0x666C6578, // 'flex'
384 cmsSigMotionPictureFilmScanner = 0x6D706673, // 'mpfs'
385 cmsSigMotionPictureFilmRecorder = 0x6D706672, // 'mpfr'
386 cmsSigDigitalMotionPictureCamera = 0x646D7063, // 'dmpc'
387 cmsSigDigitalCinemaProjector = 0x64636A70 // 'dcpj'
389 } cmsTechnologySignature;
394 cmsSigXYZData = 0x58595A20, // 'XYZ '
395 cmsSigLabData = 0x4C616220, // 'Lab '
396 cmsSigLuvData = 0x4C757620, // 'Luv '
397 cmsSigYCbCrData = 0x59436272, // 'YCbr'
398 cmsSigYxyData = 0x59787920, // 'Yxy '
399 cmsSigRgbData = 0x52474220, // 'RGB '
400 cmsSigGrayData = 0x47524159, // 'GRAY'
401 cmsSigHsvData = 0x48535620, // 'HSV '
402 cmsSigHlsData = 0x484C5320, // 'HLS '
403 cmsSigCmykData = 0x434D594B, // 'CMYK'
404 cmsSigCmyData = 0x434D5920, // 'CMY '
405 cmsSigMCH1Data = 0x4D434831, // 'MCH1'
406 cmsSigMCH2Data = 0x4D434832, // 'MCH2'
407 cmsSigMCH3Data = 0x4D434833, // 'MCH3'
408 cmsSigMCH4Data = 0x4D434834, // 'MCH4'
409 cmsSigMCH5Data = 0x4D434835, // 'MCH5'
410 cmsSigMCH6Data = 0x4D434836, // 'MCH6'
411 cmsSigMCH7Data = 0x4D434837, // 'MCH7'
412 cmsSigMCH8Data = 0x4D434838, // 'MCH8'
413 cmsSigMCH9Data = 0x4D434839, // 'MCH9'
414 cmsSigMCHAData = 0x4D434841, // 'MCHA'
415 cmsSigMCHBData = 0x4D434842, // 'MCHB'
416 cmsSigMCHCData = 0x4D434843, // 'MCHC'
417 cmsSigMCHDData = 0x4D434844, // 'MCHD'
418 cmsSigMCHEData = 0x4D434845, // 'MCHE'
419 cmsSigMCHFData = 0x4D434846, // 'MCHF'
420 cmsSigNamedData = 0x6e6d636c, // 'nmcl'
421 cmsSig1colorData = 0x31434C52, // '1CLR'
422 cmsSig2colorData = 0x32434C52, // '2CLR'
423 cmsSig3colorData = 0x33434C52, // '3CLR'
424 cmsSig4colorData = 0x34434C52, // '4CLR'
425 cmsSig5colorData = 0x35434C52, // '5CLR'
426 cmsSig6colorData = 0x36434C52, // '6CLR'
427 cmsSig7colorData = 0x37434C52, // '7CLR'
428 cmsSig8colorData = 0x38434C52, // '8CLR'
429 cmsSig9colorData = 0x39434C52, // '9CLR'
430 cmsSig10colorData = 0x41434C52, // 'ACLR'
431 cmsSig11colorData = 0x42434C52, // 'BCLR'
432 cmsSig12colorData = 0x43434C52, // 'CCLR'
433 cmsSig13colorData = 0x44434C52, // 'DCLR'
434 cmsSig14colorData = 0x45434C52, // 'ECLR'
435 cmsSig15colorData = 0x46434C52, // 'FCLR'
436 cmsSigLuvKData = 0x4C75764B // 'LuvK'
438 } cmsColorSpaceSignature;
442 cmsSigInputClass = 0x73636E72, // 'scnr'
443 cmsSigDisplayClass = 0x6D6E7472, // 'mntr'
444 cmsSigOutputClass = 0x70727472, // 'prtr'
445 cmsSigLinkClass = 0x6C696E6B, // 'link'
446 cmsSigAbstractClass = 0x61627374, // 'abst'
447 cmsSigColorSpaceClass = 0x73706163, // 'spac'
448 cmsSigNamedColorClass = 0x6e6d636c // 'nmcl'
450 } cmsProfileClassSignature;
454 cmsSigMacintosh = 0x4150504C, // 'APPL'
455 cmsSigMicrosoft = 0x4D534654, // 'MSFT'
456 cmsSigSolaris = 0x53554E57, // 'SUNW'
457 cmsSigSGI = 0x53474920, // 'SGI '
458 cmsSigTaligent = 0x54474E54, // 'TGNT'
459 cmsSigUnices = 0x2A6E6978 // '*nix' // From argyll -- Not official
461 } cmsPlatformSignature;
464 #define cmsSigPerceptualReferenceMediumGamut 0x70726d67 //'prmg'
466 // For cmsSigColorimetricIntentImageStateTag
467 #define cmsSigSceneColorimetryEstimates 0x73636F65 //'scoe'
468 #define cmsSigSceneAppearanceEstimates 0x73617065 //'sape'
469 #define cmsSigFocalPlaneColorimetryEstimates 0x66706365 //'fpce'
470 #define cmsSigReflectionHardcopyOriginalColorimetry 0x72686F63 //'rhoc'
471 #define cmsSigReflectionPrintOutputColorimetry 0x72706F63 //'rpoc'
473 // Multi process elements types
475 cmsSigCurveSetElemType = 0x63767374, //'cvst'
476 cmsSigMatrixElemType = 0x6D617466, //'matf'
477 cmsSigCLutElemType = 0x636C7574, //'clut'
479 cmsSigBAcsElemType = 0x62414353, // 'bACS'
480 cmsSigEAcsElemType = 0x65414353, // 'eACS'
482 // Custom from here, not in the ICC Spec
483 cmsSigXYZ2LabElemType = 0x6C327820, // 'l2x '
484 cmsSigLab2XYZElemType = 0x78326C20, // 'x2l '
485 cmsSigNamedColorElemType = 0x6E636C20, // 'ncl '
486 cmsSigLabV2toV4 = 0x32203420, // '2 4 '
487 cmsSigLabV4toV2 = 0x34203220, // '4 2 '
490 cmsSigIdentityElemType = 0x69646E20 // 'idn '
494 // Types of CurveElements
497 cmsSigFormulaCurveSeg = 0x70617266, // 'parf'
498 cmsSigSampledCurveSeg = 0x73616D66, // 'samf'
499 cmsSigSegmentedCurve = 0x63757266 // 'curf'
501 } cmsCurveSegSignature;
503 // Used in ResponseCurveType
504 #define cmsSigStatusA 0x53746141 //'StaA'
505 #define cmsSigStatusE 0x53746145 //'StaE'
506 #define cmsSigStatusI 0x53746149 //'StaI'
507 #define cmsSigStatusT 0x53746154 //'StaT'
508 #define cmsSigStatusM 0x5374614D //'StaM'
509 #define cmsSigDN 0x444E2020 //'DN '
510 #define cmsSigDNP 0x444E2050 //'DN P'
511 #define cmsSigDNN 0x444E4E20 //'DNN '
512 #define cmsSigDNNP 0x444E4E50 //'DNNP'
514 // Device attributes, currently defined values correspond to the low 4 bytes
515 // of the 8 byte attribute quantity
516 #define cmsReflective 0
517 #define cmsTransparency 1
521 // Common structures in ICC tags
524 cmsUInt32Number flag;
525 cmsUInt8Number data[1];
531 cmsUInt16Number year;
532 cmsUInt16Number month;
534 cmsUInt16Number hours;
535 cmsUInt16Number minutes;
536 cmsUInt16Number seconds;
542 cmsS15Fixed16Number X;
543 cmsS15Fixed16Number Y;
544 cmsS15Fixed16Number Z;
546 } cmsEncodedXYZNumber;
549 // Profile ID as computed by MD5 algorithm
551 cmsUInt8Number ID8[16];
552 cmsUInt16Number ID16[8];
553 cmsUInt32Number ID32[4];
558 // ----------------------------------------------------------------------------------------------
559 // ICC profile internal base types. Strictly, shouldn't be declared in this header, but maybe
560 // somebody want to use this info for accessing profile header directly, so here it is.
562 // Profile header -- it is 32-bit aligned, so no issues are expected on alignment
564 cmsUInt32Number size; // Profile size in bytes
565 cmsSignature cmmId; // CMM for this profile
566 cmsUInt32Number version; // Format version number
567 cmsProfileClassSignature deviceClass; // Type of profile
568 cmsColorSpaceSignature colorSpace; // Color space of data
569 cmsColorSpaceSignature pcs; // PCS, XYZ or Lab only
570 cmsDateTimeNumber date; // Date profile was created
571 cmsSignature magic; // Magic Number to identify an ICC profile
572 cmsPlatformSignature platform; // Primary Platform
573 cmsUInt32Number flags; // Various bit settings
574 cmsSignature manufacturer; // Device manufacturer
575 cmsUInt32Number model; // Device model number
576 cmsUInt64Number attributes; // Device attributes
577 cmsUInt32Number renderingIntent;// Rendering intent
578 cmsEncodedXYZNumber illuminant; // Profile illuminant
579 cmsSignature creator; // Profile creator
580 cmsProfileID profileID; // Profile ID using MD5
581 cmsInt8Number reserved[28]; // Reserved for future use
587 cmsTagTypeSignature sig;
588 cmsInt8Number reserved[4];
592 // A tag entry in directory
594 cmsTagSignature sig; // The tag signature
595 cmsUInt32Number offset; // Start of tag
596 cmsUInt32Number size; // Size in bytes
600 // ----------------------------------------------------------------------------------------------
602 // Little CMS specific typedefs
604 typedef void* cmsContext; // Context identifier for multithreaded environments
605 typedef void* cmsHANDLE ; // Generic handle
606 typedef void* cmsHPROFILE; // Opaque typedefs to hide internals
607 typedef void* cmsHTRANSFORM;
609 #define cmsMAXCHANNELS 16 // Maximum number of channels in ICC profiles
611 // Format of pixel is defined by one cmsUInt32Number, using bit fields as follows
614 // 3 2 10987 6 5 4 3 2 1 098 7654 321
615 // A O TTTTT U Y F P X S EEE CCCC BBB
617 // A: Floating point -- With this flag we can differentiate 16 bits as float and as int
618 // O: Optimized -- previous optimization already returns the final 8-bit value
620 // F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
621 // P: Planar? 0=Chunky, 1=Planar
622 // X: swap 16 bps endianess?
623 // S: Do swap? ie, BGR, KYMC
625 // C: Channels (Samples per pixel)
626 // B: bytes per sample
627 // Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
629 #define FLOAT_SH(a) ((a) << 22)
630 #define OPTIMIZED_SH(s) ((s) << 21)
631 #define COLORSPACE_SH(s) ((s) << 16)
632 #define SWAPFIRST_SH(s) ((s) << 14)
633 #define FLAVOR_SH(s) ((s) << 13)
634 #define PLANAR_SH(p) ((p) << 12)
635 #define ENDIAN16_SH(e) ((e) << 11)
636 #define DOSWAP_SH(e) ((e) << 10)
637 #define EXTRA_SH(e) ((e) << 7)
638 #define CHANNELS_SH(c) ((c) << 3)
639 #define BYTES_SH(b) (b)
641 // These macros unpack format specifiers into integers
642 #define T_FLOAT(a) (((a)>>22)&1)
643 #define T_OPTIMIZED(o) (((o)>>21)&1)
644 #define T_COLORSPACE(s) (((s)>>16)&31)
645 #define T_SWAPFIRST(s) (((s)>>14)&1)
646 #define T_FLAVOR(s) (((s)>>13)&1)
647 #define T_PLANAR(p) (((p)>>12)&1)
648 #define T_ENDIAN16(e) (((e)>>11)&1)
649 #define T_DOSWAP(e) (((e)>>10)&1)
650 #define T_EXTRA(e) (((e)>>7)&7)
651 #define T_CHANNELS(c) (((c)>>3)&15)
652 #define T_BYTES(b) ((b)&7)
656 #define PT_ANY 0 // Don't check colorspace
657 // 1 & 2 are reserved
663 #define PT_YUV 8 // Lu'v'
666 #define PT_YUVK 11 // Lu'v'K
687 #define PT_LabV2 30 // Identical to PT_Lab, but using the V2 old encoding
689 // Some (not all!) representations
691 #ifndef TYPE_RGB_8 // TYPE_RGB_8 is a very common identifier, so don't include ours
692 // if user has it already defined.
694 #define TYPE_GRAY_8 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1))
695 #define TYPE_GRAY_8_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1))
696 #define TYPE_GRAY_16 (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
697 #define TYPE_GRAY_16_REV (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1))
698 #define TYPE_GRAY_16_SE (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
699 #define TYPE_GRAYA_8 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1))
700 #define TYPE_GRAYA_16 (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2))
701 #define TYPE_GRAYA_16_SE (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
702 #define TYPE_GRAYA_8_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PLANAR_SH(1))
703 #define TYPE_GRAYA_16_PLANAR (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1))
705 #define TYPE_RGB_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1))
706 #define TYPE_RGB_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
707 #define TYPE_BGR_8 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
708 #define TYPE_BGR_8_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
709 #define TYPE_RGB_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
710 #define TYPE_RGB_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
711 #define TYPE_RGB_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
712 #define TYPE_BGR_16 (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
713 #define TYPE_BGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
714 #define TYPE_BGR_16_SE (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
716 #define TYPE_RGBA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1))
717 #define TYPE_RGBA_8_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
718 #define TYPE_RGBA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
719 #define TYPE_RGBA_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
720 #define TYPE_RGBA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
722 #define TYPE_ARGB_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1))
723 #define TYPE_ARGB_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
725 #define TYPE_ABGR_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
726 #define TYPE_ABGR_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
727 #define TYPE_ABGR_16_PLANAR (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
728 #define TYPE_ABGR_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
730 #define TYPE_BGRA_8 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
731 #define TYPE_BGRA_16 (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
732 #define TYPE_BGRA_16_SE (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
734 #define TYPE_CMY_8 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1))
735 #define TYPE_CMY_8_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
736 #define TYPE_CMY_16 (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2))
737 #define TYPE_CMY_16_PLANAR (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
738 #define TYPE_CMY_16_SE (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
740 #define TYPE_CMYK_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1))
741 #define TYPE_CMYKA_8 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1))
742 #define TYPE_CMYK_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1))
743 #define TYPE_YUVK_8 TYPE_CMYK_8_REV
744 #define TYPE_CMYK_8_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|PLANAR_SH(1))
745 #define TYPE_CMYK_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
746 #define TYPE_CMYK_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1))
747 #define TYPE_YUVK_16 TYPE_CMYK_16_REV
748 #define TYPE_CMYK_16_PLANAR (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|PLANAR_SH(1))
749 #define TYPE_CMYK_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1))
751 #define TYPE_KYMC_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1))
752 #define TYPE_KYMC_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1))
753 #define TYPE_KYMC_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
755 #define TYPE_KCMY_8 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1))
756 #define TYPE_KCMY_8_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
757 #define TYPE_KCMY_16 (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1))
758 #define TYPE_KCMY_16_REV (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
759 #define TYPE_KCMY_16_SE (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
761 #define TYPE_CMYK5_8 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1))
762 #define TYPE_CMYK5_16 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2))
763 #define TYPE_CMYK5_16_SE (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|ENDIAN16_SH(1))
764 #define TYPE_KYMC5_8 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1)|DOSWAP_SH(1))
765 #define TYPE_KYMC5_16 (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1))
766 #define TYPE_KYMC5_16_SE (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
767 #define TYPE_CMYK6_8 (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1))
768 #define TYPE_CMYK6_8_PLANAR (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1)|PLANAR_SH(1))
769 #define TYPE_CMYK6_16 (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2))
770 #define TYPE_CMYK6_16_PLANAR (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|PLANAR_SH(1))
771 #define TYPE_CMYK6_16_SE (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|ENDIAN16_SH(1))
772 #define TYPE_CMYK7_8 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1))
773 #define TYPE_CMYK7_16 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2))
774 #define TYPE_CMYK7_16_SE (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|ENDIAN16_SH(1))
775 #define TYPE_KYMC7_8 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1)|DOSWAP_SH(1))
776 #define TYPE_KYMC7_16 (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1))
777 #define TYPE_KYMC7_16_SE (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
778 #define TYPE_CMYK8_8 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1))
779 #define TYPE_CMYK8_16 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2))
780 #define TYPE_CMYK8_16_SE (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|ENDIAN16_SH(1))
781 #define TYPE_KYMC8_8 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1)|DOSWAP_SH(1))
782 #define TYPE_KYMC8_16 (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1))
783 #define TYPE_KYMC8_16_SE (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
784 #define TYPE_CMYK9_8 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1))
785 #define TYPE_CMYK9_16 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2))
786 #define TYPE_CMYK9_16_SE (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|ENDIAN16_SH(1))
787 #define TYPE_KYMC9_8 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1)|DOSWAP_SH(1))
788 #define TYPE_KYMC9_16 (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1))
789 #define TYPE_KYMC9_16_SE (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
790 #define TYPE_CMYK10_8 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1))
791 #define TYPE_CMYK10_16 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2))
792 #define TYPE_CMYK10_16_SE (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|ENDIAN16_SH(1))
793 #define TYPE_KYMC10_8 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1)|DOSWAP_SH(1))
794 #define TYPE_KYMC10_16 (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1))
795 #define TYPE_KYMC10_16_SE (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
796 #define TYPE_CMYK11_8 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1))
797 #define TYPE_CMYK11_16 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2))
798 #define TYPE_CMYK11_16_SE (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|ENDIAN16_SH(1))
799 #define TYPE_KYMC11_8 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1)|DOSWAP_SH(1))
800 #define TYPE_KYMC11_16 (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1))
801 #define TYPE_KYMC11_16_SE (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
802 #define TYPE_CMYK12_8 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1))
803 #define TYPE_CMYK12_16 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2))
804 #define TYPE_CMYK12_16_SE (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|ENDIAN16_SH(1))
805 #define TYPE_KYMC12_8 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1)|DOSWAP_SH(1))
806 #define TYPE_KYMC12_16 (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1))
807 #define TYPE_KYMC12_16_SE (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
810 #define TYPE_XYZ_16 (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2))
811 #define TYPE_Lab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1))
812 #define TYPE_LabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1))
814 #define TYPE_ALab_8 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|DOSWAP_SH(1))
815 #define TYPE_ALabV2_8 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|DOSWAP_SH(1))
816 #define TYPE_Lab_16 (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2))
817 #define TYPE_LabV2_16 (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(2))
818 #define TYPE_Yxy_16 (COLORSPACE_SH(PT_Yxy)|CHANNELS_SH(3)|BYTES_SH(2))
821 #define TYPE_YCbCr_8 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1))
822 #define TYPE_YCbCr_8_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
823 #define TYPE_YCbCr_16 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2))
824 #define TYPE_YCbCr_16_PLANAR (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
825 #define TYPE_YCbCr_16_SE (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
828 #define TYPE_YUV_8 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1))
829 #define TYPE_YUV_8_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
830 #define TYPE_YUV_16 (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2))
831 #define TYPE_YUV_16_PLANAR (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
832 #define TYPE_YUV_16_SE (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
835 #define TYPE_HLS_8 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1))
836 #define TYPE_HLS_8_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
837 #define TYPE_HLS_16 (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2))
838 #define TYPE_HLS_16_PLANAR (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
839 #define TYPE_HLS_16_SE (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
842 #define TYPE_HSV_8 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1))
843 #define TYPE_HSV_8_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
844 #define TYPE_HSV_16 (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2))
845 #define TYPE_HSV_16_PLANAR (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
846 #define TYPE_HSV_16_SE (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
848 // Named color index. Only 16 bits allowed (don't check colorspace)
849 #define TYPE_NAMED_COLOR_INDEX (CHANNELS_SH(1)|BYTES_SH(2))
852 #define TYPE_XYZ_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(4))
853 #define TYPE_XYZA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
854 #define TYPE_Lab_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(4))
855 #define TYPE_LabA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
856 #define TYPE_GRAY_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4))
857 #define TYPE_RGB_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4))
858 #define TYPE_RGBA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
859 #define TYPE_CMYK_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
861 // Floating point formatters.
862 // NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
863 #define TYPE_XYZ_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
864 #define TYPE_Lab_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
865 #define TYPE_GRAY_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
866 #define TYPE_RGB_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
867 #define TYPE_CMYK_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))
921 // Illuminant types for structs below
922 #define cmsILLUMINANT_TYPE_UNKNOWN 0x0000000
923 #define cmsILLUMINANT_TYPE_D50 0x0000001
924 #define cmsILLUMINANT_TYPE_D65 0x0000002
925 #define cmsILLUMINANT_TYPE_D93 0x0000003
926 #define cmsILLUMINANT_TYPE_F2 0x0000004
927 #define cmsILLUMINANT_TYPE_D55 0x0000005
928 #define cmsILLUMINANT_TYPE_A 0x0000006
929 #define cmsILLUMINANT_TYPE_E 0x0000007
930 #define cmsILLUMINANT_TYPE_F8 0x0000008
933 cmsUInt32Number Observer; // 0 = unknown, 1=CIE 1931, 2=CIE 1964
934 cmsCIEXYZ Backing; // Value of backing
935 cmsUInt32Number Geometry; // 0=unknown, 1=45/0, 0/45 2=0d, d/0
936 cmsFloat64Number Flare; // 0..1.0
937 cmsUInt32Number IlluminantType;
939 } cmsICCMeasurementConditions;
942 cmsCIEXYZ IlluminantXYZ; // Not the same struct as CAM02,
943 cmsCIEXYZ SurroundXYZ; // This is for storing the tag
944 cmsUInt32Number IlluminantType; // viewing condition
946 } cmsICCViewingConditions;
948 // Support of non-standard functions --------------------------------------------------------------------------------------
950 CMSAPI int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
951 CMSAPI long int CMSEXPORT cmsfilelength(FILE* f);
953 // Plug-In registering ---------------------------------------------------------------------------------------------------
955 CMSAPI cmsBool CMSEXPORT cmsPlugin(void* Plugin);
956 CMSAPI void CMSEXPORT cmsUnregisterPlugins(void);
958 // Error logging ----------------------------------------------------------------------------------------------------------
960 // There is no error handling at all. When a function fails, it returns proper value.
961 // For example, all create functions does return NULL on failure. Other may return FALSE.
962 // It may be interesting, for the developer, to know why the function is failing.
963 // for that reason, lcms2 does offer a logging function. This function will get
964 // an ENGLISH string with some clues on what is going wrong. You can show this
965 // info to the end user if you wish, or just create some sort of log on disk.
966 // The logging function should NOT terminate the program, as this obviously can leave
967 // unfreed resources. It is the programmer's responsibility to check each function
968 // return code to make sure it didn't fail.
970 #define cmsERROR_UNDEFINED 0
971 #define cmsERROR_FILE 1
972 #define cmsERROR_RANGE 2
973 #define cmsERROR_INTERNAL 3
974 #define cmsERROR_NULL 4
975 #define cmsERROR_READ 5
976 #define cmsERROR_SEEK 6
977 #define cmsERROR_WRITE 7
978 #define cmsERROR_UNKNOWN_EXTENSION 8
979 #define cmsERROR_COLORSPACE_CHECK 9
980 #define cmsERROR_ALREADY_DEFINED 10
981 #define cmsERROR_BAD_SIGNATURE 11
982 #define cmsERROR_CORRUPTION_DETECTED 12
983 #define cmsERROR_NOT_SUITABLE 13
985 // Error logger is called with the ContextID when a message is raised. This gives the
986 // chance to know which thread is responsible of the warning and any environment associated
987 // with it. Non-multithreading applications may safely ignore this parameter.
988 // Note that under certain special circumstances, ContextID may be NULL.
989 typedef void (* cmsLogErrorHandlerFunction)(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text);
991 // Allows user to set any specific logger
992 CMSAPI void CMSEXPORT cmsSetLogErrorHandler(cmsLogErrorHandlerFunction Fn);
994 // Conversions --------------------------------------------------------------------------------------------------------------
996 // Returns pointers to constant structs
997 CMSAPI const cmsCIEXYZ* CMSEXPORT cmsD50_XYZ(void);
998 CMSAPI const cmsCIExyY* CMSEXPORT cmsD50_xyY(void);
1000 // Colorimetric space conversions
1001 CMSAPI void CMSEXPORT cmsXYZ2xyY(cmsCIExyY* Dest, const cmsCIEXYZ* Source);
1002 CMSAPI void CMSEXPORT cmsxyY2XYZ(cmsCIEXYZ* Dest, const cmsCIExyY* Source);
1003 CMSAPI void CMSEXPORT cmsXYZ2Lab(const cmsCIEXYZ* WhitePoint, cmsCIELab* Lab, const cmsCIEXYZ* xyz);
1004 CMSAPI void CMSEXPORT cmsLab2XYZ(const cmsCIEXYZ* WhitePoint, cmsCIEXYZ* xyz, const cmsCIELab* Lab);
1005 CMSAPI void CMSEXPORT cmsLab2LCh(cmsCIELCh*LCh, const cmsCIELab* Lab);
1006 CMSAPI void CMSEXPORT cmsLCh2Lab(cmsCIELab* Lab, const cmsCIELCh* LCh);
1008 // Encoding /Decoding on PCS
1009 CMSAPI void CMSEXPORT cmsLabEncoded2Float(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1010 CMSAPI void CMSEXPORT cmsLabEncoded2FloatV2(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1011 CMSAPI void CMSEXPORT cmsFloat2LabEncoded(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1012 CMSAPI void CMSEXPORT cmsFloat2LabEncodedV2(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1013 CMSAPI void CMSEXPORT cmsXYZEncoded2Float(cmsCIEXYZ* fxyz, const cmsUInt16Number XYZ[3]);
1014 CMSAPI void CMSEXPORT cmsFloat2XYZEncoded(cmsUInt16Number XYZ[3], const cmsCIEXYZ* fXYZ);
1017 CMSAPI cmsFloat64Number CMSEXPORT cmsDeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1018 CMSAPI cmsFloat64Number CMSEXPORT cmsCIE94DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1019 CMSAPI cmsFloat64Number CMSEXPORT cmsBFDdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1020 CMSAPI cmsFloat64Number CMSEXPORT cmsCMCdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number l, cmsFloat64Number c);
1021 CMSAPI cmsFloat64Number CMSEXPORT cmsCIE2000DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number Kl, cmsFloat64Number Kc, cmsFloat64Number Kh);
1023 // Temperature <-> Chromaticity (Black body)
1024 CMSAPI cmsBool CMSEXPORT cmsWhitePointFromTemp(cmsCIExyY* WhitePoint, cmsFloat64Number TempK);
1025 CMSAPI cmsBool CMSEXPORT cmsTempFromWhitePoint(cmsFloat64Number* TempK, const cmsCIExyY* WhitePoint);
1027 // Chromatic adaptation
1028 CMSAPI cmsBool CMSEXPORT cmsAdaptToIlluminant(cmsCIEXYZ* Result, const cmsCIEXYZ* SourceWhitePt,
1029 const cmsCIEXYZ* Illuminant,
1030 const cmsCIEXYZ* Value);
1032 // CIECAM02 ---------------------------------------------------------------------------------------------------
1034 // Viewing conditions. Please note those are CAM model viewing conditions, and not the ICC tag viewing
1035 // conditions, which I'm naming cmsICCViewingConditions to make differences evident. Unfortunately, the tag
1036 // cannot deal with surround La, Yb and D value so is basically useless to store CAM02 viewing conditions.
1039 #define AVG_SURROUND 1
1040 #define DIM_SURROUND 2
1041 #define DARK_SURROUND 3
1042 #define CUTSHEET_SURROUND 4
1044 #define D_CALCULATE (-1)
1047 cmsCIEXYZ whitePoint;
1048 cmsFloat64Number Yb;
1049 cmsFloat64Number La;
1051 cmsFloat64Number D_value;
1053 } cmsViewingConditions;
1055 CMSAPI cmsHANDLE CMSEXPORT cmsCIECAM02Init(cmsContext ContextID, const cmsViewingConditions* pVC);
1056 CMSAPI void CMSEXPORT cmsCIECAM02Done(cmsHANDLE hModel);
1057 CMSAPI void CMSEXPORT cmsCIECAM02Forward(cmsHANDLE hModel, const cmsCIEXYZ* pIn, cmsJCh* pOut);
1058 CMSAPI void CMSEXPORT cmsCIECAM02Reverse(cmsHANDLE hModel, const cmsJCh* pIn, cmsCIEXYZ* pOut);
1061 // Tone curves -----------------------------------------------------------------------------------------
1063 // This describes a curve segment. For a table of supported types, see the manual. User can increase the number of
1064 // available types by using a proper plug-in. Parametric segments allow 10 parameters at most
1067 cmsFloat32Number x0, x1; // Domain; for x0 < x <= x1
1068 cmsInt32Number Type; // Parametric type, Type == 0 means sampled segment. Negative values are reserved
1069 cmsFloat64Number Params[10]; // Parameters if Type != 0
1070 cmsUInt32Number nGridPoints; // Number of grid points if Type == 0
1071 cmsFloat32Number* SampledPoints; // Points to an array of floats if Type == 0
1075 // The internal representation is none of your business.
1076 typedef struct _cms_curve_struct cmsToneCurve;
1078 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsInt32Number nSegments, const cmsCurveSegment Segments[]);
1079 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1080 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1081 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsInt32Number nEntries, const cmsUInt16Number values[]);
1082 CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1083 CMSAPI void CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1084 CMSAPI void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1085 CMSAPI cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1086 CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1087 CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsInt32Number nResultSamples, const cmsToneCurve* InGamma);
1088 CMSAPI cmsToneCurve* CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X, const cmsToneCurve* Y, cmsUInt32Number nPoints);
1089 CMSAPI cmsBool CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1090 CMSAPI cmsFloat32Number CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1091 CMSAPI cmsUInt16Number CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1092 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1093 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1094 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1095 CMSAPI cmsBool CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1096 CMSAPI cmsInt32Number CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1097 CMSAPI cmsFloat64Number CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1100 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1102 // Nothing to see here, move along
1103 typedef struct _cmsPipeline_struct cmsPipeline;
1104 typedef struct _cmsStage_struct cmsStage;
1106 // Those are hi-level pipelines
1107 CMSAPI cmsPipeline* CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1108 CMSAPI void CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1109 CMSAPI cmsPipeline* CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1111 CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1112 CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);
1114 CMSAPI cmsUInt32Number CMSEXPORT cmsPipelineStageCount(const cmsPipeline* lut);
1115 CMSAPI cmsStage* CMSEXPORT cmsPipelineGetPtrToFirstStage(const cmsPipeline* lut);
1116 CMSAPI cmsStage* CMSEXPORT cmsPipelineGetPtrToLastStage(const cmsPipeline* lut);
1118 CMSAPI void CMSEXPORT cmsPipelineEval16(const cmsUInt16Number In[], cmsUInt16Number Out[], const cmsPipeline* lut);
1119 CMSAPI void CMSEXPORT cmsPipelineEvalFloat(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsPipeline* lut);
1120 CMSAPI cmsBool CMSEXPORT cmsPipelineEvalReverseFloat(cmsFloat32Number Target[], cmsFloat32Number Result[], cmsFloat32Number Hint[], const cmsPipeline* lut);
1121 CMSAPI cmsBool CMSEXPORT cmsPipelineCat(cmsPipeline* l1, const cmsPipeline* l2);
1122 CMSAPI cmsBool CMSEXPORT cmsPipelineSetSaveAs8bitsFlag(cmsPipeline* lut, cmsBool On);
1124 // Where to place/locate the stages in the pipeline chain
1125 typedef enum { cmsAT_BEGIN, cmsAT_END } cmsStageLoc;
1127 CMSAPI void CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage* mpe);
1128 CMSAPI void CMSEXPORT cmsPipelineUnlinkStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage** mpe);
1130 // This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements
1131 // that conform the Pipeline. It should be called with the Pipeline, the number of expected elements and
1132 // then a list of expected types followed with a list of double pointers to Stage elements. If
1133 // the function founds a match with current pipeline, it fills the pointers and returns TRUE
1134 // if not, returns FALSE without touching anything.
1135 CMSAPI cmsBool CMSEXPORT cmsPipelineCheckAndRetreiveStages(const cmsPipeline* Lut, cmsUInt32Number n, ...);
1137 // Matrix has double precision and CLUT has only float precision. That is because an ICC profile can encode
1138 // matrices with far more precision that CLUTS
1139 CMSAPI cmsStage* CMSEXPORT cmsStageAllocIdentity(cmsContext ContextID, cmsUInt32Number nChannels);
1140 CMSAPI cmsStage* CMSEXPORT cmsStageAllocToneCurves(cmsContext ContextID, cmsUInt32Number nChannels, cmsToneCurve* const Curves[]);
1141 CMSAPI cmsStage* CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number Rows, cmsUInt32Number Cols, const cmsFloat64Number* Matrix, const cmsFloat64Number* Offset);
1143 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLut16bit(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1144 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLutFloat(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1146 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1147 CMSAPI cmsStage* CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1149 CMSAPI cmsStage* CMSEXPORT cmsStageDup(cmsStage* mpe);
1150 CMSAPI void CMSEXPORT cmsStageFree(cmsStage* mpe);
1151 CMSAPI cmsStage* CMSEXPORT cmsStageNext(const cmsStage* mpe);
1153 CMSAPI cmsUInt32Number CMSEXPORT cmsStageInputChannels(const cmsStage* mpe);
1154 CMSAPI cmsUInt32Number CMSEXPORT cmsStageOutputChannels(const cmsStage* mpe);
1155 CMSAPI cmsStageSignature CMSEXPORT cmsStageType(const cmsStage* mpe);
1156 CMSAPI void* CMSEXPORT cmsStageData(const cmsStage* mpe);
1159 typedef cmsInt32Number (* cmsSAMPLER16) (register const cmsUInt16Number In[],
1160 register cmsUInt16Number Out[],
1161 register void * Cargo);
1163 typedef cmsInt32Number (* cmsSAMPLERFLOAT)(register const cmsFloat32Number In[],
1164 register cmsFloat32Number Out[],
1165 register void * Cargo);
1167 // Use this flag to prevent changes being written to destination
1168 #define SAMPLER_INSPECT 0x01000000
1171 CMSAPI cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1172 CMSAPI cmsBool CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1176 CMSAPI cmsBool CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1177 cmsSAMPLER16 Sampler, void * Cargo);
1179 CMSAPI cmsBool CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1180 cmsSAMPLERFLOAT Sampler, void * Cargo);
1182 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1184 typedef struct _cms_MLU_struct cmsMLU;
1186 #define cmsNoLanguage "\0\0"
1187 #define cmsNoCountry "\0\0"
1189 CMSAPI cmsMLU* CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems);
1190 CMSAPI void CMSEXPORT cmsMLUfree(cmsMLU* mlu);
1191 CMSAPI cmsMLU* CMSEXPORT cmsMLUdup(const cmsMLU* mlu);
1193 CMSAPI cmsBool CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu,
1194 const char LanguageCode[3], const char CountryCode[3],
1195 const char* ASCIIString);
1196 CMSAPI cmsBool CMSEXPORT cmsMLUsetWide(cmsMLU* mlu,
1197 const char LanguageCode[3], const char CountryCode[3],
1198 const wchar_t* WideString);
1200 CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
1201 const char LanguageCode[3], const char CountryCode[3],
1202 char* Buffer, cmsUInt32Number BufferSize);
1204 CMSAPI cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
1205 const char LanguageCode[3], const char CountryCode[3],
1206 wchar_t* Buffer, cmsUInt32Number BufferSize);
1208 CMSAPI cmsBool CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
1209 const char LanguageCode[3], const char CountryCode[3],
1210 char ObtainedLanguage[3], char ObtainedCountry[3]);
1212 // Undercolorremoval & black generation -------------------------------------------------------------------------------------
1221 // Screening ----------------------------------------------------------------------------------------------------------------
1223 #define cmsPRINTER_DEFAULT_SCREENS 0x0001
1224 #define cmsFREQUENCE_UNITS_LINES_CM 0x0000
1225 #define cmsFREQUENCE_UNITS_LINES_INCH 0x0002
1227 #define cmsSPOT_UNKNOWN 0
1228 #define cmsSPOT_PRINTER_DEFAULT 1
1229 #define cmsSPOT_ROUND 2
1230 #define cmsSPOT_DIAMOND 3
1231 #define cmsSPOT_ELLIPSE 4
1232 #define cmsSPOT_LINE 5
1233 #define cmsSPOT_SQUARE 6
1234 #define cmsSPOT_CROSS 7
1237 cmsFloat64Number Frequency;
1238 cmsFloat64Number ScreenAngle;
1239 cmsUInt32Number SpotShape;
1241 } cmsScreeningChannel;
1244 cmsUInt32Number Flag;
1245 cmsUInt32Number nChannels;
1246 cmsScreeningChannel Channels[cmsMAXCHANNELS];
1251 // Named color -----------------------------------------------------------------------------------------------------------------
1253 typedef struct _cms_NAMEDCOLORLIST_struct cmsNAMEDCOLORLIST;
1255 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsContext ContextID,
1257 cmsUInt32Number ColorantCount,
1258 const char* Prefix, const char* Suffix);
1260 CMSAPI void CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v);
1261 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v);
1262 CMSAPI cmsBool CMSEXPORT cmsAppendNamedColor(cmsNAMEDCOLORLIST* v, const char* Name,
1263 cmsUInt16Number PCS[3],
1264 cmsUInt16Number Colorant[cmsMAXCHANNELS]);
1266 CMSAPI cmsUInt32Number CMSEXPORT cmsNamedColorCount(const cmsNAMEDCOLORLIST* v);
1267 CMSAPI cmsInt32Number CMSEXPORT cmsNamedColorIndex(const cmsNAMEDCOLORLIST* v, const char* Name);
1269 CMSAPI cmsBool CMSEXPORT cmsNamedColorInfo(const cmsNAMEDCOLORLIST* NamedColorList, cmsUInt32Number nColor,
1273 cmsUInt16Number* PCS,
1274 cmsUInt16Number* Colorant);
1276 // Retrieve named color list from transform
1277 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsGetNamedColorList(cmsHTRANSFORM xform);
1279 // Profile sequence -----------------------------------------------------------------------------------------------------
1281 // Profile sequence descriptor. Some fields come from profile sequence descriptor tag, others
1282 // come from Profile Sequence Identifier Tag
1284 cmsSignature deviceMfg;
1285 cmsSignature deviceModel;
1286 cmsUInt64Number attributes;
1287 cmsTechnologySignature technology;
1288 cmsProfileID ProfileID;
1289 cmsMLU* Manufacturer;
1291 cmsMLU* Description;
1298 cmsContext ContextID;
1303 CMSAPI cmsSEQ* CMSEXPORT cmsAllocProfileSequenceDescription(cmsContext ContextID, cmsUInt32Number n);
1304 CMSAPI cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq);
1305 CMSAPI void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq);
1307 // Dictionaries --------------------------------------------------------------------------------------------------------
1309 typedef struct _cmsDICTentry_struct {
1311 struct _cmsDICTentry_struct* Next;
1313 cmsMLU *DisplayName;
1314 cmsMLU *DisplayValue;
1320 CMSAPI cmsHANDLE CMSEXPORT cmsDictAlloc(cmsContext ContextID);
1321 CMSAPI void CMSEXPORT cmsDictFree(cmsHANDLE hDict);
1322 CMSAPI cmsHANDLE CMSEXPORT cmsDictDup(cmsHANDLE hDict);
1324 CMSAPI cmsBool CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue);
1325 CMSAPI const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict);
1326 CMSAPI const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e);
1328 // Access to Profile data ----------------------------------------------------------------------------------------------
1329 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateProfilePlaceholder(cmsContext ContextID);
1331 CMSAPI cmsContext CMSEXPORT cmsGetProfileContextID(cmsHPROFILE hProfile);
1332 CMSAPI cmsInt32Number CMSEXPORT cmsGetTagCount(cmsHPROFILE hProfile);
1333 CMSAPI cmsTagSignature CMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, cmsUInt32Number n);
1334 CMSAPI cmsBool CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1336 // Read and write pre-formatted data
1337 CMSAPI void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1338 CMSAPI cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data);
1339 CMSAPI cmsBool CMSEXPORT cmsLinkTag(cmsHPROFILE hProfile, cmsTagSignature sig, cmsTagSignature dest);
1340 CMSAPI cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig);
1342 // Read and write raw data
1343 CMSAPI cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize);
1344 CMSAPI cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size);
1346 // Access header data
1347 #define cmsEmbeddedProfileFalse 0x00000000
1348 #define cmsEmbeddedProfileTrue 0x00000001
1349 #define cmsUseAnywhere 0x00000000
1350 #define cmsUseWithEmbeddedDataOnly 0x00000002
1352 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderFlags(cmsHPROFILE hProfile);
1353 CMSAPI void CMSEXPORT cmsGetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number* Flags);
1354 CMSAPI void CMSEXPORT cmsGetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1355 CMSAPI cmsBool CMSEXPORT cmsGetHeaderCreationDateTime(cmsHPROFILE hProfile, struct tm *Dest);
1356 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderRenderingIntent(cmsHPROFILE hProfile);
1358 CMSAPI void CMSEXPORT cmsSetHeaderFlags(cmsHPROFILE hProfile, cmsUInt32Number Flags);
1359 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderManufacturer(cmsHPROFILE hProfile);
1360 CMSAPI void CMSEXPORT cmsSetHeaderManufacturer(cmsHPROFILE hProfile, cmsUInt32Number manufacturer);
1361 CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderModel(cmsHPROFILE hProfile);
1362 CMSAPI void CMSEXPORT cmsSetHeaderModel(cmsHPROFILE hProfile, cmsUInt32Number model);
1363 CMSAPI void CMSEXPORT cmsSetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number Flags);
1364 CMSAPI void CMSEXPORT cmsSetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1365 CMSAPI void CMSEXPORT cmsSetHeaderRenderingIntent(cmsHPROFILE hProfile, cmsUInt32Number RenderingIntent);
1367 CMSAPI cmsColorSpaceSignature
1368 CMSEXPORT cmsGetPCS(cmsHPROFILE hProfile);
1369 CMSAPI void CMSEXPORT cmsSetPCS(cmsHPROFILE hProfile, cmsColorSpaceSignature pcs);
1370 CMSAPI cmsColorSpaceSignature
1371 CMSEXPORT cmsGetColorSpace(cmsHPROFILE hProfile);
1372 CMSAPI void CMSEXPORT cmsSetColorSpace(cmsHPROFILE hProfile, cmsColorSpaceSignature sig);
1373 CMSAPI cmsProfileClassSignature
1374 CMSEXPORT cmsGetDeviceClass(cmsHPROFILE hProfile);
1375 CMSAPI void CMSEXPORT cmsSetDeviceClass(cmsHPROFILE hProfile, cmsProfileClassSignature sig);
1376 CMSAPI void CMSEXPORT cmsSetProfileVersion(cmsHPROFILE hProfile, cmsFloat64Number Version);
1377 CMSAPI cmsFloat64Number CMSEXPORT cmsGetProfileVersion(cmsHPROFILE hProfile);
1379 CMSAPI cmsUInt32Number CMSEXPORT cmsGetEncodedICCversion(cmsHPROFILE hProfile);
1380 CMSAPI void CMSEXPORT cmsSetEncodedICCversion(cmsHPROFILE hProfile, cmsUInt32Number Version);
1382 // How profiles may be used
1383 #define LCMS_USED_AS_INPUT 0
1384 #define LCMS_USED_AS_OUTPUT 1
1385 #define LCMS_USED_AS_PROOF 2
1387 CMSAPI cmsBool CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1388 CMSAPI cmsBool CMSEXPORT cmsIsMatrixShaper(cmsHPROFILE hProfile);
1389 CMSAPI cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1391 // Translate form/to our notation to ICC
1392 CMSAPI cmsColorSpaceSignature CMSEXPORT _cmsICCcolorSpace(int OurNotation);
1393 CMSAPI int CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignature ProfileSpace);
1395 CMSAPI cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace);
1397 // Build a suitable formatter for the colorspace of this profile
1398 CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1399 CMSAPI cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1404 cmsInfoDescription = 0,
1405 cmsInfoManufacturer = 1,
1407 cmsInfoCopyright = 3
1410 CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfo(cmsHPROFILE hProfile, cmsInfoType Info,
1411 const char LanguageCode[3], const char CountryCode[3],
1412 wchar_t* Buffer, cmsUInt32Number BufferSize);
1414 CMSAPI cmsUInt32Number CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
1415 const char LanguageCode[3], const char CountryCode[3],
1416 char* Buffer, cmsUInt32Number BufferSize);
1418 // IO handlers ----------------------------------------------------------------------------------------------------------
1420 typedef struct _cms_io_handler cmsIOHANDLER;
1422 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const char* FileName, const char* AccessMode);
1423 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
1424 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
1425 CMSAPI cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
1426 CMSAPI cmsBool CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);
1428 // MD5 message digest --------------------------------------------------------------------------------------------------
1430 CMSAPI cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile);
1432 // Profile high level funtions ------------------------------------------------------------------------------------------
1434 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
1435 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess);
1436 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char* sAccess);
1437 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromStreamTHR(cmsContext ContextID, FILE* ICCProfile, const char* sAccess);
1438 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromMem(const void * MemPtr, cmsUInt32Number dwSize);
1439 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromMemTHR(cmsContext ContextID, const void * MemPtr, cmsUInt32Number dwSize);
1440 CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromIOhandlerTHR(cmsContext ContextID, cmsIOHANDLER* io);
1441 CMSAPI cmsBool CMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile);
1443 CMSAPI cmsBool CMSEXPORT cmsSaveProfileToFile(cmsHPROFILE hProfile, const char* FileName);
1444 CMSAPI cmsBool CMSEXPORT cmsSaveProfileToStream(cmsHPROFILE hProfile, FILE* Stream);
1445 CMSAPI cmsBool CMSEXPORT cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr, cmsUInt32Number* BytesNeeded);
1446 CMSAPI cmsUInt32Number CMSEXPORT cmsSaveProfileToIOhandler(cmsHPROFILE hProfile, cmsIOHANDLER* io);
1448 // Predefined virtual profiles ------------------------------------------------------------------------------------------
1450 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateRGBProfileTHR(cmsContext ContextID,
1451 const cmsCIExyY* WhitePoint,
1452 const cmsCIExyYTRIPLE* Primaries,
1453 cmsToneCurve* const TransferFunction[3]);
1455 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateRGBProfile(const cmsCIExyY* WhitePoint,
1456 const cmsCIExyYTRIPLE* Primaries,
1457 cmsToneCurve* const TransferFunction[3]);
1459 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
1460 const cmsCIExyY* WhitePoint,
1461 const cmsToneCurve* TransferFunction);
1463 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateGrayProfile(const cmsCIExyY* WhitePoint,
1464 const cmsToneCurve* TransferFunction);
1466 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
1467 cmsColorSpaceSignature ColorSpace,
1468 cmsToneCurve* const TransferFunctions[]);
1470 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLinearizationDeviceLink(cmsColorSpaceSignature ColorSpace,
1471 cmsToneCurve* const TransferFunctions[]);
1473 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
1474 cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1476 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLink(cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1479 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1480 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab2Profile(const cmsCIExyY* WhitePoint);
1481 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1482 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateLab4Profile(const cmsCIExyY* WhitePoint);
1484 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID);
1485 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateXYZProfile(void);
1487 CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfileTHR(cmsContext ContextID);
1488 CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfile(void);
1490 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
1492 cmsFloat64Number Bright,
1493 cmsFloat64Number Contrast,
1494 cmsFloat64Number Hue,
1495 cmsFloat64Number Saturation,
1499 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(int nLUTPoints,
1500 cmsFloat64Number Bright,
1501 cmsFloat64Number Contrast,
1502 cmsFloat64Number Hue,
1503 cmsFloat64Number Saturation,
1507 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID);
1508 CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfile(void);
1510 // Converts a transform to a devicelink profile
1511 CMSAPI cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat64Number Version, cmsUInt32Number dwFlags);
1513 // Intents ----------------------------------------------------------------------------------------------
1516 #define INTENT_PERCEPTUAL 0
1517 #define INTENT_RELATIVE_COLORIMETRIC 1
1518 #define INTENT_SATURATION 2
1519 #define INTENT_ABSOLUTE_COLORIMETRIC 3
1522 #define INTENT_PRESERVE_K_ONLY_PERCEPTUAL 10
1523 #define INTENT_PRESERVE_K_ONLY_RELATIVE_COLORIMETRIC 11
1524 #define INTENT_PRESERVE_K_ONLY_SATURATION 12
1525 #define INTENT_PRESERVE_K_PLANE_PERCEPTUAL 13
1526 #define INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC 14
1527 #define INTENT_PRESERVE_K_PLANE_SATURATION 15
1529 // Call with NULL as parameters to get the intent count
1530 CMSAPI cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1534 #define cmsFLAGS_NOCACHE 0x0040 // Inhibit 1-pixel cache
1535 #define cmsFLAGS_NOOPTIMIZE 0x0100 // Inhibit optimizations
1536 #define cmsFLAGS_NULLTRANSFORM 0x0200 // Don't transform anyway
1539 #define cmsFLAGS_GAMUTCHECK 0x1000 // Out of Gamut alarm
1540 #define cmsFLAGS_SOFTPROOFING 0x4000 // Do softproofing
1543 #define cmsFLAGS_BLACKPOINTCOMPENSATION 0x2000
1544 #define cmsFLAGS_NOWHITEONWHITEFIXUP 0x0004 // Don't fix scum dot
1545 #define cmsFLAGS_HIGHRESPRECALC 0x0400 // Use more memory to give better accurancy
1546 #define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resouces
1548 // For devicelink creation
1549 #define cmsFLAGS_8BITS_DEVICELINK 0x0008 // Create 8 bits devicelinks
1550 #define cmsFLAGS_GUESSDEVICECLASS 0x0020 // Guess device class (for transform2devicelink)
1551 #define cmsFLAGS_KEEP_SEQUENCE 0x0080 // Keep profile sequence for devicelink creation
1553 // Specific to a particular optimizations
1554 #define cmsFLAGS_FORCE_CLUT 0x0002 // Force CLUT optimization
1555 #define cmsFLAGS_CLUT_POST_LINEARIZATION 0x0001 // create postlinearization tables if possible
1556 #define cmsFLAGS_CLUT_PRE_LINEARIZATION 0x0010 // create prelinearization tables if possible
1558 // Fine-tune control over number of gridpoints
1559 #define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16)
1562 #define cmsFLAGS_NODEFAULTRESOURCEDEF 0x01000000
1564 // Transforms ---------------------------------------------------------------------------------------------------
1566 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransformTHR(cmsContext ContextID,
1568 cmsUInt32Number InputFormat,
1570 cmsUInt32Number OutputFormat,
1571 cmsUInt32Number Intent,
1572 cmsUInt32Number dwFlags);
1574 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransform(cmsHPROFILE Input,
1575 cmsUInt32Number InputFormat,
1577 cmsUInt32Number OutputFormat,
1578 cmsUInt32Number Intent,
1579 cmsUInt32Number dwFlags);
1581 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransformTHR(cmsContext ContextID,
1583 cmsUInt32Number InputFormat,
1585 cmsUInt32Number OutputFormat,
1586 cmsHPROFILE Proofing,
1587 cmsUInt32Number Intent,
1588 cmsUInt32Number ProofingIntent,
1589 cmsUInt32Number dwFlags);
1591 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransform(cmsHPROFILE Input,
1592 cmsUInt32Number InputFormat,
1594 cmsUInt32Number OutputFormat,
1595 cmsHPROFILE Proofing,
1596 cmsUInt32Number Intent,
1597 cmsUInt32Number ProofingIntent,
1598 cmsUInt32Number dwFlags);
1600 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransformTHR(cmsContext ContextID,
1601 cmsHPROFILE hProfiles[],
1602 cmsUInt32Number nProfiles,
1603 cmsUInt32Number InputFormat,
1604 cmsUInt32Number OutputFormat,
1605 cmsUInt32Number Intent,
1606 cmsUInt32Number dwFlags);
1609 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[],
1610 cmsUInt32Number nProfiles,
1611 cmsUInt32Number InputFormat,
1612 cmsUInt32Number OutputFormat,
1613 cmsUInt32Number Intent,
1614 cmsUInt32Number dwFlags);
1617 CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
1618 cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[],
1620 cmsUInt32Number Intents[],
1621 cmsFloat64Number AdaptationStates[],
1622 cmsHPROFILE hGamutProfile,
1623 cmsUInt32Number nGamutPCSposition,
1624 cmsUInt32Number InputFormat,
1625 cmsUInt32Number OutputFormat,
1626 cmsUInt32Number dwFlags);
1628 CMSAPI void CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform);
1630 CMSAPI void CMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform,
1631 const void * InputBuffer,
1632 void * OutputBuffer,
1633 cmsUInt32Number Size);
1635 CMSAPI void CMSEXPORT cmsSetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1636 CMSAPI void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1638 // Adaptation state for absolute colorimetric intent
1639 CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d);
1641 // Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed
1642 CMSAPI cmsContext CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform);
1644 // Grab the input/output formats
1645 CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform);
1646 CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform);
1648 // For backwards compatibility
1649 CMSAPI cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform,
1650 cmsUInt32Number InputFormat,
1651 cmsUInt32Number OutputFormat);
1655 // PostScript ColorRenderingDictionary and ColorSpaceArray ----------------------------------------------------
1657 typedef enum { cmsPS_RESOURCE_CSA, cmsPS_RESOURCE_CRD } cmsPSResourceType;
1659 // lcms2 unified method to access postscript color resources
1660 CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptColorResource(cmsContext ContextID,
1661 cmsPSResourceType Type,
1662 cmsHPROFILE hProfile,
1663 cmsUInt32Number Intent,
1664 cmsUInt32Number dwFlags,
1667 CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptCSA(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1668 CMSAPI cmsUInt32Number CMSEXPORT cmsGetPostScriptCRD(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1671 // IT8.7 / CGATS.17-200x handling -----------------------------------------------------------------------------
1673 CMSAPI cmsHANDLE CMSEXPORT cmsIT8Alloc(cmsContext ContextID);
1674 CMSAPI void CMSEXPORT cmsIT8Free(cmsHANDLE hIT8);
1677 CMSAPI cmsUInt32Number CMSEXPORT cmsIT8TableCount(cmsHANDLE hIT8);
1678 CMSAPI cmsInt32Number CMSEXPORT cmsIT8SetTable(cmsHANDLE hIT8, cmsUInt32Number nTable);
1681 CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromFile(cmsContext ContextID, const char* cFileName);
1682 CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, void *Ptr, cmsUInt32Number len);
1683 // CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromIOhandler(cmsContext ContextID, cmsIOHANDLER* io);
1685 CMSAPI cmsBool CMSEXPORT cmsIT8SaveToFile(cmsHANDLE hIT8, const char* cFileName);
1686 CMSAPI cmsBool CMSEXPORT cmsIT8SaveToMem(cmsHANDLE hIT8, void *MemPtr, cmsUInt32Number* BytesNeeded);
1689 CMSAPI const char* CMSEXPORT cmsIT8GetSheetType(cmsHANDLE hIT8);
1690 CMSAPI cmsBool CMSEXPORT cmsIT8SetSheetType(cmsHANDLE hIT8, const char* Type);
1692 CMSAPI cmsBool CMSEXPORT cmsIT8SetComment(cmsHANDLE hIT8, const char* cComment);
1694 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyStr(cmsHANDLE hIT8, const char* cProp, const char *Str);
1695 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val);
1696 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyHex(cmsHANDLE hIT8, const char* cProp, cmsUInt32Number Val);
1697 CMSAPI cmsBool CMSEXPORT cmsIT8SetPropertyUncooked(cmsHANDLE hIT8, const char* Key, const char* Buffer);
1700 CMSAPI const char* CMSEXPORT cmsIT8GetProperty(cmsHANDLE hIT8, const char* cProp);
1701 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetPropertyDbl(cmsHANDLE hIT8, const char* cProp);
1702 CMSAPI cmsUInt32Number CMSEXPORT cmsIT8EnumProperties(cmsHANDLE hIT8, char ***PropertyNames);
1705 CMSAPI const char* CMSEXPORT cmsIT8GetDataRowCol(cmsHANDLE hIT8, int row, int col);
1706 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataRowColDbl(cmsHANDLE hIT8, int row, int col);
1708 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataRowCol(cmsHANDLE hIT8, int row, int col,
1711 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataRowColDbl(cmsHANDLE hIT8, int row, int col,
1712 cmsFloat64Number Val);
1714 CMSAPI const char* CMSEXPORT cmsIT8GetData(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1717 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1719 CMSAPI cmsBool CMSEXPORT cmsIT8SetData(cmsHANDLE hIT8, const char* cPatch,
1720 const char* cSample,
1723 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataDbl(cmsHANDLE hIT8, const char* cPatch,
1724 const char* cSample,
1725 cmsFloat64Number Val);
1727 CMSAPI int CMSEXPORT cmsIT8FindDataFormat(cmsHANDLE hIT8, const char* cSample);
1728 CMSAPI cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE hIT8, int n, const char *Sample);
1729 CMSAPI int CMSEXPORT cmsIT8EnumDataFormat(cmsHANDLE hIT8, char ***SampleNames);
1731 CMSAPI const char* CMSEXPORT cmsIT8GetPatchName(cmsHANDLE hIT8, int nPatch, char* buffer);
1733 // The LABEL extension
1734 CMSAPI int CMSEXPORT cmsIT8SetTableByLabel(cmsHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType);
1736 // Formatter for double
1737 CMSAPI void CMSEXPORT cmsIT8DefineDblFormat(cmsHANDLE hIT8, const char* Formatter);
1739 // Gamut boundary description routines ------------------------------------------------------------------------------
1741 CMSAPI cmsHANDLE CMSEXPORT cmsGBDAlloc(cmsContext ContextID);
1742 CMSAPI void CMSEXPORT cmsGBDFree(cmsHANDLE hGBD);
1743 CMSAPI cmsBool CMSEXPORT cmsGDBAddPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1744 CMSAPI cmsBool CMSEXPORT cmsGDBCompute(cmsHANDLE hGDB, cmsUInt32Number dwFlags);
1745 CMSAPI cmsBool CMSEXPORT cmsGDBCheckPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1747 // Feature detection ----------------------------------------------------------------------------------------------
1749 // Estimate the black point
1750 CMSAPI cmsBool CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1752 // Estimate total area coverage
1753 CMSAPI cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile);
1756 // Poor man's gamut mapping
1757 CMSAPI cmsBool CMSEXPORT cmsDesaturateLab(cmsCIELab* Lab,
1758 double amax, double amin,
1759 double bmax, double bmin);
1761 #ifndef CMS_USE_CPP_API