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