< prev index next >

src/java.desktop/share/native/liblcms/lcms2.h

Print this page

  35 // Permission is hereby granted, free of charge, to any person obtaining
  36 // a copy of this software and associated documentation files (the "Software"),
  37 // to deal in the Software without restriction, including without limitation
  38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  39 // and/or sell copies of the Software, and to permit persons to whom the Software
  40 // is furnished to do so, subject to the following conditions:
  41 //
  42 // The above copyright notice and this permission notice shall be included in
  43 // all copies or substantial portions of the Software.
  44 //
  45 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  46 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  47 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  48 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  49 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  50 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  51 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  52 //
  53 //---------------------------------------------------------------------------------
  54 //
  55 // Version 2.15
  56 //
  57 
  58 #ifndef _lcms2_H
  59 
  60 // ********** Configuration toggles ****************************************
  61 
  62 // Uncomment this one if you are using big endian machines
  63 // #define CMS_USE_BIG_ENDIAN   1
  64 
  65 // Uncomment this one if your compiler/machine does NOT support the
  66 // "long long" type.
  67 // #define CMS_DONT_USE_INT64        1
  68 
  69 // Uncomment this if your compiler doesn't work with fast floor function
  70 // #define CMS_DONT_USE_FAST_FLOOR 1
  71 
  72 // Uncomment this line if you want lcms to use the black point tag in profile,
  73 // if commented, lcms will compute the black point by its own.
  74 // It is safer to leave it commented out
  75 // #define CMS_USE_PROFILE_BLACK_POINT_TAG    1

  88 // #define CMS_NO_PTHREADS  1
  89 
  90 // Uncomment this for special windows mutex initialization (see lcms2_internal.h)
  91 // #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
  92 
  93 // Uncomment this to remove the "register" storage class
  94 // #define CMS_NO_REGISTER_KEYWORD 1
  95 
  96 // ********** End of configuration toggles ******************************
  97 
  98 // Needed for streams
  99 #include <stdio.h>
 100 
 101 // Needed for portability (C99 per 7.1.2)
 102 #include <limits.h>
 103 #include <time.h>
 104 #include <stddef.h>
 105 
 106 #ifndef CMS_USE_CPP_API
 107 #   ifdef __cplusplus



 108 extern "C" {
 109 #   endif
 110 #endif
 111 
 112 // Version/release
 113 #define LCMS_VERSION        2150
 114 
 115 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 116 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
 117 
 118 // Base types
 119 typedef unsigned char        cmsUInt8Number;   // That is guaranteed by the C99 spec
 120 typedef signed char          cmsInt8Number;    // That is guaranteed by the C99 spec
 121 
 122 #if CHAR_BIT != 8
 123 #  error "Unable to find 8 bit type, unsupported compiler"
 124 #endif
 125 
 126 // IEEE float storage numbers
 127 typedef float                cmsFloat32Number;
 128 typedef double               cmsFloat64Number;
 129 
 130 // 16-bit base types
 131 #if (USHRT_MAX == 65535U)
 132  typedef unsigned short      cmsUInt16Number;
 133 #elif (UINT_MAX == 65535U)

 337     cmsSigMultiProcessElementType           = 0x6D706574,  // 'mpet'
 338     cmsSigNamedColorType                    = 0x6E636f6C,  // 'ncol' -- DEPRECATED!
 339     cmsSigNamedColor2Type                   = 0x6E636C32,  // 'ncl2'
 340     cmsSigParametricCurveType               = 0x70617261,  // 'para'
 341     cmsSigProfileSequenceDescType           = 0x70736571,  // 'pseq'
 342     cmsSigProfileSequenceIdType             = 0x70736964,  // 'psid'
 343     cmsSigResponseCurveSet16Type            = 0x72637332,  // 'rcs2'
 344     cmsSigS15Fixed16ArrayType               = 0x73663332,  // 'sf32'
 345     cmsSigScreeningType                     = 0x7363726E,  // 'scrn'
 346     cmsSigSignatureType                     = 0x73696720,  // 'sig '
 347     cmsSigTextType                          = 0x74657874,  // 'text'
 348     cmsSigTextDescriptionType               = 0x64657363,  // 'desc'
 349     cmsSigU16Fixed16ArrayType               = 0x75663332,  // 'uf32'
 350     cmsSigUcrBgType                         = 0x62666420,  // 'bfd '
 351     cmsSigUInt16ArrayType                   = 0x75693136,  // 'ui16'
 352     cmsSigUInt32ArrayType                   = 0x75693332,  // 'ui32'
 353     cmsSigUInt64ArrayType                   = 0x75693634,  // 'ui64'
 354     cmsSigUInt8ArrayType                    = 0x75693038,  // 'ui08'
 355     cmsSigVcgtType                          = 0x76636774,  // 'vcgt'
 356     cmsSigViewingConditionsType             = 0x76696577,  // 'view'
 357     cmsSigXYZType                           = 0x58595A20   // 'XYZ '

 358 
 359 
 360 } cmsTagTypeSignature;
 361 
 362 // Base ICC tag definitions
 363 typedef enum {
 364     cmsSigAToB0Tag                          = 0x41324230,  // 'A2B0'
 365     cmsSigAToB1Tag                          = 0x41324231,  // 'A2B1'
 366     cmsSigAToB2Tag                          = 0x41324232,  // 'A2B2'
 367     cmsSigBlueColorantTag                   = 0x6258595A,  // 'bXYZ'
 368     cmsSigBlueMatrixColumnTag               = 0x6258595A,  // 'bXYZ'
 369     cmsSigBlueTRCTag                        = 0x62545243,  // 'bTRC'
 370     cmsSigBToA0Tag                          = 0x42324130,  // 'B2A0'
 371     cmsSigBToA1Tag                          = 0x42324131,  // 'B2A1'
 372     cmsSigBToA2Tag                          = 0x42324132,  // 'B2A2'
 373     cmsSigCalibrationDateTimeTag            = 0x63616C74,  // 'calt'
 374     cmsSigCharTargetTag                     = 0x74617267,  // 'targ'
 375     cmsSigChromaticAdaptationTag            = 0x63686164,  // 'chad'
 376     cmsSigChromaticityTag                   = 0x6368726D,  // 'chrm'
 377     cmsSigColorantOrderTag                  = 0x636C726F,  // 'clro'

 415     cmsSigProfileSequenceIdTag              = 0x70736964,  // 'psid'
 416     cmsSigPs2CRD0Tag                        = 0x70736430,  // 'psd0'
 417     cmsSigPs2CRD1Tag                        = 0x70736431,  // 'psd1'
 418     cmsSigPs2CRD2Tag                        = 0x70736432,  // 'psd2'
 419     cmsSigPs2CRD3Tag                        = 0x70736433,  // 'psd3'
 420     cmsSigPs2CSATag                         = 0x70733273,  // 'ps2s'
 421     cmsSigPs2RenderingIntentTag             = 0x70733269,  // 'ps2i'
 422     cmsSigRedColorantTag                    = 0x7258595A,  // 'rXYZ'
 423     cmsSigRedMatrixColumnTag                = 0x7258595A,  // 'rXYZ'
 424     cmsSigRedTRCTag                         = 0x72545243,  // 'rTRC'
 425     cmsSigSaturationRenderingIntentGamutTag = 0x72696732,  // 'rig2'
 426     cmsSigScreeningDescTag                  = 0x73637264,  // 'scrd'
 427     cmsSigScreeningTag                      = 0x7363726E,  // 'scrn'
 428     cmsSigTechnologyTag                     = 0x74656368,  // 'tech'
 429     cmsSigUcrBgTag                          = 0x62666420,  // 'bfd '
 430     cmsSigViewingCondDescTag                = 0x76756564,  // 'vued'
 431     cmsSigViewingConditionsTag              = 0x76696577,  // 'view'
 432     cmsSigVcgtTag                           = 0x76636774,  // 'vcgt'
 433     cmsSigMetaTag                           = 0x6D657461,  // 'meta'
 434     cmsSigcicpTag                           = 0x63696370,  // 'cicp'
 435     cmsSigArgyllArtsTag                     = 0x61727473   // 'arts'

 436 
 437 } cmsTagSignature;
 438 
 439 
 440 // ICC Technology tag
 441 typedef enum {
 442     cmsSigDigitalCamera                     = 0x6463616D,  // 'dcam'
 443     cmsSigFilmScanner                       = 0x6673636E,  // 'fscn'
 444     cmsSigReflectiveScanner                 = 0x7273636E,  // 'rscn'
 445     cmsSigInkJetPrinter                     = 0x696A6574,  // 'ijet'
 446     cmsSigThermalWaxPrinter                 = 0x74776178,  // 'twax'
 447     cmsSigElectrophotographicPrinter        = 0x6570686F,  // 'epho'
 448     cmsSigElectrostaticPrinter              = 0x65737461,  // 'esta'
 449     cmsSigDyeSublimationPrinter             = 0x64737562,  // 'dsub'
 450     cmsSigPhotographicPaperPrinter          = 0x7270686F,  // 'rpho'
 451     cmsSigFilmWriter                        = 0x6670726E,  // 'fprn'
 452     cmsSigVideoMonitor                      = 0x7669646D,  // 'vidm'
 453     cmsSigVideoCamera                       = 0x76696463,  // 'vidc'
 454     cmsSigProjectionTelevision              = 0x706A7476,  // 'pjtv'
 455     cmsSigCRTDisplay                        = 0x43525420,  // 'CRT '

 960 #define TYPE_RGBA_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
 961 #define TYPE_RGBA_FLT_PREMUL  (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|PREMUL_SH(1))
 962 #define TYPE_ARGB_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
 963 #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))
 964 #define TYPE_BGR_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 965 #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))
 966 #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))
 967 #define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 968 #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))
 969 
 970 #define TYPE_CMYK_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
 971 
 972 // Floating point formatters.
 973 // NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
 974 #define TYPE_XYZ_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
 975 #define TYPE_Lab_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
 976 #define TYPE_GRAY_DBL         (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
 977 #define TYPE_RGB_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
 978 #define TYPE_BGR_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)|DOSWAP_SH(1))
 979 #define TYPE_CMYK_DBL         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))

 980 
 981 // IEEE 754-2008 "half"
 982 #define TYPE_GRAY_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
 983 #define TYPE_RGB_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
 984 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
 985 #define TYPE_CMYK_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
 986 
 987 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
 988 #define TYPE_ARGB_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
 989 #define TYPE_BGR_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
 990 #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))
 991 #define TYPE_ABGR_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
 992 
 993 #endif
 994 
 995 // Colorspaces
 996 typedef struct {
 997         cmsFloat64Number X;
 998         cmsFloat64Number Y;
 999         cmsFloat64Number Z;

1060         cmsFloat64Number Flare;       // 0..1.0
1061         cmsUInt32Number  IlluminantType;
1062 
1063     } cmsICCMeasurementConditions;
1064 
1065 typedef struct {
1066         cmsCIEXYZ       IlluminantXYZ;   // Not the same struct as CAM02,
1067         cmsCIEXYZ       SurroundXYZ;     // This is for storing the tag
1068         cmsUInt32Number IlluminantType;  // viewing condition
1069 
1070     } cmsICCViewingConditions;
1071 
1072 typedef struct {
1073     cmsUInt8Number  ColourPrimaries;            // Recommendation ITU-T H.273
1074     cmsUInt8Number  TransferCharacteristics;    //  (ISO/IEC 23091-2)
1075     cmsUInt8Number  MatrixCoefficients;
1076     cmsUInt8Number  VideoFullRangeFlag;
1077 
1078 } cmsVideoSignalType;
1079 













1080 
1081 
1082 // Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
1083 
1084 CMSAPI int               CMSEXPORT cmsGetEncodedCMMversion(void);
1085 
1086 // Support of non-standard functions --------------------------------------------------------------------------------------
1087 
1088 CMSAPI int               CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
1089 CMSAPI long int          CMSEXPORT cmsfilelength(FILE* f);
1090 
1091 
1092 // Context handling --------------------------------------------------------------------------------------------------------
1093 
1094 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1095 // though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1096 
1097 typedef struct _cmsContext_struct* cmsContext;
1098 
1099 CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);

1232 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]);
1233 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1234 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1235 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]);
1236 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1237 CMSAPI void              CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1238 CMSAPI void              CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1239 CMSAPI cmsToneCurve*     CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1240 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1241 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma);
1242 CMSAPI cmsToneCurve*     CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X,  const cmsToneCurve* Y, cmsUInt32Number nPoints);
1243 CMSAPI cmsBool           CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1244 CMSAPI cmsFloat32Number  CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1245 CMSAPI cmsUInt16Number   CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1246 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1247 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1248 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1249 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1250 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1251 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1252 CMSAPI cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t);

1253 
1254 // Tone curve tabular estimation
1255 CMSAPI cmsUInt32Number         CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1256 CMSAPI const cmsUInt16Number*  CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1257 
1258 
1259 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1260 
1261 // Nothing to see here, move along
1262 typedef struct _cmsPipeline_struct cmsPipeline;
1263 typedef struct _cmsStage_struct cmsStage;
1264 
1265 // Those are hi-level pipelines
1266 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1267 CMSAPI void              CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1268 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1269 
1270 CMSAPI cmsContext        CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1271 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1272 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);

1326                                            CMSREGISTER void * Cargo);
1327 
1328 // Use this flag to prevent changes being written to destination
1329 #define SAMPLER_INSPECT     0x01000000
1330 
1331 // For CLUT only
1332 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1333 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1334 
1335 // Slicers
1336 CMSAPI cmsBool           CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1337                                                    cmsSAMPLER16 Sampler, void * Cargo);
1338 
1339 CMSAPI cmsBool           CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1340                                                    cmsSAMPLERFLOAT Sampler, void * Cargo);
1341 
1342 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1343 
1344 typedef struct _cms_MLU_struct cmsMLU;
1345 
1346 #define  cmsNoLanguage "\0\0"
1347 #define  cmsNoCountry  "\0\0"



1348 
1349 CMSAPI cmsMLU*           CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems);
1350 CMSAPI void              CMSEXPORT cmsMLUfree(cmsMLU* mlu);
1351 CMSAPI cmsMLU*           CMSEXPORT cmsMLUdup(const cmsMLU* mlu);
1352 
1353 CMSAPI cmsBool           CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu,
1354                                                   const char LanguageCode[3], const char CountryCode[3],
1355                                                   const char* ASCIIString);
1356 CMSAPI cmsBool           CMSEXPORT cmsMLUsetWide(cmsMLU* mlu,
1357                                                   const char LanguageCode[3], const char CountryCode[3],
1358                                                   const wchar_t* WideString);



1359 
1360 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
1361                                                   const char LanguageCode[3], const char CountryCode[3],
1362                                                   char* Buffer,    cmsUInt32Number BufferSize);
1363 
1364 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
1365                                                  const char LanguageCode[3], const char CountryCode[3],
1366                                                  wchar_t* Buffer, cmsUInt32Number BufferSize);




1367 
1368 CMSAPI cmsBool           CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
1369                                                          const char LanguageCode[3], const char CountryCode[3],
1370                                                          char ObtainedLanguage[3], char ObtainedCountry[3]);
1371 
1372 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUtranslationsCount(const cmsMLU* mlu);
1373 
1374 CMSAPI cmsBool           CMSEXPORT cmsMLUtranslationsCodes(const cmsMLU* mlu,
1375                                                              cmsUInt32Number idx,
1376                                                              char LanguageCode[3],
1377                                                              char CountryCode[3]);
1378 
1379 // Undercolorremoval & black generation -------------------------------------------------------------------------------------
1380 
1381 typedef struct {
1382         cmsToneCurve* Ucr;
1383         cmsToneCurve* Bg;
1384         cmsMLU*       Desc;
1385 
1386 } cmsUcrBg;

1571 CMSAPI cmsUInt32Number   CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1572 CMSAPI cmsUInt32Number   CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1573 
1574 
1575 // Localized info
1576 typedef enum {
1577              cmsInfoDescription  = 0,
1578              cmsInfoManufacturer = 1,
1579              cmsInfoModel        = 2,
1580              cmsInfoCopyright    = 3
1581 } cmsInfoType;
1582 
1583 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetProfileInfo(cmsHPROFILE hProfile, cmsInfoType Info,
1584                                                             const char LanguageCode[3], const char CountryCode[3],
1585                                                             wchar_t* Buffer, cmsUInt32Number BufferSize);
1586 
1587 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
1588                                                             const char LanguageCode[3], const char CountryCode[3],
1589                                                             char* Buffer, cmsUInt32Number BufferSize);
1590 




1591 // IO handlers ----------------------------------------------------------------------------------------------------------
1592 
1593 typedef struct _cms_io_handler cmsIOHANDLER;
1594 
1595 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const char* FileName, const char* AccessMode);
1596 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
1597 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
1598 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
1599 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsGetProfileIOhandler(cmsHPROFILE hProfile);
1600 CMSAPI cmsBool           CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);
1601 
1602 // MD5 message digest --------------------------------------------------------------------------------------------------
1603 
1604 CMSAPI cmsBool           CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile);
1605 
1606 // Profile high level functions ------------------------------------------------------------------------------------------
1607 
1608 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
1609 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess);
1610 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char* sAccess);

1633 
1634 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
1635                                                     const cmsCIExyY* WhitePoint,
1636                                                     const cmsToneCurve* TransferFunction);
1637 
1638 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateGrayProfile(const cmsCIExyY* WhitePoint,
1639                                                     const cmsToneCurve* TransferFunction);
1640 
1641 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
1642                                                                 cmsColorSpaceSignature ColorSpace,
1643                                                                 cmsToneCurve* const TransferFunctions[]);
1644 
1645 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLinearizationDeviceLink(cmsColorSpaceSignature ColorSpace,
1646                                                                 cmsToneCurve* const TransferFunctions[]);
1647 
1648 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
1649                                                               cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1650 
1651 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateInkLimitingDeviceLink(cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1652 



1653 
1654 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1655 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab2Profile(const cmsCIExyY* WhitePoint);
1656 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1657 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab4Profile(const cmsCIExyY* WhitePoint);
1658 
1659 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID);
1660 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateXYZProfile(void);
1661 
1662 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_sRGBProfileTHR(cmsContext ContextID);
1663 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_sRGBProfile(void);
1664 


1665 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
1666                                                              cmsUInt32Number nLUTPoints,
1667                                                              cmsFloat64Number Bright,
1668                                                              cmsFloat64Number Contrast,
1669                                                              cmsFloat64Number Hue,
1670                                                              cmsFloat64Number Saturation,
1671                                                              cmsUInt32Number TempSrc,
1672                                                              cmsUInt32Number TempDest);
1673 
1674 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateBCHSWabstractProfile(cmsUInt32Number nLUTPoints,
1675                                                              cmsFloat64Number Bright,
1676                                                              cmsFloat64Number Contrast,
1677                                                              cmsFloat64Number Hue,
1678                                                              cmsFloat64Number Saturation,
1679                                                              cmsUInt32Number TempSrc,
1680                                                              cmsUInt32Number TempDest);
1681 
1682 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID);
1683 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateNULLProfile(void);
1684 

  35 // Permission is hereby granted, free of charge, to any person obtaining
  36 // a copy of this software and associated documentation files (the "Software"),
  37 // to deal in the Software without restriction, including without limitation
  38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  39 // and/or sell copies of the Software, and to permit persons to whom the Software
  40 // is furnished to do so, subject to the following conditions:
  41 //
  42 // The above copyright notice and this permission notice shall be included in
  43 // all copies or substantial portions of the Software.
  44 //
  45 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  46 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  47 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  48 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  49 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  50 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  51 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  52 //
  53 //---------------------------------------------------------------------------------
  54 //
  55 // Version 2.16
  56 //
  57 
  58 #ifndef _lcms2_H
  59 
  60 // ********** Configuration toggles ****************************************
  61 
  62 // Uncomment this one if you are using big endian machines
  63 // #define CMS_USE_BIG_ENDIAN   1
  64 
  65 // Uncomment this one if your compiler/machine does NOT support the
  66 // "long long" type.
  67 // #define CMS_DONT_USE_INT64        1
  68 
  69 // Uncomment this if your compiler doesn't work with fast floor function
  70 // #define CMS_DONT_USE_FAST_FLOOR 1
  71 
  72 // Uncomment this line if you want lcms to use the black point tag in profile,
  73 // if commented, lcms will compute the black point by its own.
  74 // It is safer to leave it commented out
  75 // #define CMS_USE_PROFILE_BLACK_POINT_TAG    1

  88 // #define CMS_NO_PTHREADS  1
  89 
  90 // Uncomment this for special windows mutex initialization (see lcms2_internal.h)
  91 // #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
  92 
  93 // Uncomment this to remove the "register" storage class
  94 // #define CMS_NO_REGISTER_KEYWORD 1
  95 
  96 // ********** End of configuration toggles ******************************
  97 
  98 // Needed for streams
  99 #include <stdio.h>
 100 
 101 // Needed for portability (C99 per 7.1.2)
 102 #include <limits.h>
 103 #include <time.h>
 104 #include <stddef.h>
 105 
 106 #ifndef CMS_USE_CPP_API
 107 #   ifdef __cplusplus
 108 #       if __cplusplus >= 201703L
 109 #            define CMS_NO_REGISTER_KEYWORD 1
 110 #       endif
 111 extern "C" {
 112 #   endif
 113 #endif
 114 
 115 // Version/release
 116 #define LCMS_VERSION        2160
 117 
 118 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 119 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
 120 
 121 // Base types
 122 typedef unsigned char        cmsUInt8Number;   // That is guaranteed by the C99 spec
 123 typedef signed char          cmsInt8Number;    // That is guaranteed by the C99 spec
 124 
 125 #if CHAR_BIT != 8
 126 #  error "Unable to find 8 bit type, unsupported compiler"
 127 #endif
 128 
 129 // IEEE float storage numbers
 130 typedef float                cmsFloat32Number;
 131 typedef double               cmsFloat64Number;
 132 
 133 // 16-bit base types
 134 #if (USHRT_MAX == 65535U)
 135  typedef unsigned short      cmsUInt16Number;
 136 #elif (UINT_MAX == 65535U)

 340     cmsSigMultiProcessElementType           = 0x6D706574,  // 'mpet'
 341     cmsSigNamedColorType                    = 0x6E636f6C,  // 'ncol' -- DEPRECATED!
 342     cmsSigNamedColor2Type                   = 0x6E636C32,  // 'ncl2'
 343     cmsSigParametricCurveType               = 0x70617261,  // 'para'
 344     cmsSigProfileSequenceDescType           = 0x70736571,  // 'pseq'
 345     cmsSigProfileSequenceIdType             = 0x70736964,  // 'psid'
 346     cmsSigResponseCurveSet16Type            = 0x72637332,  // 'rcs2'
 347     cmsSigS15Fixed16ArrayType               = 0x73663332,  // 'sf32'
 348     cmsSigScreeningType                     = 0x7363726E,  // 'scrn'
 349     cmsSigSignatureType                     = 0x73696720,  // 'sig '
 350     cmsSigTextType                          = 0x74657874,  // 'text'
 351     cmsSigTextDescriptionType               = 0x64657363,  // 'desc'
 352     cmsSigU16Fixed16ArrayType               = 0x75663332,  // 'uf32'
 353     cmsSigUcrBgType                         = 0x62666420,  // 'bfd '
 354     cmsSigUInt16ArrayType                   = 0x75693136,  // 'ui16'
 355     cmsSigUInt32ArrayType                   = 0x75693332,  // 'ui32'
 356     cmsSigUInt64ArrayType                   = 0x75693634,  // 'ui64'
 357     cmsSigUInt8ArrayType                    = 0x75693038,  // 'ui08'
 358     cmsSigVcgtType                          = 0x76636774,  // 'vcgt'
 359     cmsSigViewingConditionsType             = 0x76696577,  // 'view'
 360     cmsSigXYZType                           = 0x58595A20,  // 'XYZ '
 361     cmsSigMHC2Type                          = 0x4D484332   // 'MHC2'
 362 
 363 
 364 } cmsTagTypeSignature;
 365 
 366 // Base ICC tag definitions
 367 typedef enum {
 368     cmsSigAToB0Tag                          = 0x41324230,  // 'A2B0'
 369     cmsSigAToB1Tag                          = 0x41324231,  // 'A2B1'
 370     cmsSigAToB2Tag                          = 0x41324232,  // 'A2B2'
 371     cmsSigBlueColorantTag                   = 0x6258595A,  // 'bXYZ'
 372     cmsSigBlueMatrixColumnTag               = 0x6258595A,  // 'bXYZ'
 373     cmsSigBlueTRCTag                        = 0x62545243,  // 'bTRC'
 374     cmsSigBToA0Tag                          = 0x42324130,  // 'B2A0'
 375     cmsSigBToA1Tag                          = 0x42324131,  // 'B2A1'
 376     cmsSigBToA2Tag                          = 0x42324132,  // 'B2A2'
 377     cmsSigCalibrationDateTimeTag            = 0x63616C74,  // 'calt'
 378     cmsSigCharTargetTag                     = 0x74617267,  // 'targ'
 379     cmsSigChromaticAdaptationTag            = 0x63686164,  // 'chad'
 380     cmsSigChromaticityTag                   = 0x6368726D,  // 'chrm'
 381     cmsSigColorantOrderTag                  = 0x636C726F,  // 'clro'

 419     cmsSigProfileSequenceIdTag              = 0x70736964,  // 'psid'
 420     cmsSigPs2CRD0Tag                        = 0x70736430,  // 'psd0'
 421     cmsSigPs2CRD1Tag                        = 0x70736431,  // 'psd1'
 422     cmsSigPs2CRD2Tag                        = 0x70736432,  // 'psd2'
 423     cmsSigPs2CRD3Tag                        = 0x70736433,  // 'psd3'
 424     cmsSigPs2CSATag                         = 0x70733273,  // 'ps2s'
 425     cmsSigPs2RenderingIntentTag             = 0x70733269,  // 'ps2i'
 426     cmsSigRedColorantTag                    = 0x7258595A,  // 'rXYZ'
 427     cmsSigRedMatrixColumnTag                = 0x7258595A,  // 'rXYZ'
 428     cmsSigRedTRCTag                         = 0x72545243,  // 'rTRC'
 429     cmsSigSaturationRenderingIntentGamutTag = 0x72696732,  // 'rig2'
 430     cmsSigScreeningDescTag                  = 0x73637264,  // 'scrd'
 431     cmsSigScreeningTag                      = 0x7363726E,  // 'scrn'
 432     cmsSigTechnologyTag                     = 0x74656368,  // 'tech'
 433     cmsSigUcrBgTag                          = 0x62666420,  // 'bfd '
 434     cmsSigViewingCondDescTag                = 0x76756564,  // 'vued'
 435     cmsSigViewingConditionsTag              = 0x76696577,  // 'view'
 436     cmsSigVcgtTag                           = 0x76636774,  // 'vcgt'
 437     cmsSigMetaTag                           = 0x6D657461,  // 'meta'
 438     cmsSigcicpTag                           = 0x63696370,  // 'cicp'
 439     cmsSigArgyllArtsTag                     = 0x61727473,  // 'arts'
 440     cmsSigMHC2Tag                           = 0x4D484332   // 'MHC2'
 441 
 442 } cmsTagSignature;
 443 
 444 
 445 // ICC Technology tag
 446 typedef enum {
 447     cmsSigDigitalCamera                     = 0x6463616D,  // 'dcam'
 448     cmsSigFilmScanner                       = 0x6673636E,  // 'fscn'
 449     cmsSigReflectiveScanner                 = 0x7273636E,  // 'rscn'
 450     cmsSigInkJetPrinter                     = 0x696A6574,  // 'ijet'
 451     cmsSigThermalWaxPrinter                 = 0x74776178,  // 'twax'
 452     cmsSigElectrophotographicPrinter        = 0x6570686F,  // 'epho'
 453     cmsSigElectrostaticPrinter              = 0x65737461,  // 'esta'
 454     cmsSigDyeSublimationPrinter             = 0x64737562,  // 'dsub'
 455     cmsSigPhotographicPaperPrinter          = 0x7270686F,  // 'rpho'
 456     cmsSigFilmWriter                        = 0x6670726E,  // 'fprn'
 457     cmsSigVideoMonitor                      = 0x7669646D,  // 'vidm'
 458     cmsSigVideoCamera                       = 0x76696463,  // 'vidc'
 459     cmsSigProjectionTelevision              = 0x706A7476,  // 'pjtv'
 460     cmsSigCRTDisplay                        = 0x43525420,  // 'CRT '

 965 #define TYPE_RGBA_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
 966 #define TYPE_RGBA_FLT_PREMUL  (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|PREMUL_SH(1))
 967 #define TYPE_ARGB_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
 968 #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))
 969 #define TYPE_BGR_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 970 #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))
 971 #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))
 972 #define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 973 #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))
 974 
 975 #define TYPE_CMYK_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
 976 
 977 // Floating point formatters.
 978 // NOTE THAT 'BYTES' FIELD IS SET TO ZERO ON DLB because 8 bytes overflows the bitfield
 979 #define TYPE_XYZ_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(0))
 980 #define TYPE_Lab_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_Lab)|CHANNELS_SH(3)|BYTES_SH(0))
 981 #define TYPE_GRAY_DBL         (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(0))
 982 #define TYPE_RGB_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0))
 983 #define TYPE_BGR_DBL          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(0)|DOSWAP_SH(1))
 984 #define TYPE_CMYK_DBL         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(0))
 985 #define TYPE_OKLAB_DBL        (FLOAT_SH(1)|COLORSPACE_SH(PT_MCH3)|CHANNELS_SH(3)|BYTES_SH(0))
 986 
 987 // IEEE 754-2008 "half"
 988 #define TYPE_GRAY_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
 989 #define TYPE_RGB_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
 990 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
 991 #define TYPE_CMYK_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
 992 
 993 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
 994 #define TYPE_ARGB_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2)|SWAPFIRST_SH(1))
 995 #define TYPE_BGR_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
 996 #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))
 997 #define TYPE_ABGR_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2)|DOSWAP_SH(1))
 998 
 999 #endif
1000 
1001 // Colorspaces
1002 typedef struct {
1003         cmsFloat64Number X;
1004         cmsFloat64Number Y;
1005         cmsFloat64Number Z;

1066         cmsFloat64Number Flare;       // 0..1.0
1067         cmsUInt32Number  IlluminantType;
1068 
1069     } cmsICCMeasurementConditions;
1070 
1071 typedef struct {
1072         cmsCIEXYZ       IlluminantXYZ;   // Not the same struct as CAM02,
1073         cmsCIEXYZ       SurroundXYZ;     // This is for storing the tag
1074         cmsUInt32Number IlluminantType;  // viewing condition
1075 
1076     } cmsICCViewingConditions;
1077 
1078 typedef struct {
1079     cmsUInt8Number  ColourPrimaries;            // Recommendation ITU-T H.273
1080     cmsUInt8Number  TransferCharacteristics;    //  (ISO/IEC 23091-2)
1081     cmsUInt8Number  MatrixCoefficients;
1082     cmsUInt8Number  VideoFullRangeFlag;
1083 
1084 } cmsVideoSignalType;
1085 
1086 typedef struct {
1087     cmsUInt32Number   CurveEntries;
1088     cmsFloat64Number* RedCurve;
1089     cmsFloat64Number* GreenCurve;
1090     cmsFloat64Number* BlueCurve;
1091 
1092     cmsFloat64Number  MinLuminance;         // ST.2086 min luminance in nits
1093     cmsFloat64Number  PeakLuminance;        // ST.2086 peak luminance in nits
1094 
1095     cmsFloat64Number XYZ2XYZmatrix[3][4];
1096 
1097 } cmsMHC2Type;
1098 
1099 
1100 
1101 // Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
1102 
1103 CMSAPI int               CMSEXPORT cmsGetEncodedCMMversion(void);
1104 
1105 // Support of non-standard functions --------------------------------------------------------------------------------------
1106 
1107 CMSAPI int               CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
1108 CMSAPI long int          CMSEXPORT cmsfilelength(FILE* f);
1109 
1110 
1111 // Context handling --------------------------------------------------------------------------------------------------------
1112 
1113 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1114 // though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1115 
1116 typedef struct _cmsContext_struct* cmsContext;
1117 
1118 CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);

1251 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]);
1252 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1253 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1254 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]);
1255 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1256 CMSAPI void              CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1257 CMSAPI void              CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1258 CMSAPI cmsToneCurve*     CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1259 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1260 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma);
1261 CMSAPI cmsToneCurve*     CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X,  const cmsToneCurve* Y, cmsUInt32Number nPoints);
1262 CMSAPI cmsBool           CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1263 CMSAPI cmsFloat32Number  CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1264 CMSAPI cmsUInt16Number   CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1265 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1266 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1267 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1268 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1269 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1270 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1271 
1272 CMSAPI const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t);
1273 
1274 // Tone curve tabular estimation
1275 CMSAPI cmsUInt32Number         CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1276 CMSAPI const cmsUInt16Number*  CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1277 
1278 
1279 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1280 
1281 // Nothing to see here, move along
1282 typedef struct _cmsPipeline_struct cmsPipeline;
1283 typedef struct _cmsStage_struct cmsStage;
1284 
1285 // Those are hi-level pipelines
1286 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1287 CMSAPI void              CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1288 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1289 
1290 CMSAPI cmsContext        CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1291 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1292 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);

1346                                            CMSREGISTER void * Cargo);
1347 
1348 // Use this flag to prevent changes being written to destination
1349 #define SAMPLER_INSPECT     0x01000000
1350 
1351 // For CLUT only
1352 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1353 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1354 
1355 // Slicers
1356 CMSAPI cmsBool           CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1357                                                    cmsSAMPLER16 Sampler, void * Cargo);
1358 
1359 CMSAPI cmsBool           CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1360                                                    cmsSAMPLERFLOAT Sampler, void * Cargo);
1361 
1362 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1363 
1364 typedef struct _cms_MLU_struct cmsMLU;
1365 
1366 #define  cmsNoLanguage    "\0\0"
1367 #define  cmsNoCountry     "\0\0"
1368 
1369 // Special language/country to retrieve unicode field for description in V2 profiles. Use with care.
1370 #define  cmsV2Unicode     "\xff\xff"
1371 
1372 CMSAPI cmsMLU*           CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems);
1373 CMSAPI void              CMSEXPORT cmsMLUfree(cmsMLU* mlu);
1374 CMSAPI cmsMLU*           CMSEXPORT cmsMLUdup(const cmsMLU* mlu);
1375 
1376 CMSAPI cmsBool           CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu,
1377                                                   const char LanguageCode[3], const char CountryCode[3],
1378                                                   const char* ASCIIString);
1379 CMSAPI cmsBool           CMSEXPORT cmsMLUsetWide(cmsMLU* mlu,
1380                                                   const char LanguageCode[3], const char CountryCode[3],
1381                                                   const wchar_t* WideString);
1382 CMSAPI cmsBool           CMSEXPORT cmsMLUsetUTF8(cmsMLU* mlu,
1383                                                   const char LanguageCode[3], const char CountryCode[3],
1384                                                   const char* UTF8String);
1385 
1386 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
1387                                                   const char LanguageCode[3], const char CountryCode[3],
1388                                                   char* Buffer,    cmsUInt32Number BufferSize);
1389 
1390 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu,
1391                                                  const char LanguageCode[3], const char CountryCode[3],
1392                                                  wchar_t* Buffer, cmsUInt32Number BufferSize);
1393 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUgetUTF8(const cmsMLU* mlu,
1394                                                  const char LanguageCode[3], const char CountryCode[3],
1395                                                  char* Buffer, cmsUInt32Number BufferSize);
1396 
1397 
1398 CMSAPI cmsBool           CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu,
1399                                                          const char LanguageCode[3], const char CountryCode[3],
1400                                                          char ObtainedLanguage[3], char ObtainedCountry[3]);
1401 
1402 CMSAPI cmsUInt32Number   CMSEXPORT cmsMLUtranslationsCount(const cmsMLU* mlu);
1403 
1404 CMSAPI cmsBool           CMSEXPORT cmsMLUtranslationsCodes(const cmsMLU* mlu,
1405                                                              cmsUInt32Number idx,
1406                                                              char LanguageCode[3],
1407                                                              char CountryCode[3]);
1408 
1409 // Undercolorremoval & black generation -------------------------------------------------------------------------------------
1410 
1411 typedef struct {
1412         cmsToneCurve* Ucr;
1413         cmsToneCurve* Bg;
1414         cmsMLU*       Desc;
1415 
1416 } cmsUcrBg;

1601 CMSAPI cmsUInt32Number   CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1602 CMSAPI cmsUInt32Number   CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat);
1603 
1604 
1605 // Localized info
1606 typedef enum {
1607              cmsInfoDescription  = 0,
1608              cmsInfoManufacturer = 1,
1609              cmsInfoModel        = 2,
1610              cmsInfoCopyright    = 3
1611 } cmsInfoType;
1612 
1613 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetProfileInfo(cmsHPROFILE hProfile, cmsInfoType Info,
1614                                                             const char LanguageCode[3], const char CountryCode[3],
1615                                                             wchar_t* Buffer, cmsUInt32Number BufferSize);
1616 
1617 CMSAPI cmsUInt32Number   CMSEXPORT cmsGetProfileInfoASCII(cmsHPROFILE hProfile, cmsInfoType Info,
1618                                                             const char LanguageCode[3], const char CountryCode[3],
1619                                                             char* Buffer, cmsUInt32Number BufferSize);
1620 
1621 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetProfileInfoUTF8(cmsHPROFILE hProfile, cmsInfoType Info,
1622                                                             const char LanguageCode[3], const char CountryCode[3],
1623                                                             char* Buffer, cmsUInt32Number BufferSize);
1624 
1625 // IO handlers ----------------------------------------------------------------------------------------------------------
1626 
1627 typedef struct _cms_io_handler cmsIOHANDLER;
1628 
1629 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const char* FileName, const char* AccessMode);
1630 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream);
1631 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode);
1632 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID);
1633 CMSAPI cmsIOHANDLER*     CMSEXPORT cmsGetProfileIOhandler(cmsHPROFILE hProfile);
1634 CMSAPI cmsBool           CMSEXPORT cmsCloseIOhandler(cmsIOHANDLER* io);
1635 
1636 // MD5 message digest --------------------------------------------------------------------------------------------------
1637 
1638 CMSAPI cmsBool           CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile);
1639 
1640 // Profile high level functions ------------------------------------------------------------------------------------------
1641 
1642 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess);
1643 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess);
1644 CMSAPI cmsHPROFILE      CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char* sAccess);

1667 
1668 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateGrayProfileTHR(cmsContext ContextID,
1669                                                     const cmsCIExyY* WhitePoint,
1670                                                     const cmsToneCurve* TransferFunction);
1671 
1672 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateGrayProfile(const cmsCIExyY* WhitePoint,
1673                                                     const cmsToneCurve* TransferFunction);
1674 
1675 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLinearizationDeviceLinkTHR(cmsContext ContextID,
1676                                                                 cmsColorSpaceSignature ColorSpace,
1677                                                                 cmsToneCurve* const TransferFunctions[]);
1678 
1679 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLinearizationDeviceLink(cmsColorSpaceSignature ColorSpace,
1680                                                                 cmsToneCurve* const TransferFunctions[]);
1681 
1682 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
1683                                                               cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1684 
1685 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateInkLimitingDeviceLink(cmsColorSpaceSignature ColorSpace, cmsFloat64Number Limit);
1686 
1687 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateDeviceLinkFromCubeFile(const char* cFileName);
1688 
1689 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateDeviceLinkFromCubeFileTHR(cmsContext ContextID, const char* cFileName);
1690 
1691 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1692 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab2Profile(const cmsCIExyY* WhitePoint);
1693 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIExyY* WhitePoint);
1694 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateLab4Profile(const cmsCIExyY* WhitePoint);
1695 
1696 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateXYZProfileTHR(cmsContext ContextID);
1697 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateXYZProfile(void);
1698 
1699 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_sRGBProfileTHR(cmsContext ContextID);
1700 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_sRGBProfile(void);
1701 
1702 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreate_OkLabProfile(cmsContext ctx);
1703 
1704 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
1705                                                              cmsUInt32Number nLUTPoints,
1706                                                              cmsFloat64Number Bright,
1707                                                              cmsFloat64Number Contrast,
1708                                                              cmsFloat64Number Hue,
1709                                                              cmsFloat64Number Saturation,
1710                                                              cmsUInt32Number TempSrc,
1711                                                              cmsUInt32Number TempDest);
1712 
1713 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateBCHSWabstractProfile(cmsUInt32Number nLUTPoints,
1714                                                              cmsFloat64Number Bright,
1715                                                              cmsFloat64Number Contrast,
1716                                                              cmsFloat64Number Hue,
1717                                                              cmsFloat64Number Saturation,
1718                                                              cmsUInt32Number TempSrc,
1719                                                              cmsUInt32Number TempDest);
1720 
1721 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID);
1722 CMSAPI cmsHPROFILE      CMSEXPORT cmsCreateNULLProfile(void);
1723 
< prev index next >