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