Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-27 09:55:30

0001 //---------------------------------------------------------------------------------
0002 //
0003 //  Little Color Management System
0004 //  Copyright (c) 1998-2023 Marti Maria Saguer
0005 //
0006 // Permission is hereby granted, free of charge, to any person obtaining
0007 // a copy of this software and associated documentation files (the "Software"),
0008 // to deal in the Software without restriction, including without limitation
0009 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
0010 // and/or sell copies of the Software, and to permit persons to whom the Software
0011 // is furnished to do so, subject to the following conditions:
0012 //
0013 // The above copyright notice and this permission notice shall be included in
0014 // all copies or substantial portions of the Software.
0015 //
0016 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0017 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
0018 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0019 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
0020 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
0021 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0022 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0023 //
0024 //---------------------------------------------------------------------------------
0025 //
0026 // Version 2.16
0027 //
0028 
0029 #ifndef _lcms2_H
0030 
0031 // ********** Configuration toggles ****************************************
0032 
0033 // Uncomment this one if you are using big endian machines
0034 // #define CMS_USE_BIG_ENDIAN   1
0035 
0036 // Uncomment this one if your compiler/machine does NOT support the
0037 // "long long" type.
0038 // #define CMS_DONT_USE_INT64        1
0039 
0040 // Uncomment this if your compiler doesn't work with fast floor function
0041 // #define CMS_DONT_USE_FAST_FLOOR 1
0042 
0043 // Uncomment this line if you want lcms to use the black point tag in profile,
0044 // if commented, lcms will compute the black point by its own.
0045 // It is safer to leave it commented out
0046 // #define CMS_USE_PROFILE_BLACK_POINT_TAG    1
0047 
0048 // Uncomment this line if you are compiling as C++ and want a C++ API
0049 // #define CMS_USE_CPP_API
0050 
0051 // Uncomment this line if you need strict CGATS syntax. Makes CGATS files to
0052 // require "KEYWORD" on undefined identifiers, keep it commented out unless needed
0053 // #define CMS_STRICT_CGATS  1
0054 
0055 // Uncomment to get rid of the tables for "half" float support
0056 // #define CMS_NO_HALF_SUPPORT 1
0057 
0058 // Uncomment to get rid of pthreads/windows dependency
0059 // #define CMS_NO_PTHREADS  1
0060 
0061 // Uncomment this for special windows mutex initialization (see lcms2_internal.h)
0062 // #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
0063 
0064 // Uncomment this to remove the "register" storage class
0065 // #define CMS_NO_REGISTER_KEYWORD 1
0066 
0067 // ********** End of configuration toggles ******************************
0068 
0069 // Needed for streams
0070 #include <stdio.h>
0071 
0072 // Needed for portability (C99 per 7.1.2)
0073 #include <limits.h>
0074 #include <time.h>
0075 #include <stddef.h>
0076 
0077 #ifndef CMS_USE_CPP_API
0078 #   ifdef __cplusplus
0079 #       if __cplusplus >= 201703L
0080 #            define CMS_NO_REGISTER_KEYWORD 1  
0081 #       endif
0082 extern "C" {
0083 #   endif
0084 #endif
0085 
0086 // Version/release
0087 #define LCMS_VERSION        2160
0088 
0089 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
0090 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
0091 
0092 // Base types
0093 typedef unsigned char        cmsUInt8Number;   // That is guaranteed by the C99 spec
0094 typedef signed char          cmsInt8Number;    // That is guaranteed by the C99 spec
0095 
0096 #if CHAR_BIT != 8
0097 #  error "Unable to find 8 bit type, unsupported compiler"
0098 #endif
0099 
0100 // IEEE float storage numbers
0101 typedef float                cmsFloat32Number;
0102 typedef double               cmsFloat64Number;
0103 
0104 // 16-bit base types
0105 #if (USHRT_MAX == 65535U)
0106  typedef unsigned short      cmsUInt16Number;
0107 #elif (UINT_MAX == 65535U)
0108  typedef unsigned int        cmsUInt16Number;
0109 #else
0110 #  error "Unable to find 16 bits unsigned type, unsupported compiler"
0111 #endif
0112 
0113 #if (SHRT_MAX == 32767)
0114   typedef  short             cmsInt16Number;
0115 #elif (INT_MAX == 32767)
0116   typedef  int               cmsInt16Number;
0117 #else
0118 #  error "Unable to find 16 bits signed type, unsupported compiler"
0119 #endif
0120 
0121 // 32-bit base type
0122 #if (UINT_MAX == 4294967295U)
0123  typedef unsigned int        cmsUInt32Number;
0124 #elif (ULONG_MAX == 4294967295U)
0125  typedef unsigned long       cmsUInt32Number;
0126 #else
0127 #  error "Unable to find 32 bit unsigned type, unsupported compiler"
0128 #endif
0129 
0130 #if (INT_MAX == +2147483647)
0131  typedef  int                cmsInt32Number;
0132 #elif (LONG_MAX == +2147483647)
0133  typedef  long               cmsInt32Number;
0134 #else
0135 #  error "Unable to find 32 bit signed type, unsupported compiler"
0136 #endif
0137 
0138 // 64-bit base types
0139 #ifndef CMS_DONT_USE_INT64
0140 #  if (ULONG_MAX  == 18446744073709551615U)
0141     typedef unsigned long   cmsUInt64Number;
0142 #  elif (ULLONG_MAX == 18446744073709551615U)
0143       typedef unsigned long long   cmsUInt64Number;
0144 #  else
0145 #     define CMS_DONT_USE_INT64 1
0146 #  endif
0147 #  if (LONG_MAX == +9223372036854775807)
0148       typedef  long          cmsInt64Number;
0149 #  elif (LLONG_MAX == +9223372036854775807)
0150       typedef  long long     cmsInt64Number;
0151 #  else
0152 #     define CMS_DONT_USE_INT64 1
0153 #  endif
0154 #endif
0155 #endif
0156 
0157 // Handle "register" keyword
0158 #if defined(CMS_NO_REGISTER_KEYWORD)
0159 #  define CMSREGISTER
0160 #else
0161 #  define CMSREGISTER register
0162 #endif
0163 
0164 // In the case 64 bit numbers are not supported by the compiler
0165 #ifdef CMS_DONT_USE_INT64
0166     typedef cmsUInt32Number      cmsUInt64Number[2];
0167     typedef cmsInt32Number       cmsInt64Number[2];
0168 #endif
0169 
0170 // Derivative types
0171 typedef cmsUInt32Number      cmsSignature;
0172 typedef cmsUInt16Number      cmsU8Fixed8Number;
0173 typedef cmsInt32Number       cmsS15Fixed16Number;
0174 typedef cmsUInt32Number      cmsU16Fixed16Number;
0175 
0176 // Boolean type, which will be using the native integer
0177 typedef int                  cmsBool;
0178 
0179 // Try to detect windows
0180 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
0181 #  define CMS_IS_WINDOWS_ 1
0182 #endif
0183 
0184 #ifdef _MSC_VER
0185 #  define CMS_IS_WINDOWS_ 1
0186 #endif
0187 
0188 #ifdef __BORLANDC__
0189 #  define CMS_IS_WINDOWS_ 1
0190 #endif
0191 
0192 // Try to detect big endian platforms. This list can be endless, so primarily rely on the configure script
0193 // on Unix-like systems, and allow it to be set on the compiler command line using
0194 // -DCMS_USE_BIG_ENDIAN or something similar
0195 #ifdef CMS_USE_BIG_ENDIAN // set at compiler command line takes overall precedence
0196 
0197 #  if CMS_USE_BIG_ENDIAN == 0
0198 #    undef CMS_USE_BIG_ENDIAN
0199 #  endif
0200 
0201 #else // CMS_USE_BIG_ENDIAN
0202 
0203 #  ifdef WORDS_BIGENDIAN // set by configure (or explicitly on compiler command line)
0204 #    define CMS_USE_BIG_ENDIAN 1
0205 #  else // WORDS_BIGENDIAN
0206 // Fall back to platform/compiler specific tests
0207 #    if defined(__sgi__) || defined(__sgi) || defined(sparc)
0208 #      define CMS_USE_BIG_ENDIAN      1
0209 #    endif
0210 
0211 #    if defined(__s390__) || defined(__s390x__)
0212 #      define CMS_USE_BIG_ENDIAN   1
0213 #    endif
0214 
0215 #    ifdef macintosh
0216 #      ifdef __BIG_ENDIAN__
0217 #        define CMS_USE_BIG_ENDIAN      1
0218 #      endif
0219 #      ifdef __LITTLE_ENDIAN__
0220 #        undef CMS_USE_BIG_ENDIAN
0221 #      endif
0222 #    endif
0223 #  endif  // WORDS_BIGENDIAN
0224 
0225 #  if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
0226 #    define CMS_USE_BIG_ENDIAN      1
0227 #  endif
0228 
0229 #endif  // CMS_USE_BIG_ENDIAN
0230 
0231 
0232 // Calling convention -- this is hardly platform and compiler dependent
0233 #if defined(CMS_IS_WINDOWS_) && !defined(__GNUC__)
0234 #  if defined(CMS_DLL) || defined(CMS_DLL_BUILD)
0235 #     ifdef __BORLANDC__
0236 #        define CMSEXPORT       __stdcall _export
0237 #        define CMSAPI
0238 #     else
0239 #        define CMSEXPORT      __stdcall
0240 #        ifdef CMS_DLL_BUILD
0241 #            define CMSAPI    __declspec(dllexport)
0242 #        else
0243 #           define CMSAPI     __declspec(dllimport)
0244 #        endif
0245 #     endif
0246 #  else
0247 #     define CMSEXPORT
0248 #     define CMSAPI
0249 #  endif
0250 #else  // not Windows
0251 #  ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY
0252 #     define CMSEXPORT
0253 #     define CMSAPI    __attribute__((visibility("default")))
0254 #  else
0255 #     define CMSEXPORT
0256 #     define CMSAPI
0257 #  endif
0258 #endif  // CMS_IS_WINDOWS_
0259 
0260 #ifdef HasTHREADS
0261 # if HasTHREADS == 1
0262 #    undef CMS_NO_PTHREADS
0263 # else
0264 #    define CMS_NO_PTHREADS 1
0265 # endif
0266 #endif
0267 
0268 // Some common definitions
0269 #define cmsMAX_PATH     256
0270 
0271 #ifndef FALSE
0272 #       define FALSE 0
0273 #endif
0274 #ifndef TRUE
0275 #       define TRUE  1
0276 #endif
0277 
0278 // D50 XYZ normalized to Y=1.0
0279 #define cmsD50X  0.9642
0280 #define cmsD50Y  1.0
0281 #define cmsD50Z  0.8249
0282 
0283 // V4 perceptual black
0284 #define cmsPERCEPTUAL_BLACK_X  0.00336
0285 #define cmsPERCEPTUAL_BLACK_Y  0.0034731
0286 #define cmsPERCEPTUAL_BLACK_Z  0.00287
0287 
0288 // Definitions in ICC spec
0289 #define cmsMagicNumber  0x61637370     // 'acsp'
0290 #define lcmsSignature   0x6c636d73     // 'lcms'
0291 
0292 
0293 // Base ICC type definitions
0294 typedef enum {
0295     cmsSigChromaticityType                  = 0x6368726D,  // 'chrm'
0296     cmsSigcicpType                          = 0x63696370,  // 'cicp' 
0297     cmsSigColorantOrderType                 = 0x636C726F,  // 'clro'
0298     cmsSigColorantTableType                 = 0x636C7274,  // 'clrt'
0299     cmsSigCrdInfoType                       = 0x63726469,  // 'crdi'
0300     cmsSigCurveType                         = 0x63757276,  // 'curv'
0301     cmsSigDataType                          = 0x64617461,  // 'data'
0302     cmsSigDictType                          = 0x64696374,  // 'dict'
0303     cmsSigDateTimeType                      = 0x6474696D,  // 'dtim'
0304     cmsSigDeviceSettingsType                = 0x64657673,  // 'devs'
0305     cmsSigLut16Type                         = 0x6d667432,  // 'mft2'
0306     cmsSigLut8Type                          = 0x6d667431,  // 'mft1'
0307     cmsSigLutAtoBType                       = 0x6d414220,  // 'mAB '
0308     cmsSigLutBtoAType                       = 0x6d424120,  // 'mBA '
0309     cmsSigMeasurementType                   = 0x6D656173,  // 'meas'
0310     cmsSigMultiLocalizedUnicodeType         = 0x6D6C7563,  // 'mluc'
0311     cmsSigMultiProcessElementType           = 0x6D706574,  // 'mpet'
0312     cmsSigNamedColorType                    = 0x6E636f6C,  // 'ncol' -- DEPRECATED!
0313     cmsSigNamedColor2Type                   = 0x6E636C32,  // 'ncl2'
0314     cmsSigParametricCurveType               = 0x70617261,  // 'para'
0315     cmsSigProfileSequenceDescType           = 0x70736571,  // 'pseq'
0316     cmsSigProfileSequenceIdType             = 0x70736964,  // 'psid'
0317     cmsSigResponseCurveSet16Type            = 0x72637332,  // 'rcs2'
0318     cmsSigS15Fixed16ArrayType               = 0x73663332,  // 'sf32'
0319     cmsSigScreeningType                     = 0x7363726E,  // 'scrn'
0320     cmsSigSignatureType                     = 0x73696720,  // 'sig '
0321     cmsSigTextType                          = 0x74657874,  // 'text'
0322     cmsSigTextDescriptionType               = 0x64657363,  // 'desc'
0323     cmsSigU16Fixed16ArrayType               = 0x75663332,  // 'uf32'
0324     cmsSigUcrBgType                         = 0x62666420,  // 'bfd '
0325     cmsSigUInt16ArrayType                   = 0x75693136,  // 'ui16'
0326     cmsSigUInt32ArrayType                   = 0x75693332,  // 'ui32'
0327     cmsSigUInt64ArrayType                   = 0x75693634,  // 'ui64'
0328     cmsSigUInt8ArrayType                    = 0x75693038,  // 'ui08'
0329     cmsSigVcgtType                          = 0x76636774,  // 'vcgt'
0330     cmsSigViewingConditionsType             = 0x76696577,  // 'view'
0331     cmsSigXYZType                           = 0x58595A20,  // 'XYZ '
0332     cmsSigMHC2Type                          = 0x4D484332   // 'MHC2'
0333 
0334 
0335 } cmsTagTypeSignature;
0336 
0337 // Base ICC tag definitions
0338 typedef enum {
0339     cmsSigAToB0Tag                          = 0x41324230,  // 'A2B0'
0340     cmsSigAToB1Tag                          = 0x41324231,  // 'A2B1'
0341     cmsSigAToB2Tag                          = 0x41324232,  // 'A2B2'
0342     cmsSigBlueColorantTag                   = 0x6258595A,  // 'bXYZ'
0343     cmsSigBlueMatrixColumnTag               = 0x6258595A,  // 'bXYZ'
0344     cmsSigBlueTRCTag                        = 0x62545243,  // 'bTRC'
0345     cmsSigBToA0Tag                          = 0x42324130,  // 'B2A0'
0346     cmsSigBToA1Tag                          = 0x42324131,  // 'B2A1'
0347     cmsSigBToA2Tag                          = 0x42324132,  // 'B2A2'
0348     cmsSigCalibrationDateTimeTag            = 0x63616C74,  // 'calt'
0349     cmsSigCharTargetTag                     = 0x74617267,  // 'targ'
0350     cmsSigChromaticAdaptationTag            = 0x63686164,  // 'chad'
0351     cmsSigChromaticityTag                   = 0x6368726D,  // 'chrm'
0352     cmsSigColorantOrderTag                  = 0x636C726F,  // 'clro'
0353     cmsSigColorantTableTag                  = 0x636C7274,  // 'clrt'
0354     cmsSigColorantTableOutTag               = 0x636C6F74,  // 'clot'
0355     cmsSigColorimetricIntentImageStateTag   = 0x63696973,  // 'ciis'
0356     cmsSigCopyrightTag                      = 0x63707274,  // 'cprt'
0357     cmsSigCrdInfoTag                        = 0x63726469,  // 'crdi'
0358     cmsSigDataTag                           = 0x64617461,  // 'data'
0359     cmsSigDateTimeTag                       = 0x6474696D,  // 'dtim'
0360     cmsSigDeviceMfgDescTag                  = 0x646D6E64,  // 'dmnd'
0361     cmsSigDeviceModelDescTag                = 0x646D6464,  // 'dmdd'
0362     cmsSigDeviceSettingsTag                 = 0x64657673,  // 'devs'
0363     cmsSigDToB0Tag                          = 0x44324230,  // 'D2B0'
0364     cmsSigDToB1Tag                          = 0x44324231,  // 'D2B1'
0365     cmsSigDToB2Tag                          = 0x44324232,  // 'D2B2'
0366     cmsSigDToB3Tag                          = 0x44324233,  // 'D2B3'
0367     cmsSigBToD0Tag                          = 0x42324430,  // 'B2D0'
0368     cmsSigBToD1Tag                          = 0x42324431,  // 'B2D1'
0369     cmsSigBToD2Tag                          = 0x42324432,  // 'B2D2'
0370     cmsSigBToD3Tag                          = 0x42324433,  // 'B2D3'
0371     cmsSigGamutTag                          = 0x67616D74,  // 'gamt'
0372     cmsSigGrayTRCTag                        = 0x6b545243,  // 'kTRC'
0373     cmsSigGreenColorantTag                  = 0x6758595A,  // 'gXYZ'
0374     cmsSigGreenMatrixColumnTag              = 0x6758595A,  // 'gXYZ'
0375     cmsSigGreenTRCTag                       = 0x67545243,  // 'gTRC'
0376     cmsSigLuminanceTag                      = 0x6C756d69,  // 'lumi'
0377     cmsSigMeasurementTag                    = 0x6D656173,  // 'meas'
0378     cmsSigMediaBlackPointTag                = 0x626B7074,  // 'bkpt'
0379     cmsSigMediaWhitePointTag                = 0x77747074,  // 'wtpt'
0380     cmsSigNamedColorTag                     = 0x6E636f6C,  // 'ncol' // Deprecated by the ICC
0381     cmsSigNamedColor2Tag                    = 0x6E636C32,  // 'ncl2'
0382     cmsSigOutputResponseTag                 = 0x72657370,  // 'resp'
0383     cmsSigPerceptualRenderingIntentGamutTag = 0x72696730,  // 'rig0'
0384     cmsSigPreview0Tag                       = 0x70726530,  // 'pre0'
0385     cmsSigPreview1Tag                       = 0x70726531,  // 'pre1'
0386     cmsSigPreview2Tag                       = 0x70726532,  // 'pre2'
0387     cmsSigProfileDescriptionTag             = 0x64657363,  // 'desc'
0388     cmsSigProfileDescriptionMLTag           = 0x6473636d,  // 'dscm'
0389     cmsSigProfileSequenceDescTag            = 0x70736571,  // 'pseq'
0390     cmsSigProfileSequenceIdTag              = 0x70736964,  // 'psid'
0391     cmsSigPs2CRD0Tag                        = 0x70736430,  // 'psd0'
0392     cmsSigPs2CRD1Tag                        = 0x70736431,  // 'psd1'
0393     cmsSigPs2CRD2Tag                        = 0x70736432,  // 'psd2'
0394     cmsSigPs2CRD3Tag                        = 0x70736433,  // 'psd3'
0395     cmsSigPs2CSATag                         = 0x70733273,  // 'ps2s'
0396     cmsSigPs2RenderingIntentTag             = 0x70733269,  // 'ps2i'
0397     cmsSigRedColorantTag                    = 0x7258595A,  // 'rXYZ'
0398     cmsSigRedMatrixColumnTag                = 0x7258595A,  // 'rXYZ'
0399     cmsSigRedTRCTag                         = 0x72545243,  // 'rTRC'
0400     cmsSigSaturationRenderingIntentGamutTag = 0x72696732,  // 'rig2'
0401     cmsSigScreeningDescTag                  = 0x73637264,  // 'scrd'
0402     cmsSigScreeningTag                      = 0x7363726E,  // 'scrn'
0403     cmsSigTechnologyTag                     = 0x74656368,  // 'tech'
0404     cmsSigUcrBgTag                          = 0x62666420,  // 'bfd '
0405     cmsSigViewingCondDescTag                = 0x76756564,  // 'vued'
0406     cmsSigViewingConditionsTag              = 0x76696577,  // 'view'
0407     cmsSigVcgtTag                           = 0x76636774,  // 'vcgt'
0408     cmsSigMetaTag                           = 0x6D657461,  // 'meta'
0409     cmsSigcicpTag                           = 0x63696370,  // 'cicp'
0410     cmsSigArgyllArtsTag                     = 0x61727473,  // 'arts'
0411     cmsSigMHC2Tag                           = 0x4D484332   // 'MHC2'
0412 
0413 } cmsTagSignature;
0414 
0415 
0416 // ICC Technology tag
0417 typedef enum {
0418     cmsSigDigitalCamera                     = 0x6463616D,  // 'dcam'
0419     cmsSigFilmScanner                       = 0x6673636E,  // 'fscn'
0420     cmsSigReflectiveScanner                 = 0x7273636E,  // 'rscn'
0421     cmsSigInkJetPrinter                     = 0x696A6574,  // 'ijet'
0422     cmsSigThermalWaxPrinter                 = 0x74776178,  // 'twax'
0423     cmsSigElectrophotographicPrinter        = 0x6570686F,  // 'epho'
0424     cmsSigElectrostaticPrinter              = 0x65737461,  // 'esta'
0425     cmsSigDyeSublimationPrinter             = 0x64737562,  // 'dsub'
0426     cmsSigPhotographicPaperPrinter          = 0x7270686F,  // 'rpho'
0427     cmsSigFilmWriter                        = 0x6670726E,  // 'fprn'
0428     cmsSigVideoMonitor                      = 0x7669646D,  // 'vidm'
0429     cmsSigVideoCamera                       = 0x76696463,  // 'vidc'
0430     cmsSigProjectionTelevision              = 0x706A7476,  // 'pjtv'
0431     cmsSigCRTDisplay                        = 0x43525420,  // 'CRT '
0432     cmsSigPMDisplay                         = 0x504D4420,  // 'PMD '
0433     cmsSigAMDisplay                         = 0x414D4420,  // 'AMD '
0434     cmsSigPhotoCD                           = 0x4B504344,  // 'KPCD'
0435     cmsSigPhotoImageSetter                  = 0x696D6773,  // 'imgs'
0436     cmsSigGravure                           = 0x67726176,  // 'grav'
0437     cmsSigOffsetLithography                 = 0x6F666673,  // 'offs'
0438     cmsSigSilkscreen                        = 0x73696C6B,  // 'silk'
0439     cmsSigFlexography                       = 0x666C6578,  // 'flex'
0440     cmsSigMotionPictureFilmScanner          = 0x6D706673,  // 'mpfs'
0441     cmsSigMotionPictureFilmRecorder         = 0x6D706672,  // 'mpfr'
0442     cmsSigDigitalMotionPictureCamera        = 0x646D7063,  // 'dmpc'
0443     cmsSigDigitalCinemaProjector            = 0x64636A70   // 'dcpj'
0444 
0445 } cmsTechnologySignature;
0446 
0447 
0448 // ICC Color spaces
0449 typedef enum {
0450     cmsSigXYZData                           = 0x58595A20,  // 'XYZ '
0451     cmsSigLabData                           = 0x4C616220,  // 'Lab '
0452     cmsSigLuvData                           = 0x4C757620,  // 'Luv '
0453     cmsSigYCbCrData                         = 0x59436272,  // 'YCbr'
0454     cmsSigYxyData                           = 0x59787920,  // 'Yxy '
0455     cmsSigRgbData                           = 0x52474220,  // 'RGB '
0456     cmsSigGrayData                          = 0x47524159,  // 'GRAY'
0457     cmsSigHsvData                           = 0x48535620,  // 'HSV '
0458     cmsSigHlsData                           = 0x484C5320,  // 'HLS '
0459     cmsSigCmykData                          = 0x434D594B,  // 'CMYK'
0460     cmsSigCmyData                           = 0x434D5920,  // 'CMY '
0461     cmsSigMCH1Data                          = 0x4D434831,  // 'MCH1'
0462     cmsSigMCH2Data                          = 0x4D434832,  // 'MCH2'
0463     cmsSigMCH3Data                          = 0x4D434833,  // 'MCH3'
0464     cmsSigMCH4Data                          = 0x4D434834,  // 'MCH4'
0465     cmsSigMCH5Data                          = 0x4D434835,  // 'MCH5'
0466     cmsSigMCH6Data                          = 0x4D434836,  // 'MCH6'
0467     cmsSigMCH7Data                          = 0x4D434837,  // 'MCH7'
0468     cmsSigMCH8Data                          = 0x4D434838,  // 'MCH8'
0469     cmsSigMCH9Data                          = 0x4D434839,  // 'MCH9'
0470     cmsSigMCHAData                          = 0x4D434841,  // 'MCHA'
0471     cmsSigMCHBData                          = 0x4D434842,  // 'MCHB'
0472     cmsSigMCHCData                          = 0x4D434843,  // 'MCHC'
0473     cmsSigMCHDData                          = 0x4D434844,  // 'MCHD'
0474     cmsSigMCHEData                          = 0x4D434845,  // 'MCHE'
0475     cmsSigMCHFData                          = 0x4D434846,  // 'MCHF'
0476     cmsSigNamedData                         = 0x6e6d636c,  // 'nmcl'
0477     cmsSig1colorData                        = 0x31434C52,  // '1CLR'
0478     cmsSig2colorData                        = 0x32434C52,  // '2CLR'
0479     cmsSig3colorData                        = 0x33434C52,  // '3CLR'
0480     cmsSig4colorData                        = 0x34434C52,  // '4CLR'
0481     cmsSig5colorData                        = 0x35434C52,  // '5CLR'
0482     cmsSig6colorData                        = 0x36434C52,  // '6CLR'
0483     cmsSig7colorData                        = 0x37434C52,  // '7CLR'
0484     cmsSig8colorData                        = 0x38434C52,  // '8CLR'
0485     cmsSig9colorData                        = 0x39434C52,  // '9CLR'
0486     cmsSig10colorData                       = 0x41434C52,  // 'ACLR'
0487     cmsSig11colorData                       = 0x42434C52,  // 'BCLR'
0488     cmsSig12colorData                       = 0x43434C52,  // 'CCLR'
0489     cmsSig13colorData                       = 0x44434C52,  // 'DCLR'
0490     cmsSig14colorData                       = 0x45434C52,  // 'ECLR'
0491     cmsSig15colorData                       = 0x46434C52,  // 'FCLR'
0492     cmsSigLuvKData                          = 0x4C75764B   // 'LuvK'
0493 
0494 } cmsColorSpaceSignature;
0495 
0496 // ICC Profile Class
0497 typedef enum {
0498     cmsSigInputClass                        = 0x73636E72,  // 'scnr'
0499     cmsSigDisplayClass                      = 0x6D6E7472,  // 'mntr'
0500     cmsSigOutputClass                       = 0x70727472,  // 'prtr'
0501     cmsSigLinkClass                         = 0x6C696E6B,  // 'link'
0502     cmsSigAbstractClass                     = 0x61627374,  // 'abst'
0503     cmsSigColorSpaceClass                   = 0x73706163,  // 'spac'
0504     cmsSigNamedColorClass                   = 0x6e6d636c   // 'nmcl'
0505 
0506 } cmsProfileClassSignature;
0507 
0508 // ICC Platforms
0509 typedef enum {
0510     cmsSigMacintosh                         = 0x4150504C,  // 'APPL'
0511     cmsSigMicrosoft                         = 0x4D534654,  // 'MSFT'
0512     cmsSigSolaris                           = 0x53554E57,  // 'SUNW'
0513     cmsSigSGI                               = 0x53474920,  // 'SGI '
0514     cmsSigTaligent                          = 0x54474E54,  // 'TGNT'
0515     cmsSigUnices                            = 0x2A6E6978   // '*nix'   // From argyll -- Not official
0516 
0517 } cmsPlatformSignature;
0518 
0519 // Reference gamut
0520 #define  cmsSigPerceptualReferenceMediumGamut         0x70726d67  //'prmg'
0521 
0522 // For cmsSigColorimetricIntentImageStateTag
0523 #define  cmsSigSceneColorimetryEstimates              0x73636F65  //'scoe'
0524 #define  cmsSigSceneAppearanceEstimates               0x73617065  //'sape'
0525 #define  cmsSigFocalPlaneColorimetryEstimates         0x66706365  //'fpce'
0526 #define  cmsSigReflectionHardcopyOriginalColorimetry  0x72686F63  //'rhoc'
0527 #define  cmsSigReflectionPrintOutputColorimetry       0x72706F63  //'rpoc'
0528 
0529 // Multi process elements types
0530 typedef enum {
0531     cmsSigCurveSetElemType              = 0x63767374,  //'cvst'
0532     cmsSigMatrixElemType                = 0x6D617466,  //'matf'
0533     cmsSigCLutElemType                  = 0x636C7574,  //'clut'
0534 
0535     cmsSigBAcsElemType                  = 0x62414353,  // 'bACS'
0536     cmsSigEAcsElemType                  = 0x65414353,  // 'eACS'
0537 
0538     // Custom from here, not in the ICC Spec
0539     cmsSigXYZ2LabElemType               = 0x6C327820,  // 'l2x '
0540     cmsSigLab2XYZElemType               = 0x78326C20,  // 'x2l '
0541     cmsSigNamedColorElemType            = 0x6E636C20,  // 'ncl '
0542     cmsSigLabV2toV4                     = 0x32203420,  // '2 4 '
0543     cmsSigLabV4toV2                     = 0x34203220,  // '4 2 '
0544   
0545     // Identities
0546     cmsSigIdentityElemType              = 0x69646E20,  // 'idn '
0547 
0548     // Float to floatPCS
0549     cmsSigLab2FloatPCS                  = 0x64326C20,  // 'd2l '
0550     cmsSigFloatPCS2Lab                  = 0x6C326420,  // 'l2d '
0551     cmsSigXYZ2FloatPCS                  = 0x64327820,  // 'd2x '
0552     cmsSigFloatPCS2XYZ                  = 0x78326420,  // 'x2d '  
0553     cmsSigClipNegativesElemType         = 0x636c7020   // 'clp '
0554 
0555 } cmsStageSignature;
0556 
0557 // Types of CurveElements
0558 typedef enum {
0559 
0560     cmsSigFormulaCurveSeg               = 0x70617266, // 'parf'
0561     cmsSigSampledCurveSeg               = 0x73616D66, // 'samf'
0562     cmsSigSegmentedCurve                = 0x63757266  // 'curf'
0563 
0564 } cmsCurveSegSignature;
0565 
0566 // Used in ResponseCurveType
0567 #define  cmsSigStatusA                    0x53746141 //'StaA'
0568 #define  cmsSigStatusE                    0x53746145 //'StaE'
0569 #define  cmsSigStatusI                    0x53746149 //'StaI'
0570 #define  cmsSigStatusT                    0x53746154 //'StaT'
0571 #define  cmsSigStatusM                    0x5374614D //'StaM'
0572 #define  cmsSigDN                         0x444E2020 //'DN  '
0573 #define  cmsSigDNP                        0x444E2050 //'DN P'
0574 #define  cmsSigDNN                        0x444E4E20 //'DNN '
0575 #define  cmsSigDNNP                       0x444E4E50 //'DNNP'
0576 
0577 // Device attributes, currently defined values correspond to the low 4 bytes
0578 // of the 8 byte attribute quantity
0579 #define cmsReflective     0
0580 #define cmsTransparency   1
0581 #define cmsGlossy         0
0582 #define cmsMatte          2
0583 
0584 // Common structures in ICC tags
0585 typedef struct {
0586     cmsUInt32Number len;
0587     cmsUInt32Number flag;
0588     cmsUInt8Number  data[1];
0589 
0590 } cmsICCData;
0591 
0592 // ICC date time
0593 typedef struct {
0594     cmsUInt16Number      year;
0595     cmsUInt16Number      month;
0596     cmsUInt16Number      day;
0597     cmsUInt16Number      hours;
0598     cmsUInt16Number      minutes;
0599     cmsUInt16Number      seconds;
0600 
0601 } cmsDateTimeNumber;
0602 
0603 // ICC XYZ
0604 typedef struct {
0605     cmsS15Fixed16Number  X;
0606     cmsS15Fixed16Number  Y;
0607     cmsS15Fixed16Number  Z;
0608 
0609 } cmsEncodedXYZNumber;
0610 
0611 
0612 // Profile ID as computed by MD5 algorithm
0613 typedef union {
0614     cmsUInt8Number       ID8[16];
0615     cmsUInt16Number      ID16[8];
0616     cmsUInt32Number      ID32[4];
0617 
0618 } cmsProfileID;
0619 
0620 
0621 // ----------------------------------------------------------------------------------------------
0622 // ICC profile internal base types. Strictly, shouldn't be declared in this header, but maybe
0623 // somebody want to use this info for accessing profile header directly, so here it is.
0624 
0625 // Profile header -- it is 32-bit aligned, so no issues are expected on alignment
0626 typedef struct {
0627     cmsUInt32Number              size;           // Profile size in bytes
0628     cmsSignature                 cmmId;          // CMM for this profile
0629     cmsUInt32Number              version;        // Format version number
0630     cmsProfileClassSignature     deviceClass;    // Type of profile
0631     cmsColorSpaceSignature       colorSpace;     // Color space of data
0632     cmsColorSpaceSignature       pcs;            // PCS, XYZ or Lab only
0633     cmsDateTimeNumber            date;           // Date profile was created
0634     cmsSignature                 magic;          // Magic Number to identify an ICC profile
0635     cmsPlatformSignature         platform;       // Primary Platform
0636     cmsUInt32Number              flags;          // Various bit settings
0637     cmsSignature                 manufacturer;   // Device manufacturer
0638     cmsUInt32Number              model;          // Device model number
0639     cmsUInt64Number              attributes;     // Device attributes
0640     cmsUInt32Number              renderingIntent;// Rendering intent
0641     cmsEncodedXYZNumber          illuminant;     // Profile illuminant
0642     cmsSignature                 creator;        // Profile creator
0643     cmsProfileID                 profileID;      // Profile ID using MD5
0644     cmsInt8Number                reserved[28];   // Reserved for future use
0645 
0646 } cmsICCHeader;
0647 
0648 // ICC base tag
0649 typedef struct {
0650     cmsTagTypeSignature  sig;
0651     cmsInt8Number        reserved[4];
0652 
0653 } cmsTagBase;
0654 
0655 // A tag entry in directory
0656 typedef struct {
0657     cmsTagSignature      sig;            // The tag signature
0658     cmsUInt32Number      offset;         // Start of tag
0659     cmsUInt32Number      size;           // Size in bytes
0660 
0661 } cmsTagEntry;
0662 
0663 // ----------------------------------------------------------------------------------------------
0664 
0665 // Little CMS specific typedefs
0666 
0667 typedef void* cmsHANDLE ;              // Generic handle
0668 typedef void* cmsHPROFILE;             // Opaque typedefs to hide internals
0669 typedef void* cmsHTRANSFORM;
0670 
0671 #define cmsMAXCHANNELS  16                // Maximum number of channels in ICC profiles
0672 
0673 // Format of pixel is defined by one cmsUInt32Number, using bit fields as follows
0674 //
0675 //                               2                1          0
0676 //                        4 3 2 10987 6 5 4 3 2 1 098 7654 321
0677 //                        M A O TTTTT U Y F P X S EEE CCCC BBB
0678 //
0679 //            M: Premultiplied alpha (only works when extra samples is 1)
0680 //            A: Floating point -- With this flag we can differentiate 16 bits as float and as int
0681 //            O: Optimized -- previous optimization already returns the final 8-bit value
0682 //            T: Pixeltype
0683 //            F: Flavor  0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
0684 //            P: Planar? 0=Chunky, 1=Planar
0685 //            X: swap 16 bps endianness?
0686 //            S: Do swap? ie, BGR, KYMC
0687 //            E: Extra samples
0688 //            C: Channels (Samples per pixel)
0689 //            B: bytes per sample
0690 //            Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
0691 
0692 #define PREMUL_SH(m)           ((m) << 23)
0693 #define FLOAT_SH(a)            ((a) << 22)
0694 #define OPTIMIZED_SH(s)        ((s) << 21)
0695 #define COLORSPACE_SH(s)       ((s) << 16)
0696 #define SWAPFIRST_SH(s)        ((s) << 14)
0697 #define FLAVOR_SH(s)           ((s) << 13)
0698 #define PLANAR_SH(p)           ((p) << 12)
0699 #define ENDIAN16_SH(e)         ((e) << 11)
0700 #define DOSWAP_SH(e)           ((e) << 10)
0701 #define EXTRA_SH(e)            ((e) << 7)
0702 #define CHANNELS_SH(c)         ((c) << 3)
0703 #define BYTES_SH(b)            (b)
0704 
0705 // These macros unpack format specifiers into integers
0706 #define T_PREMUL(m)           (((m)>>23)&1)
0707 #define T_FLOAT(a)            (((a)>>22)&1)
0708 #define T_OPTIMIZED(o)        (((o)>>21)&1)
0709 #define T_COLORSPACE(s)       (((s)>>16)&31)
0710 #define T_SWAPFIRST(s)        (((s)>>14)&1)
0711 #define T_FLAVOR(s)           (((s)>>13)&1)
0712 #define T_PLANAR(p)           (((p)>>12)&1)
0713 #define T_ENDIAN16(e)         (((e)>>11)&1)
0714 #define T_DOSWAP(e)           (((e)>>10)&1)
0715 #define T_EXTRA(e)            (((e)>>7)&7)
0716 #define T_CHANNELS(c)         (((c)>>3)&15)
0717 #define T_BYTES(b)            ((b)&7)
0718 
0719 
0720 // Pixel types
0721 #define PT_ANY       0    // Don't check colorspace
0722                           // 1 & 2 are reserved
0723 #define PT_GRAY      3
0724 #define PT_RGB       4
0725 #define PT_CMY       5
0726 #define PT_CMYK      6
0727 #define PT_YCbCr     7
0728 #define PT_YUV       8      // Lu'v'
0729 #define PT_XYZ       9
0730 #define PT_Lab       10
0731 #define PT_YUVK      11     // Lu'v'K
0732 #define PT_HSV       12
0733 #define PT_HLS       13
0734 #define PT_Yxy       14
0735 #define PT_MCH1      15
0736 #define PT_MCH2      16
0737 #define PT_MCH3      17
0738 #define PT_MCH4      18
0739 #define PT_MCH5      19
0740 #define PT_MCH6      20
0741 #define PT_MCH7      21
0742 #define PT_MCH8      22
0743 #define PT_MCH9      23
0744 #define PT_MCH10     24
0745 #define PT_MCH11     25
0746 #define PT_MCH12     26
0747 #define PT_MCH13     27
0748 #define PT_MCH14     28
0749 #define PT_MCH15     29
0750 #define PT_LabV2     30     // Identical to PT_Lab, but using the V2 old encoding
0751 
0752 // Some (not all!) representations
0753 
0754 #ifndef TYPE_RGB_8      // TYPE_RGB_8 is a very common identifier, so don't include ours
0755                         // if user has it already defined.
0756 
0757 #define TYPE_GRAY_8            (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1))
0758 #define TYPE_GRAY_8_REV        (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(1)|FLAVOR_SH(1))
0759 #define TYPE_GRAY_16           (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
0760 #define TYPE_GRAY_16_REV       (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|FLAVOR_SH(1))
0761 #define TYPE_GRAY_16_SE        (COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
0762 #define TYPE_GRAYA_8           (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1))
0763 #define TYPE_GRAYA_8_PREMUL    (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PREMUL_SH(1))
0764 #define TYPE_GRAYA_16          (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2))
0765 #define TYPE_GRAYA_16_PREMUL   (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PREMUL_SH(1))
0766 #define TYPE_GRAYA_16_SE       (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|ENDIAN16_SH(1))
0767 #define TYPE_GRAYA_8_PLANAR    (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(1)|PLANAR_SH(1))
0768 #define TYPE_GRAYA_16_PLANAR   (COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2)|PLANAR_SH(1))
0769 
0770 #define TYPE_RGB_8             (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1))
0771 #define TYPE_RGB_8_PLANAR      (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0772 #define TYPE_BGR_8             (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
0773 #define TYPE_BGR_8_PLANAR      (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
0774 #define TYPE_RGB_16            (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
0775 #define TYPE_RGB_16_PLANAR     (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0776 #define TYPE_RGB_16_SE         (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0777 #define TYPE_BGR_16            (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
0778 #define TYPE_BGR_16_PLANAR     (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
0779 #define TYPE_BGR_16_SE         (COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0780 
0781 #define TYPE_RGBA_8            (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1))
0782 #define TYPE_RGBA_8_PREMUL     (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PREMUL_SH(1))
0783 #define TYPE_RGBA_8_PLANAR     (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0784 #define TYPE_RGBA_16           (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
0785 #define TYPE_RGBA_16_PREMUL    (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PREMUL_SH(1))
0786 #define TYPE_RGBA_16_PLANAR    (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0787 #define TYPE_RGBA_16_SE        (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0788 
0789 #define TYPE_ARGB_8            (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1))
0790 #define TYPE_ARGB_8_PREMUL     (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)|PREMUL_SH(1))
0791 #define TYPE_ARGB_8_PLANAR     (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|SWAPFIRST_SH(1)|PLANAR_SH(1))
0792 #define TYPE_ARGB_16           (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
0793 #define TYPE_ARGB_16_PREMUL    (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1)|PREMUL_SH(1))
0794 
0795 #define TYPE_ABGR_8            (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1))
0796 #define TYPE_ABGR_8_PREMUL     (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PREMUL_SH(1))
0797 #define TYPE_ABGR_8_PLANAR     (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|PLANAR_SH(1))
0798 #define TYPE_ABGR_16           (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
0799 #define TYPE_ABGR_16_PREMUL    (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PREMUL_SH(1))
0800 #define TYPE_ABGR_16_PLANAR    (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|PLANAR_SH(1))
0801 #define TYPE_ABGR_16_SE        (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0802 
0803 #define TYPE_BGRA_8            (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
0804 #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))
0805 #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))
0806 #define TYPE_BGRA_16           (COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
0807 #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))
0808 #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))
0809 
0810 #define TYPE_CMY_8             (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1))
0811 #define TYPE_CMY_8_PLANAR      (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0812 #define TYPE_CMY_16            (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2))
0813 #define TYPE_CMY_16_PLANAR     (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0814 #define TYPE_CMY_16_SE         (COLORSPACE_SH(PT_CMY)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0815 
0816 #define TYPE_CMYK_8            (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1))
0817 #define TYPE_CMYKA_8           (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(1))
0818 #define TYPE_CMYK_8_REV        (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1))
0819 #define TYPE_YUVK_8            TYPE_CMYK_8_REV
0820 #define TYPE_CMYK_8_PLANAR     (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|PLANAR_SH(1))
0821 #define TYPE_CMYK_16           (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
0822 #define TYPE_CMYK_16_REV       (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1))
0823 #define TYPE_YUVK_16           TYPE_CMYK_16_REV
0824 #define TYPE_CMYK_16_PLANAR    (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|PLANAR_SH(1))
0825 #define TYPE_CMYK_16_SE        (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1))
0826 
0827 #define TYPE_KYMC_8            (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1))
0828 #define TYPE_KYMC_16           (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1))
0829 #define TYPE_KYMC_16_SE        (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0830 
0831 #define TYPE_KCMY_8            (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|SWAPFIRST_SH(1))
0832 #define TYPE_KCMY_8_REV        (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
0833 #define TYPE_KCMY_16           (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|SWAPFIRST_SH(1))
0834 #define TYPE_KCMY_16_REV       (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|FLAVOR_SH(1)|SWAPFIRST_SH(1))
0835 #define TYPE_KCMY_16_SE        (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2)|ENDIAN16_SH(1)|SWAPFIRST_SH(1))
0836 
0837 #define TYPE_CMYK5_8           (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1))
0838 #define TYPE_CMYK5_16          (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2))
0839 #define TYPE_CMYK5_16_SE       (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|ENDIAN16_SH(1))
0840 #define TYPE_KYMC5_8           (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(1)|DOSWAP_SH(1))
0841 #define TYPE_KYMC5_16          (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1))
0842 #define TYPE_KYMC5_16_SE       (COLORSPACE_SH(PT_MCH5)|CHANNELS_SH(5)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0843 #define TYPE_CMYK6_8           (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1))
0844 #define TYPE_CMYK6_8_PLANAR    (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(1)|PLANAR_SH(1))
0845 #define TYPE_CMYK6_16          (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2))
0846 #define TYPE_CMYK6_16_PLANAR   (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|PLANAR_SH(1))
0847 #define TYPE_CMYK6_16_SE       (COLORSPACE_SH(PT_MCH6)|CHANNELS_SH(6)|BYTES_SH(2)|ENDIAN16_SH(1))
0848 #define TYPE_CMYK7_8           (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1))
0849 #define TYPE_CMYK7_16          (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2))
0850 #define TYPE_CMYK7_16_SE       (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|ENDIAN16_SH(1))
0851 #define TYPE_KYMC7_8           (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(1)|DOSWAP_SH(1))
0852 #define TYPE_KYMC7_16          (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1))
0853 #define TYPE_KYMC7_16_SE       (COLORSPACE_SH(PT_MCH7)|CHANNELS_SH(7)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0854 #define TYPE_CMYK8_8           (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1))
0855 #define TYPE_CMYK8_16          (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2))
0856 #define TYPE_CMYK8_16_SE       (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|ENDIAN16_SH(1))
0857 #define TYPE_KYMC8_8           (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(1)|DOSWAP_SH(1))
0858 #define TYPE_KYMC8_16          (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1))
0859 #define TYPE_KYMC8_16_SE       (COLORSPACE_SH(PT_MCH8)|CHANNELS_SH(8)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0860 #define TYPE_CMYK9_8           (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1))
0861 #define TYPE_CMYK9_16          (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2))
0862 #define TYPE_CMYK9_16_SE       (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|ENDIAN16_SH(1))
0863 #define TYPE_KYMC9_8           (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(1)|DOSWAP_SH(1))
0864 #define TYPE_KYMC9_16          (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1))
0865 #define TYPE_KYMC9_16_SE       (COLORSPACE_SH(PT_MCH9)|CHANNELS_SH(9)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0866 #define TYPE_CMYK10_8          (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1))
0867 #define TYPE_CMYK10_16         (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2))
0868 #define TYPE_CMYK10_16_SE      (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|ENDIAN16_SH(1))
0869 #define TYPE_KYMC10_8          (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(1)|DOSWAP_SH(1))
0870 #define TYPE_KYMC10_16         (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1))
0871 #define TYPE_KYMC10_16_SE      (COLORSPACE_SH(PT_MCH10)|CHANNELS_SH(10)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0872 #define TYPE_CMYK11_8          (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1))
0873 #define TYPE_CMYK11_16         (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2))
0874 #define TYPE_CMYK11_16_SE      (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|ENDIAN16_SH(1))
0875 #define TYPE_KYMC11_8          (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(1)|DOSWAP_SH(1))
0876 #define TYPE_KYMC11_16         (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1))
0877 #define TYPE_KYMC11_16_SE      (COLORSPACE_SH(PT_MCH11)|CHANNELS_SH(11)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0878 #define TYPE_CMYK12_8          (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1))
0879 #define TYPE_CMYK12_16         (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2))
0880 #define TYPE_CMYK12_16_SE      (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|ENDIAN16_SH(1))
0881 #define TYPE_KYMC12_8          (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(1)|DOSWAP_SH(1))
0882 #define TYPE_KYMC12_16         (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1))
0883 #define TYPE_KYMC12_16_SE      (COLORSPACE_SH(PT_MCH12)|CHANNELS_SH(12)|BYTES_SH(2)|DOSWAP_SH(1)|ENDIAN16_SH(1))
0884 
0885 // Colorimetric
0886 #define TYPE_XYZ_16            (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2))
0887 #define TYPE_Lab_8             (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1))
0888 #define TYPE_LabV2_8           (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1))
0889 
0890 #define TYPE_ALab_8            (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1))
0891 #define TYPE_ALabV2_8          (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1)|SWAPFIRST_SH(1))
0892 #define TYPE_Lab_16            (COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(2))
0893 #define TYPE_LabV2_16          (COLORSPACE_SH(PT_LabV2)|CHANNELS_SH(3)|BYTES_SH(2))
0894 #define TYPE_Yxy_16            (COLORSPACE_SH(PT_Yxy)|CHANNELS_SH(3)|BYTES_SH(2))
0895 
0896 // YCbCr
0897 #define TYPE_YCbCr_8           (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1))
0898 #define TYPE_YCbCr_8_PLANAR    (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0899 #define TYPE_YCbCr_16          (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2))
0900 #define TYPE_YCbCr_16_PLANAR   (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0901 #define TYPE_YCbCr_16_SE       (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0902 
0903 // YUV
0904 #define TYPE_YUV_8             (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1))
0905 #define TYPE_YUV_8_PLANAR      (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0906 #define TYPE_YUV_16            (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2))
0907 #define TYPE_YUV_16_PLANAR     (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0908 #define TYPE_YUV_16_SE         (COLORSPACE_SH(PT_YUV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0909 
0910 // HLS
0911 #define TYPE_HLS_8             (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1))
0912 #define TYPE_HLS_8_PLANAR      (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0913 #define TYPE_HLS_16            (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2))
0914 #define TYPE_HLS_16_PLANAR     (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0915 #define TYPE_HLS_16_SE         (COLORSPACE_SH(PT_HLS)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0916 
0917 // HSV
0918 #define TYPE_HSV_8             (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1))
0919 #define TYPE_HSV_8_PLANAR      (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(1)|PLANAR_SH(1))
0920 #define TYPE_HSV_16            (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2))
0921 #define TYPE_HSV_16_PLANAR     (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|PLANAR_SH(1))
0922 #define TYPE_HSV_16_SE         (COLORSPACE_SH(PT_HSV)|CHANNELS_SH(3)|BYTES_SH(2)|ENDIAN16_SH(1))
0923 
0924 // Named color index. Only 16 bits is allowed (don't check colorspace)
0925 #define TYPE_NAMED_COLOR_INDEX (CHANNELS_SH(1)|BYTES_SH(2))
0926 
0927 // Float formatters.
0928 #define TYPE_XYZ_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(4))
0929 #define TYPE_Lab_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(4))
0930 #define TYPE_LabA_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
0931 #define TYPE_GRAY_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4))
0932 #define TYPE_GRAYA_FLT        (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4)|EXTRA_SH(1))
0933 #define TYPE_GRAYA_FLT_PREMUL (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(4)|EXTRA_SH(1)|PREMUL_SH(1))
0934 #define TYPE_RGB_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4))
0935 
0936 #define TYPE_RGBA_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
0937 #define TYPE_RGBA_FLT_PREMUL  (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|PREMUL_SH(1))
0938 #define TYPE_ARGB_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
0939 #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))
0940 #define TYPE_BGR_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
0941 #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))
0942 #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))
0943 #define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
0944 #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))
0945 
0946 #define TYPE_CMYK_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
0947 
0948 // Floating point formatters.
0949 // NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
0950 #define TYPE_XYZ_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
0951 #define TYPE_Lab_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
0952 #define TYPE_GRAY_DBL         (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
0953 #define TYPE_RGB_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
0954 #define TYPE_BGR_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)|DOSWAP_SH(1))
0955 #define TYPE_CMYK_DBL         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))
0956 #define TYPE_OKLAB_DBL        (FLOAT_SH(1)|COLORSPACE_SH(PT_MCH3)|CHANNELS_SH(3)|BYTES_SH(0))
0957 
0958 // IEEE 754-2008 "half"
0959 #define TYPE_GRAY_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
0960 #define TYPE_RGB_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
0961 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
0962 #define TYPE_CMYK_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
0963 
0964 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
0965 #define TYPE_ARGB_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
0966 #define TYPE_BGR_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
0967 #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))
0968 #define TYPE_ABGR_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
0969 
0970 #endif
0971 
0972 // Colorspaces
0973 typedef struct {
0974         cmsFloat64Number X;
0975         cmsFloat64Number Y;
0976         cmsFloat64Number Z;
0977 
0978     } cmsCIEXYZ;
0979 
0980 typedef struct {
0981         cmsFloat64Number x;
0982         cmsFloat64Number y;
0983         cmsFloat64Number Y;
0984 
0985     } cmsCIExyY;
0986 
0987 typedef struct {
0988         cmsFloat64Number L;
0989         cmsFloat64Number a;
0990         cmsFloat64Number b;
0991 
0992     } cmsCIELab;
0993 
0994 typedef struct {
0995         cmsFloat64Number L;
0996         cmsFloat64Number C;
0997         cmsFloat64Number h;
0998 
0999     } cmsCIELCh;
1000 
1001 typedef struct {
1002         cmsFloat64Number J;
1003         cmsFloat64Number C;
1004         cmsFloat64Number h;
1005 
1006     } cmsJCh;
1007 
1008 typedef struct {
1009         cmsCIEXYZ  Red;
1010         cmsCIEXYZ  Green;
1011         cmsCIEXYZ  Blue;
1012 
1013     } cmsCIEXYZTRIPLE;
1014 
1015 typedef struct {
1016         cmsCIExyY  Red;
1017         cmsCIExyY  Green;
1018         cmsCIExyY  Blue;
1019 
1020     } cmsCIExyYTRIPLE;
1021 
1022 // Illuminant types for structs below
1023 #define cmsILLUMINANT_TYPE_UNKNOWN 0x0000000
1024 #define cmsILLUMINANT_TYPE_D50     0x0000001
1025 #define cmsILLUMINANT_TYPE_D65     0x0000002
1026 #define cmsILLUMINANT_TYPE_D93     0x0000003
1027 #define cmsILLUMINANT_TYPE_F2      0x0000004
1028 #define cmsILLUMINANT_TYPE_D55     0x0000005
1029 #define cmsILLUMINANT_TYPE_A       0x0000006
1030 #define cmsILLUMINANT_TYPE_E       0x0000007
1031 #define cmsILLUMINANT_TYPE_F8      0x0000008
1032 
1033 typedef struct {
1034         cmsUInt32Number  Observer;    // 0 = unknown, 1=CIE 1931, 2=CIE 1964
1035         cmsCIEXYZ        Backing;     // Value of backing
1036         cmsUInt32Number  Geometry;    // 0=unknown, 1=45/0, 0/45 2=0d, d/0
1037         cmsFloat64Number Flare;       // 0..1.0
1038         cmsUInt32Number  IlluminantType;
1039 
1040     } cmsICCMeasurementConditions;
1041 
1042 typedef struct {
1043         cmsCIEXYZ       IlluminantXYZ;   // Not the same struct as CAM02,
1044         cmsCIEXYZ       SurroundXYZ;     // This is for storing the tag
1045         cmsUInt32Number IlluminantType;  // viewing condition
1046 
1047     } cmsICCViewingConditions;
1048 
1049 typedef struct {
1050     cmsUInt8Number  ColourPrimaries;            // Recommendation ITU-T H.273
1051     cmsUInt8Number  TransferCharacteristics;    //  (ISO/IEC 23091-2)
1052     cmsUInt8Number  MatrixCoefficients;
1053     cmsUInt8Number  VideoFullRangeFlag;
1054 
1055 } cmsVideoSignalType;
1056 
1057 typedef struct {
1058     cmsUInt32Number   CurveEntries;
1059     cmsFloat64Number* RedCurve;
1060     cmsFloat64Number* GreenCurve;
1061     cmsFloat64Number* BlueCurve;
1062 
1063     cmsFloat64Number  MinLuminance;         // ST.2086 min luminance in nits
1064     cmsFloat64Number  PeakLuminance;        // ST.2086 peak luminance in nits
1065 
1066     cmsFloat64Number XYZ2XYZmatrix[3][4];
1067 
1068 } cmsMHC2Type;
1069 
1070 
1071 
1072 // Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
1073 
1074 CMSAPI int               CMSEXPORT cmsGetEncodedCMMversion(void);
1075 
1076 // Support of non-standard functions --------------------------------------------------------------------------------------
1077 
1078 CMSAPI int               CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
1079 CMSAPI long int          CMSEXPORT cmsfilelength(FILE* f);
1080 
1081 
1082 // Context handling --------------------------------------------------------------------------------------------------------
1083 
1084 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1085 // though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1086 
1087 typedef struct _cmsContext_struct* cmsContext;
1088 
1089 CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);
1090 CMSAPI void             CMSEXPORT cmsDeleteContext(cmsContext ContextID);
1091 CMSAPI cmsContext       CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData);
1092 CMSAPI void*            CMSEXPORT cmsGetContextUserData(cmsContext ContextID);
1093 
1094 // Plug-In registering  --------------------------------------------------------------------------------------------------
1095 
1096 CMSAPI cmsBool           CMSEXPORT cmsPlugin(void* Plugin);
1097 CMSAPI cmsBool           CMSEXPORT cmsPluginTHR(cmsContext ContextID, void* Plugin);
1098 CMSAPI void              CMSEXPORT cmsUnregisterPlugins(void);
1099 CMSAPI void              CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID);
1100 
1101 // Error logging ----------------------------------------------------------------------------------------------------------
1102 
1103 // There is no error handling at all. When a function fails, it returns proper value.
1104 // For example, all create functions does return NULL on failure. Other may return FALSE.
1105 // It may be interesting, for the developer, to know why the function is failing.
1106 // for that reason, lcms2 does offer a logging function. This function will get
1107 // an ENGLISH string with some clues on what is going wrong. You can show this
1108 // info to the end user if you wish, or just create some sort of log on disk.
1109 // The logging function should NOT terminate the program, as this obviously can leave
1110 // unfreed resources. It is the programmer's responsibility to check each function
1111 // return code to make sure it didn't fail.
1112 
1113 #define cmsERROR_UNDEFINED                    0
1114 #define cmsERROR_FILE                         1
1115 #define cmsERROR_RANGE                        2
1116 #define cmsERROR_INTERNAL                     3
1117 #define cmsERROR_NULL                         4
1118 #define cmsERROR_READ                         5
1119 #define cmsERROR_SEEK                         6
1120 #define cmsERROR_WRITE                        7
1121 #define cmsERROR_UNKNOWN_EXTENSION            8
1122 #define cmsERROR_COLORSPACE_CHECK             9
1123 #define cmsERROR_ALREADY_DEFINED              10
1124 #define cmsERROR_BAD_SIGNATURE                11
1125 #define cmsERROR_CORRUPTION_DETECTED          12
1126 #define cmsERROR_NOT_SUITABLE                 13
1127 
1128 // Error logger is called with the ContextID when a message is raised. This gives the
1129 // chance to know which thread is responsible of the warning and any environment associated
1130 // with it. Non-multithreading applications may safely ignore this parameter.
1131 // Note that under certain special circumstances, ContextID may be NULL.
1132 typedef void  (* cmsLogErrorHandlerFunction)(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text);
1133 
1134 // Allows user to set any specific logger
1135 CMSAPI void              CMSEXPORT cmsSetLogErrorHandler(cmsLogErrorHandlerFunction Fn);
1136 CMSAPI void              CMSEXPORT cmsSetLogErrorHandlerTHR(cmsContext ContextID, cmsLogErrorHandlerFunction Fn);
1137 
1138 // Conversions --------------------------------------------------------------------------------------------------------------
1139 
1140 // Returns pointers to constant structs
1141 CMSAPI const cmsCIEXYZ*  CMSEXPORT cmsD50_XYZ(void);
1142 CMSAPI const cmsCIExyY*  CMSEXPORT cmsD50_xyY(void);
1143 
1144 // Colorimetric space conversions
1145 CMSAPI void              CMSEXPORT cmsXYZ2xyY(cmsCIExyY* Dest, const cmsCIEXYZ* Source);
1146 CMSAPI void              CMSEXPORT cmsxyY2XYZ(cmsCIEXYZ* Dest, const cmsCIExyY* Source);
1147 CMSAPI void              CMSEXPORT cmsXYZ2Lab(const cmsCIEXYZ* WhitePoint, cmsCIELab* Lab, const cmsCIEXYZ* xyz);
1148 CMSAPI void              CMSEXPORT cmsLab2XYZ(const cmsCIEXYZ* WhitePoint, cmsCIEXYZ* xyz, const cmsCIELab* Lab);
1149 CMSAPI void              CMSEXPORT cmsLab2LCh(cmsCIELCh*LCh, const cmsCIELab* Lab);
1150 CMSAPI void              CMSEXPORT cmsLCh2Lab(cmsCIELab* Lab, const cmsCIELCh* LCh);
1151 
1152 // Encoding /Decoding on PCS
1153 CMSAPI void              CMSEXPORT cmsLabEncoded2Float(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1154 CMSAPI void              CMSEXPORT cmsLabEncoded2FloatV2(cmsCIELab* Lab, const cmsUInt16Number wLab[3]);
1155 CMSAPI void              CMSEXPORT cmsFloat2LabEncoded(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1156 CMSAPI void              CMSEXPORT cmsFloat2LabEncodedV2(cmsUInt16Number wLab[3], const cmsCIELab* Lab);
1157 CMSAPI void              CMSEXPORT cmsXYZEncoded2Float(cmsCIEXYZ* fxyz, const cmsUInt16Number XYZ[3]);
1158 CMSAPI void              CMSEXPORT cmsFloat2XYZEncoded(cmsUInt16Number XYZ[3], const cmsCIEXYZ* fXYZ);
1159 
1160 // DeltaE metrics
1161 CMSAPI cmsFloat64Number  CMSEXPORT cmsDeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1162 CMSAPI cmsFloat64Number  CMSEXPORT cmsCIE94DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1163 CMSAPI cmsFloat64Number  CMSEXPORT cmsBFDdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2);
1164 CMSAPI cmsFloat64Number  CMSEXPORT cmsCMCdeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number l, cmsFloat64Number c);
1165 CMSAPI cmsFloat64Number  CMSEXPORT cmsCIE2000DeltaE(const cmsCIELab* Lab1, const cmsCIELab* Lab2, cmsFloat64Number Kl, cmsFloat64Number Kc, cmsFloat64Number Kh);
1166 
1167 // Temperature <-> Chromaticity (Black body)
1168 CMSAPI cmsBool           CMSEXPORT cmsWhitePointFromTemp(cmsCIExyY* WhitePoint, cmsFloat64Number  TempK);
1169 CMSAPI cmsBool           CMSEXPORT cmsTempFromWhitePoint(cmsFloat64Number* TempK, const cmsCIExyY* WhitePoint);
1170 
1171 // Chromatic adaptation
1172 CMSAPI cmsBool           CMSEXPORT cmsAdaptToIlluminant(cmsCIEXYZ* Result, const cmsCIEXYZ* SourceWhitePt,
1173                                                                            const cmsCIEXYZ* Illuminant,
1174                                                                            const cmsCIEXYZ* Value);
1175 
1176 // CIECAM02 ---------------------------------------------------------------------------------------------------
1177 
1178 // Viewing conditions. Please note those are CAM model viewing conditions, and not the ICC tag viewing
1179 // conditions, which I'm naming cmsICCViewingConditions to make differences evident. Unfortunately, the tag
1180 // cannot deal with surround La, Yb and D value so is basically useless to store CAM02 viewing conditions.
1181 
1182 
1183 #define AVG_SURROUND       1
1184 #define DIM_SURROUND       2
1185 #define DARK_SURROUND      3
1186 #define CUTSHEET_SURROUND  4
1187 
1188 #define D_CALCULATE        (-1)
1189 
1190 typedef struct {
1191     cmsCIEXYZ        whitePoint;
1192     cmsFloat64Number Yb;
1193     cmsFloat64Number La;
1194     cmsUInt32Number  surround;
1195     cmsFloat64Number D_value;
1196 
1197     } cmsViewingConditions;
1198 
1199 CMSAPI cmsHANDLE         CMSEXPORT cmsCIECAM02Init(cmsContext ContextID, const cmsViewingConditions* pVC);
1200 CMSAPI void              CMSEXPORT cmsCIECAM02Done(cmsHANDLE hModel);
1201 CMSAPI void              CMSEXPORT cmsCIECAM02Forward(cmsHANDLE hModel, const cmsCIEXYZ* pIn, cmsJCh* pOut);
1202 CMSAPI void              CMSEXPORT cmsCIECAM02Reverse(cmsHANDLE hModel, const cmsJCh* pIn,    cmsCIEXYZ* pOut);
1203 
1204 
1205 // Tone curves -----------------------------------------------------------------------------------------
1206 
1207 // This describes a curve segment. For a table of supported types, see the manual. User can increase the number of
1208 // available types by using a proper plug-in. Parametric segments allow 10 parameters at most
1209 
1210 typedef struct {
1211     cmsFloat32Number   x0, x1;           // Domain; for x0 < x <= x1
1212     cmsInt32Number     Type;             // Parametric type, Type == 0 means sampled segment. Negative values are reserved
1213     cmsFloat64Number   Params[10];       // Parameters if Type != 0
1214     cmsUInt32Number    nGridPoints;      // Number of grid points if Type == 0
1215     cmsFloat32Number*  SampledPoints;    // Points to an array of floats if Type == 0
1216 
1217 } cmsCurveSegment;
1218 
1219 // The internal representation is none of your business.
1220 typedef struct _cms_curve_struct cmsToneCurve;
1221 
1222 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]);
1223 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1224 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1225 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]);
1226 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1227 CMSAPI void              CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1228 CMSAPI void              CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1229 CMSAPI cmsToneCurve*     CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1230 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1231 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma);
1232 CMSAPI cmsToneCurve*     CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X,  const cmsToneCurve* Y, cmsUInt32Number nPoints);
1233 CMSAPI cmsBool           CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1234 CMSAPI cmsFloat32Number  CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1235 CMSAPI cmsUInt16Number   CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1236 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1237 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1238 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1239 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1240 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1241 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1242 
1243 CMSAPI const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t);
1244 
1245 // Tone curve tabular estimation
1246 CMSAPI cmsUInt32Number         CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1247 CMSAPI const cmsUInt16Number*  CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1248 
1249 
1250 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1251 
1252 // Nothing to see here, move along
1253 typedef struct _cmsPipeline_struct cmsPipeline;
1254 typedef struct _cmsStage_struct cmsStage;
1255 
1256 // Those are hi-level pipelines
1257 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1258 CMSAPI void              CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1259 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1260 
1261 CMSAPI cmsContext        CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1262 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1263 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);
1264 
1265 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineStageCount(const cmsPipeline* lut);
1266 CMSAPI cmsStage*         CMSEXPORT cmsPipelineGetPtrToFirstStage(const cmsPipeline* lut);
1267 CMSAPI cmsStage*         CMSEXPORT cmsPipelineGetPtrToLastStage(const cmsPipeline* lut);
1268 
1269 CMSAPI void              CMSEXPORT cmsPipelineEval16(const cmsUInt16Number In[], cmsUInt16Number Out[], const cmsPipeline* lut);
1270 CMSAPI void              CMSEXPORT cmsPipelineEvalFloat(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsPipeline* lut);
1271 CMSAPI cmsBool           CMSEXPORT cmsPipelineEvalReverseFloat(cmsFloat32Number Target[], cmsFloat32Number Result[], cmsFloat32Number Hint[], const cmsPipeline* lut);
1272 CMSAPI cmsBool           CMSEXPORT cmsPipelineCat(cmsPipeline* l1, const cmsPipeline* l2);
1273 CMSAPI cmsBool           CMSEXPORT cmsPipelineSetSaveAs8bitsFlag(cmsPipeline* lut, cmsBool On);
1274 
1275 // Where to place/locate the stages in the pipeline chain
1276 typedef enum { cmsAT_BEGIN, cmsAT_END } cmsStageLoc;
1277 
1278 CMSAPI cmsBool           CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage* mpe);
1279 CMSAPI void              CMSEXPORT cmsPipelineUnlinkStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage** mpe);
1280 
1281 // This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements
1282 // that conform the Pipeline. It should be called with the Pipeline, the number of expected elements and
1283 // then a list of expected types followed with a list of double pointers to Stage elements. If
1284 // the function founds a match with current pipeline, it fills the pointers and returns TRUE
1285 // if not, returns FALSE without touching anything.
1286 CMSAPI cmsBool           CMSEXPORT cmsPipelineCheckAndRetreiveStages(const cmsPipeline* Lut, cmsUInt32Number n, ...);
1287 
1288 // Matrix has double precision and CLUT has only float precision. That is because an ICC profile can encode
1289 // matrices with far more precision that CLUTS
1290 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocIdentity(cmsContext ContextID, cmsUInt32Number nChannels);
1291 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocToneCurves(cmsContext ContextID, cmsUInt32Number nChannels, cmsToneCurve* const Curves[]);
1292 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number Rows, cmsUInt32Number Cols, const cmsFloat64Number* Matrix, const cmsFloat64Number* Offset);
1293 
1294 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLut16bit(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1295 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLutFloat(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1296 
1297 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1298 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1299 
1300 CMSAPI cmsStage*         CMSEXPORT cmsStageDup(cmsStage* mpe);
1301 CMSAPI void              CMSEXPORT cmsStageFree(cmsStage* mpe);
1302 CMSAPI cmsStage*         CMSEXPORT cmsStageNext(const cmsStage* mpe);
1303 
1304 CMSAPI cmsUInt32Number   CMSEXPORT cmsStageInputChannels(const cmsStage* mpe);
1305 CMSAPI cmsUInt32Number   CMSEXPORT cmsStageOutputChannels(const cmsStage* mpe);
1306 CMSAPI cmsStageSignature CMSEXPORT cmsStageType(const cmsStage* mpe);
1307 CMSAPI void*             CMSEXPORT cmsStageData(const cmsStage* mpe);
1308 CMSAPI cmsContext        CMSEXPORT cmsGetStageContextID(const cmsStage* mpe);
1309 
1310 // Sampling
1311 typedef cmsInt32Number (* cmsSAMPLER16)   (CMSREGISTER const cmsUInt16Number In[],
1312                                            CMSREGISTER cmsUInt16Number Out[],
1313                                            CMSREGISTER void * Cargo);
1314 
1315 typedef cmsInt32Number (* cmsSAMPLERFLOAT)(CMSREGISTER const cmsFloat32Number In[],
1316                                            CMSREGISTER cmsFloat32Number Out[],
1317                                            CMSREGISTER void * Cargo);
1318 
1319 // Use this flag to prevent changes being written to destination
1320 #define SAMPLER_INSPECT     0x01000000
1321 
1322 // For CLUT only
1323 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1324 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1325 
1326 // Slicers
1327 CMSAPI cmsBool           CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1328                                                    cmsSAMPLER16 Sampler, void * Cargo);
1329 
1330 CMSAPI cmsBool           CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1331                                                    cmsSAMPLERFLOAT Sampler, void * Cargo);
1332 
1333 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1334 
1335 typedef struct _cms_MLU_struct cmsMLU;
1336 
1337 #define  cmsNoLanguage    "\0\0"
1338 #define  cmsNoCountry     "\0\0"
1339 
1340 // Special language/country to retrieve unicode field for description in V2 profiles. Use with care.
1341 #define  cmsV2Unicode     "\xff\xff"
1342 
1343 CMSAPI cmsMLU*           CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems);
1344 CMSAPI void              CMSEXPORT cmsMLUfree(cmsMLU* mlu);
1345 CMSAPI cmsMLU*           CMSEXPORT cmsMLUdup(const cmsMLU* mlu);
1346 
1347 CMSAPI cmsBool           CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu,
1348                                                   const char LanguageCode[3], const char CountryCode[3],
1349                                                   const char* ASCIIString);
1350 CMSAPI cmsBool           CMSEXPORT cmsMLUsetWide(cmsMLU* mlu,
1351                                                   const char LanguageCode[3], const char CountryCode[3],
1352                                                   const wchar_t* WideString);
1353 CMSAPI cmsBool           CMSEXPORT cmsMLUsetUTF8(cmsMLU* mlu,
1354                                                   const char LanguageCode[3], const char CountryCode[3],
1355                                                   const char* UTF8String);
1356 
1357 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
1358                                                   const char LanguageCode[3], const char CountryCode[3],
1359                                                   char* Buffer,    cmsUInt32Number BufferSize);
1360 
1361 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
1362                                                  const char LanguageCode[3], const char CountryCode[3],
1363                                                  wchar_t* Buffer, cmsUInt32Number BufferSize);
1364 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetUTF8(const cmsMLU* mlu,
1365                                                  const char LanguageCode[3], const char CountryCode[3],
1366                                                  char* Buffer, cmsUInt32Number BufferSize);
1367 
1368 
1369 CMSAPI cmsBool           CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
1370                                                          const char LanguageCode[3], const char CountryCode[3],
1371                                                          char ObtainedLanguage[3], char ObtainedCountry[3]);
1372 
1373 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUtranslationsCount(const cmsMLU* mlu);
1374 
1375 CMSAPI cmsBool           CMSEXPORT cmsMLUtranslationsCodes(const cmsMLU* mlu,
1376                                                              cmsUInt32Number idx,
1377                                                              char LanguageCode[3],
1378                                                              char CountryCode[3]);
1379  
1380 // Undercolorremoval & black generation -------------------------------------------------------------------------------------
1381 
1382 typedef struct {
1383         cmsToneCurve* Ucr;
1384         cmsToneCurve* Bg;
1385         cmsMLU*       Desc;
1386 
1387 } cmsUcrBg;
1388 
1389 // Screening ----------------------------------------------------------------------------------------------------------------
1390 
1391 #define cmsPRINTER_DEFAULT_SCREENS     0x0001
1392 #define cmsFREQUENCE_UNITS_LINES_CM    0x0000
1393 #define cmsFREQUENCE_UNITS_LINES_INCH  0x0002
1394 
1395 #define cmsSPOT_UNKNOWN         0
1396 #define cmsSPOT_PRINTER_DEFAULT 1
1397 #define cmsSPOT_ROUND           2
1398 #define cmsSPOT_DIAMOND         3
1399 #define cmsSPOT_ELLIPSE         4
1400 #define cmsSPOT_LINE            5
1401 #define cmsSPOT_SQUARE          6
1402 #define cmsSPOT_CROSS           7
1403 
1404 typedef struct {
1405     cmsFloat64Number  Frequency;
1406     cmsFloat64Number  ScreenAngle;
1407     cmsUInt32Number   SpotShape;
1408 
1409 } cmsScreeningChannel;
1410 
1411 typedef struct {
1412     cmsUInt32Number Flag;
1413     cmsUInt32Number nChannels;
1414     cmsScreeningChannel Channels[cmsMAXCHANNELS];
1415 
1416 } cmsScreening;
1417 
1418 
1419 // Named color -----------------------------------------------------------------------------------------------------------------
1420 
1421 typedef struct _cms_NAMEDCOLORLIST_struct cmsNAMEDCOLORLIST;
1422 
1423 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNamedColorList(cmsContext ContextID,
1424                                                            cmsUInt32Number n,
1425                                                            cmsUInt32Number ColorantCount,
1426                                                            const char* Prefix, const char* Suffix);
1427 
1428 CMSAPI void               CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v);
1429 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v);
1430 CMSAPI cmsBool            CMSEXPORT cmsAppendNamedColor(cmsNAMEDCOLORLIST* v, const char* Name,
1431                                                             cmsUInt16Number PCS[3],
1432                                                             cmsUInt16Number Colorant[cmsMAXCHANNELS]);
1433 
1434 CMSAPI cmsUInt32Number    CMSEXPORT cmsNamedColorCount(const cmsNAMEDCOLORLIST* v);
1435 CMSAPI cmsInt32Number     CMSEXPORT cmsNamedColorIndex(const cmsNAMEDCOLORLIST* v, const char* Name);
1436 
1437 CMSAPI cmsBool            CMSEXPORT cmsNamedColorInfo(const cmsNAMEDCOLORLIST* NamedColorList, cmsUInt32Number nColor,
1438                                                       char* Name,
1439                                                       char* Prefix,
1440                                                       char* Suffix,
1441                                                       cmsUInt16Number* PCS,
1442                                                       cmsUInt16Number* Colorant);
1443 
1444 // Retrieve named color list from transform
1445 CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsGetNamedColorList(cmsHTRANSFORM xform);
1446 
1447 // Profile sequence -----------------------------------------------------------------------------------------------------
1448 
1449 // Profile sequence descriptor. Some fields come from profile sequence descriptor tag, others
1450 // come from Profile Sequence Identifier Tag
1451 typedef struct {
1452 
1453     cmsSignature           deviceMfg;
1454     cmsSignature           deviceModel;
1455     cmsUInt64Number        attributes;
1456     cmsTechnologySignature technology;
1457     cmsProfileID           ProfileID;
1458     cmsMLU*                Manufacturer;
1459     cmsMLU*                Model;
1460     cmsMLU*                Description;
1461 
1462 } cmsPSEQDESC;
1463 
1464 typedef struct {
1465 
1466     cmsUInt32Number n;
1467     cmsContext      ContextID;
1468     cmsPSEQDESC*    seq;
1469 
1470 } cmsSEQ;
1471 
1472 CMSAPI cmsSEQ*           CMSEXPORT cmsAllocProfileSequenceDescription(cmsContext ContextID, cmsUInt32Number n);
1473 CMSAPI cmsSEQ*           CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq);
1474 CMSAPI void              CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq);
1475 
1476 // Dictionaries --------------------------------------------------------------------------------------------------------
1477 
1478 typedef struct _cmsDICTentry_struct {
1479 
1480     struct _cmsDICTentry_struct* Next;
1481 
1482     cmsMLU *DisplayName;
1483     cmsMLU *DisplayValue;
1484     wchar_t* Name;
1485     wchar_t* Value;
1486 
1487 } cmsDICTentry;
1488 
1489 CMSAPI cmsHANDLE           CMSEXPORT cmsDictAlloc(cmsContext ContextID);
1490 CMSAPI void                CMSEXPORT cmsDictFree(cmsHANDLE hDict);
1491 CMSAPI cmsHANDLE           CMSEXPORT cmsDictDup(cmsHANDLE hDict);
1492 
1493 CMSAPI cmsBool             CMSEXPORT cmsDictAddEntry(cmsHANDLE hDict, const wchar_t* Name, const wchar_t* Value, const cmsMLU *DisplayName, const cmsMLU *DisplayValue);
1494 CMSAPI const cmsDICTentry* CMSEXPORT cmsDictGetEntryList(cmsHANDLE hDict);
1495 CMSAPI const cmsDICTentry* CMSEXPORT cmsDictNextEntry(const cmsDICTentry* e);
1496 
1497 // Access to Profile data ----------------------------------------------------------------------------------------------
1498 CMSAPI cmsHPROFILE       CMSEXPORT cmsCreateProfilePlaceholder(cmsContext ContextID);
1499 
1500 CMSAPI cmsContext        CMSEXPORT cmsGetProfileContextID(cmsHPROFILE hProfile);
1501 CMSAPI cmsInt32Number    CMSEXPORT cmsGetTagCount(cmsHPROFILE hProfile);
1502 CMSAPI cmsTagSignature   CMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, cmsUInt32Number n);
1503 CMSAPI cmsBool           CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1504 
1505 // Read and write pre-formatted data
1506 CMSAPI void*             CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig);
1507 CMSAPI cmsBool           CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data);
1508 CMSAPI cmsBool           CMSEXPORT cmsLinkTag(cmsHPROFILE hProfile, cmsTagSignature sig, cmsTagSignature dest);
1509 CMSAPI cmsTagSignature   CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig);
1510 
1511 // Read and write raw data
1512 CMSAPI cmsUInt32Number   CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize);
1513 CMSAPI cmsBool           CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size);
1514 
1515 // Access header data
1516 #define cmsEmbeddedProfileFalse    0x00000000
1517 #define cmsEmbeddedProfileTrue     0x00000001
1518 #define cmsUseAnywhere             0x00000000
1519 #define cmsUseWithEmbeddedDataOnly 0x00000002
1520 
1521 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetHeaderFlags(cmsHPROFILE hProfile);
1522 CMSAPI void              CMSEXPORT cmsGetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number* Flags);
1523 CMSAPI void              CMSEXPORT cmsGetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1524 CMSAPI cmsBool           CMSEXPORT cmsGetHeaderCreationDateTime(cmsHPROFILE hProfile, struct tm *Dest);
1525 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetHeaderRenderingIntent(cmsHPROFILE hProfile);
1526 
1527 CMSAPI void              CMSEXPORT cmsSetHeaderFlags(cmsHPROFILE hProfile, cmsUInt32Number Flags);
1528 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetHeaderManufacturer(cmsHPROFILE hProfile);
1529 CMSAPI void              CMSEXPORT cmsSetHeaderManufacturer(cmsHPROFILE hProfile, cmsUInt32Number manufacturer);
1530 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetHeaderCreator(cmsHPROFILE hProfile);
1531 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetHeaderModel(cmsHPROFILE hProfile);
1532 CMSAPI void              CMSEXPORT cmsSetHeaderModel(cmsHPROFILE hProfile, cmsUInt32Number model);
1533 CMSAPI void              CMSEXPORT cmsSetHeaderAttributes(cmsHPROFILE hProfile, cmsUInt64Number Flags);
1534 CMSAPI void              CMSEXPORT cmsSetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID);
1535 CMSAPI void              CMSEXPORT cmsSetHeaderRenderingIntent(cmsHPROFILE hProfile, cmsUInt32Number RenderingIntent);
1536 
1537 CMSAPI cmsColorSpaceSignature
1538                          CMSEXPORT cmsGetPCS(cmsHPROFILE hProfile);
1539 CMSAPI void              CMSEXPORT cmsSetPCS(cmsHPROFILE hProfile, cmsColorSpaceSignature pcs);
1540 CMSAPI cmsColorSpaceSignature
1541                          CMSEXPORT cmsGetColorSpace(cmsHPROFILE hProfile);
1542 CMSAPI void              CMSEXPORT cmsSetColorSpace(cmsHPROFILE hProfile, cmsColorSpaceSignature sig);
1543 CMSAPI cmsProfileClassSignature
1544                          CMSEXPORT cmsGetDeviceClass(cmsHPROFILE hProfile);
1545 CMSAPI void              CMSEXPORT cmsSetDeviceClass(cmsHPROFILE hProfile, cmsProfileClassSignature sig);
1546 CMSAPI void              CMSEXPORT cmsSetProfileVersion(cmsHPROFILE hProfile, cmsFloat64Number Version);
1547 CMSAPI cmsFloat64Number  CMSEXPORT cmsGetProfileVersion(cmsHPROFILE hProfile);
1548 
1549 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetEncodedICCversion(cmsHPROFILE hProfile);
1550 CMSAPI void              CMSEXPORT cmsSetEncodedICCversion(cmsHPROFILE hProfile, cmsUInt32Number Version);
1551 
1552 // How profiles may be used
1553 #define LCMS_USED_AS_INPUT      0
1554 #define LCMS_USED_AS_OUTPUT     1
1555 #define LCMS_USED_AS_PROOF      2
1556 
1557 CMSAPI cmsBool           CMSEXPORT cmsIsIntentSupported(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1558 CMSAPI cmsBool           CMSEXPORT cmsIsMatrixShaper(cmsHPROFILE hProfile);
1559 CMSAPI cmsBool           CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection);
1560 
1561 // Translate form/to our notation to ICC
1562 CMSAPI cmsColorSpaceSignature   CMSEXPORT _cmsICCcolorSpace(int OurNotation);
1563 CMSAPI int                      CMSEXPORT _cmsLCMScolorSpace(cmsColorSpaceSignature ProfileSpace);
1564 
1565 // Deprecated, use cmsChannelsOfColorSpace instead
1566 CMSAPI cmsUInt32Number   CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace);
1567 
1568 // Get number of channels of color space or -1 if color space is not listed/supported
1569 CMSAPI cmsInt32Number CMSEXPORT cmsChannelsOfColorSpace(cmsColorSpaceSignature ColorSpace);
1570 
1571 // Build a suitable formatter for the colorspace of this profile. nBytes=1 means 8 bits, nBytes=2 means 16 bits. 
1572 CMSAPI cmsUInt32Number   CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1573 CMSAPI cmsUInt32Number   CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1574 
1575 
1576 // Localized info
1577 typedef enum {
1578              cmsInfoDescription  = 0,
1579              cmsInfoManufacturer = 1,
1580              cmsInfoModel        = 2,
1581              cmsInfoCopyright    = 3
1582 } cmsInfoType;
1583 
1584 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetProfileInfo(cmsHPROFILE hProfile, cmsInfoType Info,
1585                                                             const char LanguageCode[3], const char CountryCode[3],
1586                                                             wchar_t* Buffer, cmsUInt32Number BufferSize);
1587 
1588 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
1589                                                             const char LanguageCode[3], const char CountryCode[3],
1590                                                             char* Buffer, cmsUInt32Number BufferSize);
1591 
1592 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetProfileInfoUTF8(cmsHPROFILE hProfile, cmsInfoType Info,
1593                                                             const char LanguageCode[3], const char CountryCode[3],
1594                                                             char* Buffer, cmsUInt32Number BufferSize);
1595 
1596 // IO handlers ----------------------------------------------------------------------------------------------------------
1597 
1598 typedef struct _cms_io_handler cmsIOHANDLER;
1599 
1600 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const char* FileName, const char* AccessMode);
1601 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
1602 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
1603 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
1604 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsGetProfileIOhandler(cmsHPROFILE hProfile);
1605 CMSAPI cmsBool           CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);
1606 
1607 // MD5 message digest --------------------------------------------------------------------------------------------------
1608 
1609 CMSAPI cmsBool           CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile);
1610 
1611 // Profile high level functions ------------------------------------------------------------------------------------------
1612 
1613 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
1614 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess);
1615 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char* sAccess);
1616 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromStreamTHR(cmsContext ContextID, FILE* ICCProfile, const char* sAccess);
1617 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromMem(const void * MemPtr, cmsUInt32Number dwSize);
1618 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromMemTHR(cmsContext ContextID, const void * MemPtr, cmsUInt32Number dwSize);
1619 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromIOhandlerTHR(cmsContext ContextID, cmsIOHANDLER* io);
1620 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromIOhandler2THR(cmsContext ContextID, cmsIOHANDLER* io, cmsBool write);
1621 CMSAPI cmsBool          CMSEXPORT cmsCloseProfile(cmsHPROFILE hProfile);
1622 
1623 CMSAPI cmsBool          CMSEXPORT cmsSaveProfileToFile(cmsHPROFILE hProfile, const char* FileName);
1624 CMSAPI cmsBool          CMSEXPORT cmsSaveProfileToStream(cmsHPROFILE hProfile, FILE* Stream);
1625 CMSAPI cmsBool          CMSEXPORT cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr, cmsUInt32Number* BytesNeeded);
1626 CMSAPI cmsUInt32Number  CMSEXPORT cmsSaveProfileToIOhandler(cmsHPROFILE hProfile, cmsIOHANDLER* io);
1627 
1628 // Predefined virtual profiles ------------------------------------------------------------------------------------------
1629 
1630 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateRGBProfileTHR(cmsContext ContextID,
1631                                                    const cmsCIExyY* WhitePoint,
1632                                                    const cmsCIExyYTRIPLE* Primaries,
1633                                                    cmsToneCurve* const TransferFunction[3]);
1634 
1635 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateRGBProfile(const cmsCIExyY* WhitePoint,
1636                                                    const cmsCIExyYTRIPLE* Primaries,
1637                                                    cmsToneCurve* const TransferFunction[3]);
1638 
1639 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
1640                                                     const cmsCIExyY* WhitePoint,
1641                                                     const cmsToneCurve* TransferFunction);
1642 
1643 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateGrayProfile(const cmsCIExyY* WhitePoint,
1644                                                     const cmsToneCurve* TransferFunction);
1645 
1646 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
1647                                                                 cmsColorSpaceSignature ColorSpace,
1648                                                                 cmsToneCurve* const TransferFunctions[]);
1649 
1650 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLinearizationDeviceLink(cmsColorSpaceSignature ColorSpace,
1651                                                                 cmsToneCurve* const TransferFunctions[]);
1652 
1653 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
1654                                                               cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1655 
1656 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateInkLimitingDeviceLink(cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1657 
1658 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateDeviceLinkFromCubeFile(const char* cFileName);
1659 
1660 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateDeviceLinkFromCubeFileTHR(cmsContext ContextID, const char* cFileName);
1661 
1662 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1663 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab2Profile(const cmsCIExyY* WhitePoint);
1664 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1665 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab4Profile(const cmsCIExyY* WhitePoint);
1666 
1667 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID);
1668 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateXYZProfile(void);
1669 
1670 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_sRGBProfileTHR(cmsContext ContextID);
1671 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_sRGBProfile(void);
1672 
1673 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_OkLabProfile(cmsContext ctx);
1674 
1675 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
1676                                                              cmsUInt32Number nLUTPoints,
1677                                                              cmsFloat64Number Bright,
1678                                                              cmsFloat64Number Contrast,
1679                                                              cmsFloat64Number Hue,
1680                                                              cmsFloat64Number Saturation,
1681                                                              cmsUInt32Number TempSrc,
1682                                                              cmsUInt32Number TempDest);
1683 
1684 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateBCHSWabstractProfile(cmsUInt32Number nLUTPoints,
1685                                                              cmsFloat64Number Bright,
1686                                                              cmsFloat64Number Contrast,
1687                                                              cmsFloat64Number Hue,
1688                                                              cmsFloat64Number Saturation,
1689                                                              cmsUInt32Number TempSrc,
1690                                                              cmsUInt32Number TempDest);
1691 
1692 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID);
1693 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateNULLProfile(void);
1694 
1695 // Converts a transform to a devicelink profile
1696 CMSAPI cmsHPROFILE      CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat64Number Version, cmsUInt32Number dwFlags);
1697 
1698 // Intents ----------------------------------------------------------------------------------------------
1699 
1700 // ICC Intents
1701 #define INTENT_PERCEPTUAL                              0
1702 #define INTENT_RELATIVE_COLORIMETRIC                   1
1703 #define INTENT_SATURATION                              2
1704 #define INTENT_ABSOLUTE_COLORIMETRIC                   3
1705 
1706 // Non-ICC intents
1707 #define INTENT_PRESERVE_K_ONLY_PERCEPTUAL             10
1708 #define INTENT_PRESERVE_K_ONLY_RELATIVE_COLORIMETRIC  11
1709 #define INTENT_PRESERVE_K_ONLY_SATURATION             12
1710 #define INTENT_PRESERVE_K_PLANE_PERCEPTUAL            13
1711 #define INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC 14
1712 #define INTENT_PRESERVE_K_PLANE_SATURATION            15
1713 
1714 // Call with NULL as parameters to get the intent count
1715 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1716 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID, cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1717 
1718 // Flags
1719 
1720 #define cmsFLAGS_NOCACHE                  0x0040    // Inhibit 1-pixel cache
1721 #define cmsFLAGS_NOOPTIMIZE               0x0100    // Inhibit optimizations
1722 #define cmsFLAGS_NULLTRANSFORM            0x0200    // Don't transform anyway
1723 
1724 // Proofing flags
1725 #define cmsFLAGS_GAMUTCHECK               0x1000    // Out of Gamut alarm
1726 #define cmsFLAGS_SOFTPROOFING             0x4000    // Do softproofing
1727 
1728 // Misc
1729 #define cmsFLAGS_BLACKPOINTCOMPENSATION   0x2000
1730 #define cmsFLAGS_NOWHITEONWHITEFIXUP      0x0004    // Don't fix scum dot
1731 #define cmsFLAGS_HIGHRESPRECALC           0x0400    // Use more memory to give better accuracy
1732 #define cmsFLAGS_LOWRESPRECALC            0x0800    // Use less memory to minimize resources
1733 
1734 // For devicelink creation
1735 #define cmsFLAGS_8BITS_DEVICELINK         0x0008   // Create 8 bits devicelinks
1736 #define cmsFLAGS_GUESSDEVICECLASS         0x0020   // Guess device class (for transform2devicelink)
1737 #define cmsFLAGS_KEEP_SEQUENCE            0x0080   // Keep profile sequence for devicelink creation
1738 
1739 // Specific to a particular optimizations
1740 #define cmsFLAGS_FORCE_CLUT               0x0002    // Force CLUT optimization
1741 #define cmsFLAGS_CLUT_POST_LINEARIZATION  0x0001    // create postlinearization tables if possible
1742 #define cmsFLAGS_CLUT_PRE_LINEARIZATION   0x0010    // create prelinearization tables if possible
1743 
1744 // Specific to unbounded mode
1745 #define cmsFLAGS_NONEGATIVES              0x8000    // Prevent negative numbers in floating point transforms
1746 
1747 // Copy alpha channels when transforming           
1748 #define cmsFLAGS_COPY_ALPHA               0x04000000 // Alpha channels are copied on cmsDoTransform()
1749 
1750 // Fine-tune control over number of gridpoints
1751 #define cmsFLAGS_GRIDPOINTS(n)           (((n) & 0xFF) << 16)
1752 
1753 // CRD special
1754 #define cmsFLAGS_NODEFAULTRESOURCEDEF     0x01000000
1755 
1756 // Transforms ---------------------------------------------------------------------------------------------------
1757 
1758 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateTransformTHR(cmsContext ContextID,
1759                                                   cmsHPROFILE Input,
1760                                                   cmsUInt32Number InputFormat,
1761                                                   cmsHPROFILE Output,
1762                                                   cmsUInt32Number OutputFormat,
1763                                                   cmsUInt32Number Intent,
1764                                                   cmsUInt32Number dwFlags);
1765 
1766 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateTransform(cmsHPROFILE Input,
1767                                                   cmsUInt32Number InputFormat,
1768                                                   cmsHPROFILE Output,
1769                                                   cmsUInt32Number OutputFormat,
1770                                                   cmsUInt32Number Intent,
1771                                                   cmsUInt32Number dwFlags);
1772 
1773 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateProofingTransformTHR(cmsContext ContextID,
1774                                                   cmsHPROFILE Input,
1775                                                   cmsUInt32Number InputFormat,
1776                                                   cmsHPROFILE Output,
1777                                                   cmsUInt32Number OutputFormat,
1778                                                   cmsHPROFILE Proofing,
1779                                                   cmsUInt32Number Intent,
1780                                                   cmsUInt32Number ProofingIntent,
1781                                                   cmsUInt32Number dwFlags);
1782 
1783 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateProofingTransform(cmsHPROFILE Input,
1784                                                   cmsUInt32Number InputFormat,
1785                                                   cmsHPROFILE Output,
1786                                                   cmsUInt32Number OutputFormat,
1787                                                   cmsHPROFILE Proofing,
1788                                                   cmsUInt32Number Intent,
1789                                                   cmsUInt32Number ProofingIntent,
1790                                                   cmsUInt32Number dwFlags);
1791 
1792 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateMultiprofileTransformTHR(cmsContext ContextID,
1793                                                   cmsHPROFILE hProfiles[],
1794                                                   cmsUInt32Number nProfiles,
1795                                                   cmsUInt32Number InputFormat,
1796                                                   cmsUInt32Number OutputFormat,
1797                                                   cmsUInt32Number Intent,
1798                                                   cmsUInt32Number dwFlags);
1799 
1800 
1801 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[],
1802                                                   cmsUInt32Number nProfiles,
1803                                                   cmsUInt32Number InputFormat,
1804                                                   cmsUInt32Number OutputFormat,
1805                                                   cmsUInt32Number Intent,
1806                                                   cmsUInt32Number dwFlags);
1807 
1808 
1809 CMSAPI cmsHTRANSFORM    CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
1810                                                    cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[],
1811                                                    cmsBool  BPC[],
1812                                                    cmsUInt32Number Intents[],
1813                                                    cmsFloat64Number AdaptationStates[],
1814                                                    cmsHPROFILE hGamutProfile,
1815                                                    cmsUInt32Number nGamutPCSposition,
1816                                                    cmsUInt32Number InputFormat,
1817                                                    cmsUInt32Number OutputFormat,
1818                                                    cmsUInt32Number dwFlags);
1819 
1820 CMSAPI void             CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform);
1821 
1822 CMSAPI void             CMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform,
1823                                                  const void * InputBuffer,
1824                                                  void * OutputBuffer,
1825                                                  cmsUInt32Number Size);
1826 
1827 CMSAPI void             CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,   // Deprecated
1828                                                  const void * InputBuffer,
1829                                                  void * OutputBuffer,
1830                                                  cmsUInt32Number Size,
1831                                                  cmsUInt32Number Stride);
1832 
1833 CMSAPI void             CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM  Transform,
1834                                                  const void* InputBuffer,
1835                                                  void* OutputBuffer,
1836                                                  cmsUInt32Number PixelsPerLine,
1837                                                  cmsUInt32Number LineCount,
1838                                                  cmsUInt32Number BytesPerLineIn,
1839                                                  cmsUInt32Number BytesPerLineOut,
1840                                                  cmsUInt32Number BytesPerPlaneIn,
1841                                                  cmsUInt32Number BytesPerPlaneOut);
1842 
1843 
1844 CMSAPI void             CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1845 CMSAPI void             CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
1846 
1847 
1848 CMSAPI void             CMSEXPORT cmsSetAlarmCodesTHR(cmsContext ContextID, 
1849                                                           const cmsUInt16Number AlarmCodes[cmsMAXCHANNELS]);
1850 CMSAPI void             CMSEXPORT cmsGetAlarmCodesTHR(cmsContext ContextID, 
1851                                                           cmsUInt16Number AlarmCodes[cmsMAXCHANNELS]);
1852 
1853 
1854 
1855 // Adaptation state for absolute colorimetric intent
1856 CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d);
1857 CMSAPI cmsFloat64Number CMSEXPORT cmsSetAdaptationStateTHR(cmsContext ContextID, cmsFloat64Number d);
1858 
1859 
1860 
1861 // Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed
1862 CMSAPI cmsContext       CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform);
1863 
1864 // Grab the input/output formats
1865 CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform);
1866 CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform);
1867 
1868 // For backwards compatibility
1869 CMSAPI cmsBool          CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform,
1870                                                          cmsUInt32Number InputFormat,
1871                                                          cmsUInt32Number OutputFormat);
1872 
1873 
1874 
1875 // PostScript ColorRenderingDictionary and ColorSpaceArray ----------------------------------------------------
1876 
1877 typedef enum { cmsPS_RESOURCE_CSA, cmsPS_RESOURCE_CRD } cmsPSResourceType;
1878 
1879 // lcms2 unified method to access postscript color resources
1880 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetPostScriptColorResource(cmsContext ContextID,
1881                                                                 cmsPSResourceType Type,
1882                                                                 cmsHPROFILE hProfile,
1883                                                                 cmsUInt32Number Intent,
1884                                                                 cmsUInt32Number dwFlags,
1885                                                                 cmsIOHANDLER* io);
1886 
1887 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetPostScriptCSA(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1888 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetPostScriptCRD(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags, void* Buffer, cmsUInt32Number dwBufferLen);
1889 
1890 
1891 // IT8.7 / CGATS.17-200x handling -----------------------------------------------------------------------------
1892 
1893 CMSAPI cmsHANDLE        CMSEXPORT cmsIT8Alloc(cmsContext ContextID);
1894 CMSAPI void             CMSEXPORT cmsIT8Free(cmsHANDLE hIT8);
1895 
1896 // Tables
1897 CMSAPI cmsUInt32Number  CMSEXPORT cmsIT8TableCount(cmsHANDLE hIT8);
1898 CMSAPI cmsInt32Number   CMSEXPORT cmsIT8SetTable(cmsHANDLE hIT8, cmsUInt32Number nTable);
1899 
1900 // Persistence
1901 CMSAPI cmsHANDLE        CMSEXPORT cmsIT8LoadFromFile(cmsContext ContextID, const char* cFileName);
1902 CMSAPI cmsHANDLE        CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, const void *Ptr, cmsUInt32Number len);
1903 // CMSAPI cmsHANDLE        CMSEXPORT cmsIT8LoadFromIOhandler(cmsContext ContextID, cmsIOHANDLER* io);
1904 
1905 CMSAPI cmsBool          CMSEXPORT cmsIT8SaveToFile(cmsHANDLE hIT8, const char* cFileName);
1906 CMSAPI cmsBool          CMSEXPORT cmsIT8SaveToMem(cmsHANDLE hIT8, void *MemPtr, cmsUInt32Number* BytesNeeded);
1907 
1908 // Properties
1909 CMSAPI const char*      CMSEXPORT cmsIT8GetSheetType(cmsHANDLE hIT8);
1910 CMSAPI cmsBool          CMSEXPORT cmsIT8SetSheetType(cmsHANDLE hIT8, const char* Type);
1911 
1912 CMSAPI cmsBool          CMSEXPORT cmsIT8SetComment(cmsHANDLE hIT8, const char* cComment);
1913 
1914 CMSAPI cmsBool          CMSEXPORT cmsIT8SetPropertyStr(cmsHANDLE hIT8, const char* cProp, const char *Str);
1915 CMSAPI cmsBool          CMSEXPORT cmsIT8SetPropertyDbl(cmsHANDLE hIT8, const char* cProp, cmsFloat64Number Val);
1916 CMSAPI cmsBool          CMSEXPORT cmsIT8SetPropertyHex(cmsHANDLE hIT8, const char* cProp, cmsUInt32Number Val);
1917 CMSAPI cmsBool          CMSEXPORT cmsIT8SetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char* SubKey, const char *Buffer);
1918 CMSAPI cmsBool          CMSEXPORT cmsIT8SetPropertyUncooked(cmsHANDLE hIT8, const char* Key, const char* Buffer);
1919 
1920 
1921 CMSAPI const char*      CMSEXPORT cmsIT8GetProperty(cmsHANDLE hIT8, const char* cProp);
1922 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetPropertyDbl(cmsHANDLE hIT8, const char* cProp);
1923 CMSAPI const char*      CMSEXPORT cmsIT8GetPropertyMulti(cmsHANDLE hIT8, const char* Key, const char *SubKey);
1924 CMSAPI cmsUInt32Number  CMSEXPORT cmsIT8EnumProperties(cmsHANDLE hIT8, char ***PropertyNames);
1925 CMSAPI cmsUInt32Number  CMSEXPORT cmsIT8EnumPropertyMulti(cmsHANDLE hIT8, const char* cProp, const char ***SubpropertyNames);
1926 
1927 // Datasets
1928 CMSAPI const char*      CMSEXPORT cmsIT8GetDataRowCol(cmsHANDLE hIT8, int row, int col);
1929 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataRowColDbl(cmsHANDLE hIT8, int row, int col);
1930 
1931 CMSAPI cmsBool          CMSEXPORT cmsIT8SetDataRowCol(cmsHANDLE hIT8, int row, int col,
1932                                                 const char* Val);
1933 
1934 CMSAPI cmsBool          CMSEXPORT cmsIT8SetDataRowColDbl(cmsHANDLE hIT8, int row, int col,
1935                                                 cmsFloat64Number Val);
1936 
1937 CMSAPI const char*      CMSEXPORT cmsIT8GetData(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1938 
1939 
1940 CMSAPI cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE hIT8, const char* cPatch, const char* cSample);
1941 
1942 CMSAPI cmsBool          CMSEXPORT cmsIT8SetData(cmsHANDLE hIT8, const char* cPatch,
1943                                                 const char* cSample,
1944                                                 const char *Val);
1945 
1946 CMSAPI cmsBool          CMSEXPORT cmsIT8SetDataDbl(cmsHANDLE hIT8, const char* cPatch,
1947                                                 const char* cSample,
1948                                                 cmsFloat64Number Val);
1949 
1950 CMSAPI int              CMSEXPORT cmsIT8FindDataFormat(cmsHANDLE hIT8, const char* cSample);
1951 CMSAPI cmsBool          CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE hIT8, int n, const char *Sample);
1952 CMSAPI int              CMSEXPORT cmsIT8EnumDataFormat(cmsHANDLE hIT8, char ***SampleNames);
1953 
1954 CMSAPI const char*      CMSEXPORT cmsIT8GetPatchName(cmsHANDLE hIT8, int nPatch, char* buffer);
1955 CMSAPI int              CMSEXPORT cmsIT8GetPatchByName(cmsHANDLE hIT8, const char *cPatch);
1956 
1957 // The LABEL extension
1958 CMSAPI int              CMSEXPORT cmsIT8SetTableByLabel(cmsHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType);
1959 
1960 CMSAPI cmsBool          CMSEXPORT cmsIT8SetIndexColumn(cmsHANDLE hIT8, const char* cSample);
1961 
1962 // Formatter for double
1963 CMSAPI void             CMSEXPORT cmsIT8DefineDblFormat(cmsHANDLE hIT8, const char* Formatter);
1964 
1965 // Gamut boundary description routines ------------------------------------------------------------------------------
1966 
1967 CMSAPI cmsHANDLE        CMSEXPORT cmsGBDAlloc(cmsContext ContextID);
1968 CMSAPI void             CMSEXPORT cmsGBDFree(cmsHANDLE hGBD);
1969 CMSAPI cmsBool          CMSEXPORT cmsGDBAddPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1970 CMSAPI cmsBool          CMSEXPORT cmsGDBCompute(cmsHANDLE  hGDB, cmsUInt32Number dwFlags);
1971 CMSAPI cmsBool          CMSEXPORT cmsGDBCheckPoint(cmsHANDLE hGBD, const cmsCIELab* Lab);
1972 
1973 // Feature detection  ----------------------------------------------------------------------------------------------
1974 
1975 // Estimate the black point
1976 CMSAPI cmsBool          CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1977 CMSAPI cmsBool          CMSEXPORT cmsDetectDestinationBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags);
1978 
1979 // Estimate total area coverage
1980 CMSAPI cmsFloat64Number CMSEXPORT cmsDetectTAC(cmsHPROFILE hProfile);
1981 
1982 // Estimate gamma space, always positive. Returns -1 on error.
1983 CMSAPI cmsFloat64Number CMSEXPORT cmsDetectRGBProfileGamma(cmsHPROFILE hProfile, cmsFloat64Number threshold);
1984 
1985 // Poor man's gamut mapping
1986 CMSAPI cmsBool          CMSEXPORT cmsDesaturateLab(cmsCIELab* Lab,
1987                                                    double amax, double amin,
1988                                                    double bmax, double bmin);
1989 
1990 #ifndef CMS_USE_CPP_API
1991 #   ifdef __cplusplus
1992     }
1993 #   endif
1994 #endif
1995 
1996 #define _lcms2_H
1997 #endif