< prev index next >

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

Print this page




  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 // This file is available under and governed by the GNU General Public
  26 // License version 2 only, as published by the Free Software Foundation.
  27 // However, the following notice accompanied the original version of this
  28 // file:
  29 //
  30 //---------------------------------------------------------------------------------
  31 //
  32 //  Little Color Management System
  33 //  Copyright (c) 1998-2017 Marti Maria Saguer
  34 //
  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.9rc3
  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
  76 
  77 // Uncomment this line if you are compiling as C++ and want a C++ API
  78 // #define CMS_USE_CPP_API
  79 
  80 // Uncomment this line if you need strict CGATS syntax. Makes CGATS files to
  81 // require "KEYWORD" on undefined identifiers, keep it commented out unless needed
  82 // #define CMS_STRICT_CGATS  1
  83 
  84 // Uncomment to get rid of the tables for "half" float support
  85 // #define CMS_NO_HALF_SUPPORT 1
  86 
  87 // Uncomment to get rid of pthreads/windows dependency
  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 // ********** End of configuration toggles ******************************
  94 
  95 // Needed for streams
  96 #include <stdio.h>
  97 
  98 // Needed for portability (C99 per 7.1.2)
  99 #include <limits.h>
 100 #include <time.h>
 101 #include <stddef.h>
 102 
 103 #ifndef CMS_USE_CPP_API
 104 #   ifdef __cplusplus
 105 extern "C" {
 106 #   endif
 107 #endif
 108 
 109 // Version/release
 110 #define LCMS_VERSION        2090
 111 
 112 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 113 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
 114 
 115 // Base types
 116 typedef unsigned char        cmsUInt8Number;   // That is guaranteed by the C99 spec
 117 typedef signed char          cmsInt8Number;    // That is guaranteed by the C99 spec
 118 
 119 #if CHAR_BIT != 8
 120 #  error "Unable to find 8 bit type, unsupported compiler"
 121 #endif
 122 
 123 // IEEE float storage numbers
 124 typedef float                cmsFloat32Number;
 125 typedef double               cmsFloat64Number;
 126 
 127 // 16-bit base types
 128 #if (USHRT_MAX == 65535U)
 129  typedef unsigned short      cmsUInt16Number;
 130 #elif (UINT_MAX == 65535U)


 160 
 161 // 64-bit base types
 162 #ifndef CMS_DONT_USE_INT64
 163 #  if (ULONG_MAX  == 18446744073709551615U)
 164     typedef unsigned long   cmsUInt64Number;
 165 #  elif (ULLONG_MAX == 18446744073709551615U)
 166       typedef unsigned long long   cmsUInt64Number;
 167 #  else
 168 #     define CMS_DONT_USE_INT64 1
 169 #  endif
 170 #  if (LONG_MAX == +9223372036854775807)
 171       typedef  long          cmsInt64Number;
 172 #  elif (LLONG_MAX == +9223372036854775807)
 173       typedef  long long     cmsInt64Number;
 174 #  else
 175 #     define CMS_DONT_USE_INT64 1
 176 #  endif
 177 #endif
 178 #endif
 179 







 180 // In the case 64 bit numbers are not supported by the compiler
 181 #ifdef CMS_DONT_USE_INT64
 182     typedef cmsUInt32Number      cmsUInt64Number[2];
 183     typedef cmsInt32Number       cmsInt64Number[2];
 184 #endif
 185 
 186 // Derivative types
 187 typedef cmsUInt32Number      cmsSignature;
 188 typedef cmsUInt16Number      cmsU8Fixed8Number;
 189 typedef cmsInt32Number       cmsS15Fixed16Number;
 190 typedef cmsUInt32Number      cmsU16Fixed16Number;
 191 
 192 // Boolean type, which will be using the native integer
 193 typedef int                  cmsBool;
 194 
 195 // Try to detect windows
 196 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
 197 #  define CMS_IS_WINDOWS_ 1
 198 #endif
 199 


1041     } cmsICCViewingConditions;
1042 
1043 // Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
1044 
1045 CMSAPI int               CMSEXPORT cmsGetEncodedCMMversion(void);
1046 
1047 // Support of non-standard functions --------------------------------------------------------------------------------------
1048 
1049 CMSAPI int               CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
1050 CMSAPI long int          CMSEXPORT cmsfilelength(FILE* f);
1051 
1052 
1053 // Context handling --------------------------------------------------------------------------------------------------------
1054 
1055 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1056 // though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1057 
1058 typedef struct _cmsContext_struct* cmsContext;
1059 
1060 CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);
1061 CMSAPI void             CMSEXPORT cmsDeleteContext(cmsContext ContexID);
1062 CMSAPI cmsContext       CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData);
1063 CMSAPI void*            CMSEXPORT cmsGetContextUserData(cmsContext ContextID);
1064 
1065 // Plug-In registering  --------------------------------------------------------------------------------------------------
1066 
1067 CMSAPI cmsBool           CMSEXPORT cmsPlugin(void* Plugin);
1068 CMSAPI cmsBool           CMSEXPORT cmsPluginTHR(cmsContext ContextID, void* Plugin);
1069 CMSAPI void              CMSEXPORT cmsUnregisterPlugins(void);
1070 CMSAPI void              CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID);
1071 
1072 // Error logging ----------------------------------------------------------------------------------------------------------
1073 
1074 // There is no error handling at all. When a function fails, it returns proper value.
1075 // For example, all create functions does return NULL on failure. Other may return FALSE.
1076 // It may be interesting, for the developer, to know why the function is failing.
1077 // for that reason, lcms2 does offer a logging function. This function will get
1078 // an ENGLISH string with some clues on what is going wrong. You can show this
1079 // info to the end user if you wish, or just create some sort of log on disk.
1080 // The logging function should NOT terminate the program, as this obviously can leave
1081 // unfreed resources. It is the programmer's responsibility to check each function


1193 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]);
1194 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1195 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1196 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]);
1197 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1198 CMSAPI void              CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1199 CMSAPI void              CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1200 CMSAPI cmsToneCurve*     CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1201 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1202 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma);
1203 CMSAPI cmsToneCurve*     CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X,  const cmsToneCurve* Y, cmsUInt32Number nPoints);
1204 CMSAPI cmsBool           CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1205 CMSAPI cmsFloat32Number  CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1206 CMSAPI cmsUInt16Number   CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1207 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1208 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1209 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1210 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1211 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1212 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);

1213 
1214 // Tone curve tabular estimation
1215 CMSAPI cmsUInt32Number         CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1216 CMSAPI const cmsUInt16Number*  CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1217 
1218 
1219 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1220 
1221 // Nothing to see here, move along
1222 typedef struct _cmsPipeline_struct cmsPipeline;
1223 typedef struct _cmsStage_struct cmsStage;
1224 
1225 // Those are hi-level pipelines
1226 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1227 CMSAPI void              CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1228 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1229 
1230 CMSAPI cmsContext        CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1231 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1232 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);


1259 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocIdentity(cmsContext ContextID, cmsUInt32Number nChannels);
1260 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocToneCurves(cmsContext ContextID, cmsUInt32Number nChannels, cmsToneCurve* const Curves[]);
1261 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number Rows, cmsUInt32Number Cols, const cmsFloat64Number* Matrix, const cmsFloat64Number* Offset);
1262 
1263 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLut16bit(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1264 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLutFloat(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1265 
1266 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1267 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1268 
1269 CMSAPI cmsStage*         CMSEXPORT cmsStageDup(cmsStage* mpe);
1270 CMSAPI void              CMSEXPORT cmsStageFree(cmsStage* mpe);
1271 CMSAPI cmsStage*         CMSEXPORT cmsStageNext(const cmsStage* mpe);
1272 
1273 CMSAPI cmsUInt32Number   CMSEXPORT cmsStageInputChannels(const cmsStage* mpe);
1274 CMSAPI cmsUInt32Number   CMSEXPORT cmsStageOutputChannels(const cmsStage* mpe);
1275 CMSAPI cmsStageSignature CMSEXPORT cmsStageType(const cmsStage* mpe);
1276 CMSAPI void*             CMSEXPORT cmsStageData(const cmsStage* mpe);
1277 
1278 // Sampling
1279 typedef cmsInt32Number (* cmsSAMPLER16)   (register const cmsUInt16Number In[],
1280                                             register cmsUInt16Number Out[],
1281                                             register void * Cargo);
1282 
1283 typedef cmsInt32Number (* cmsSAMPLERFLOAT)(register const cmsFloat32Number In[],
1284                                             register cmsFloat32Number Out[],
1285                                             register void * Cargo);
1286 
1287 // Use this flag to prevent changes being written to destination
1288 #define SAMPLER_INSPECT     0x01000000
1289 
1290 // For CLUT only
1291 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe,    cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1292 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1293 
1294 // Slicers
1295 CMSAPI cmsBool           CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1296                                                    cmsSAMPLER16 Sampler, void * Cargo);
1297 
1298 CMSAPI cmsBool           CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1299                                                    cmsSAMPLERFLOAT Sampler, void * Cargo);
1300 
1301 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1302 
1303 typedef struct _cms_MLU_struct cmsMLU;
1304 
1305 #define  cmsNoLanguage "\0\0"


1656 #define INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC 14
1657 #define INTENT_PRESERVE_K_PLANE_SATURATION            15
1658 
1659 // Call with NULL as parameters to get the intent count
1660 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1661 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID, cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1662 
1663 // Flags
1664 
1665 #define cmsFLAGS_NOCACHE                  0x0040    // Inhibit 1-pixel cache
1666 #define cmsFLAGS_NOOPTIMIZE               0x0100    // Inhibit optimizations
1667 #define cmsFLAGS_NULLTRANSFORM            0x0200    // Don't transform anyway
1668 
1669 // Proofing flags
1670 #define cmsFLAGS_GAMUTCHECK               0x1000    // Out of Gamut alarm
1671 #define cmsFLAGS_SOFTPROOFING             0x4000    // Do softproofing
1672 
1673 // Misc
1674 #define cmsFLAGS_BLACKPOINTCOMPENSATION   0x2000
1675 #define cmsFLAGS_NOWHITEONWHITEFIXUP      0x0004    // Don't fix scum dot
1676 #define cmsFLAGS_HIGHRESPRECALC           0x0400    // Use more memory to give better accurancy
1677 #define cmsFLAGS_LOWRESPRECALC            0x0800    // Use less memory to minimize resources
1678 
1679 // For devicelink creation
1680 #define cmsFLAGS_8BITS_DEVICELINK         0x0008   // Create 8 bits devicelinks
1681 #define cmsFLAGS_GUESSDEVICECLASS         0x0020   // Guess device class (for transform2devicelink)
1682 #define cmsFLAGS_KEEP_SEQUENCE            0x0080   // Keep profile sequence for devicelink creation
1683 
1684 // Specific to a particular optimizations
1685 #define cmsFLAGS_FORCE_CLUT               0x0002    // Force CLUT optimization
1686 #define cmsFLAGS_CLUT_POST_LINEARIZATION  0x0001    // create postlinearization tables if possible
1687 #define cmsFLAGS_CLUT_PRE_LINEARIZATION   0x0010    // create prelinearization tables if possible
1688 
1689 // Specific to unbounded mode
1690 #define cmsFLAGS_NONEGATIVES              0x8000    // Prevent negative numbers in floating point transforms
1691 
1692 // Copy alpha channels when transforming
1693 #define cmsFLAGS_COPY_ALPHA               0x04000000 // Alpha channels are copied on cmsDoTransform()
1694 
1695 // Fine-tune control over number of gridpoints
1696 #define cmsFLAGS_GRIDPOINTS(n)           (((n) & 0xFF) << 16)




  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 // This file is available under and governed by the GNU General Public
  26 // License version 2 only, as published by the Free Software Foundation.
  27 // However, the following notice accompanied the original version of this
  28 // file:
  29 //
  30 //---------------------------------------------------------------------------------
  31 //
  32 //  Little Color Management System
  33 //  Copyright (c) 1998-2020 Marti Maria Saguer
  34 //
  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.11
  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
  76 
  77 // Uncomment this line if you are compiling as C++ and want a C++ API
  78 // #define CMS_USE_CPP_API
  79 
  80 // Uncomment this line if you need strict CGATS syntax. Makes CGATS files to
  81 // require "KEYWORD" on undefined identifiers, keep it commented out unless needed
  82 // #define CMS_STRICT_CGATS  1
  83 
  84 // Uncomment to get rid of the tables for "half" float support
  85 // #define CMS_NO_HALF_SUPPORT 1
  86 
  87 // Uncomment to get rid of pthreads/windows dependency
  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        2100
 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)


 163 
 164 // 64-bit base types
 165 #ifndef CMS_DONT_USE_INT64
 166 #  if (ULONG_MAX  == 18446744073709551615U)
 167     typedef unsigned long   cmsUInt64Number;
 168 #  elif (ULLONG_MAX == 18446744073709551615U)
 169       typedef unsigned long long   cmsUInt64Number;
 170 #  else
 171 #     define CMS_DONT_USE_INT64 1
 172 #  endif
 173 #  if (LONG_MAX == +9223372036854775807)
 174       typedef  long          cmsInt64Number;
 175 #  elif (LLONG_MAX == +9223372036854775807)
 176       typedef  long long     cmsInt64Number;
 177 #  else
 178 #     define CMS_DONT_USE_INT64 1
 179 #  endif
 180 #endif
 181 #endif
 182 
 183 // Handle "register" keyword
 184 #if defined(CMS_NO_REGISTER_KEYWORD) && !defined(CMS_DLL) && !defined(CMS_DLL_BUILD)
 185 #  define CMSREGISTER
 186 #else
 187 #  define CMSREGISTER register
 188 #endif
 189 
 190 // In the case 64 bit numbers are not supported by the compiler
 191 #ifdef CMS_DONT_USE_INT64
 192     typedef cmsUInt32Number      cmsUInt64Number[2];
 193     typedef cmsInt32Number       cmsInt64Number[2];
 194 #endif
 195 
 196 // Derivative types
 197 typedef cmsUInt32Number      cmsSignature;
 198 typedef cmsUInt16Number      cmsU8Fixed8Number;
 199 typedef cmsInt32Number       cmsS15Fixed16Number;
 200 typedef cmsUInt32Number      cmsU16Fixed16Number;
 201 
 202 // Boolean type, which will be using the native integer
 203 typedef int                  cmsBool;
 204 
 205 // Try to detect windows
 206 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
 207 #  define CMS_IS_WINDOWS_ 1
 208 #endif
 209 


1051     } cmsICCViewingConditions;
1052 
1053 // Get LittleCMS version (for shared objects) -----------------------------------------------------------------------------
1054 
1055 CMSAPI int               CMSEXPORT cmsGetEncodedCMMversion(void);
1056 
1057 // Support of non-standard functions --------------------------------------------------------------------------------------
1058 
1059 CMSAPI int               CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2);
1060 CMSAPI long int          CMSEXPORT cmsfilelength(FILE* f);
1061 
1062 
1063 // Context handling --------------------------------------------------------------------------------------------------------
1064 
1065 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1066 // though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1067 
1068 typedef struct _cmsContext_struct* cmsContext;
1069 
1070 CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);
1071 CMSAPI void             CMSEXPORT cmsDeleteContext(cmsContext ContextID);
1072 CMSAPI cmsContext       CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData);
1073 CMSAPI void*            CMSEXPORT cmsGetContextUserData(cmsContext ContextID);
1074 
1075 // Plug-In registering  --------------------------------------------------------------------------------------------------
1076 
1077 CMSAPI cmsBool           CMSEXPORT cmsPlugin(void* Plugin);
1078 CMSAPI cmsBool           CMSEXPORT cmsPluginTHR(cmsContext ContextID, void* Plugin);
1079 CMSAPI void              CMSEXPORT cmsUnregisterPlugins(void);
1080 CMSAPI void              CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID);
1081 
1082 // Error logging ----------------------------------------------------------------------------------------------------------
1083 
1084 // There is no error handling at all. When a function fails, it returns proper value.
1085 // For example, all create functions does return NULL on failure. Other may return FALSE.
1086 // It may be interesting, for the developer, to know why the function is failing.
1087 // for that reason, lcms2 does offer a logging function. This function will get
1088 // an ENGLISH string with some clues on what is going wrong. You can show this
1089 // info to the end user if you wish, or just create some sort of log on disk.
1090 // The logging function should NOT terminate the program, as this obviously can leave
1091 // unfreed resources. It is the programmer's responsibility to check each function


1203 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]);
1204 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]);
1205 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma);
1206 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]);
1207 CMSAPI cmsToneCurve*     CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]);
1208 CMSAPI void              CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve);
1209 CMSAPI void              CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]);
1210 CMSAPI cmsToneCurve*     CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src);
1211 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma);
1212 CMSAPI cmsToneCurve*     CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma);
1213 CMSAPI cmsToneCurve*     CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X,  const cmsToneCurve* Y, cmsUInt32Number nPoints);
1214 CMSAPI cmsBool           CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda);
1215 CMSAPI cmsFloat32Number  CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v);
1216 CMSAPI cmsUInt16Number   CMSEXPORT cmsEvalToneCurve16(const cmsToneCurve* Curve, cmsUInt16Number v);
1217 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMultisegment(const cmsToneCurve* InGamma);
1218 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve);
1219 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t);
1220 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
1221 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
1222 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
1223 CMSAPI cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t);
1224 
1225 // Tone curve tabular estimation
1226 CMSAPI cmsUInt32Number         CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
1227 CMSAPI const cmsUInt16Number*  CMSEXPORT cmsGetToneCurveEstimatedTable(const cmsToneCurve* t);
1228 
1229 
1230 // Implements pipelines of multi-processing elements -------------------------------------------------------------
1231 
1232 // Nothing to see here, move along
1233 typedef struct _cmsPipeline_struct cmsPipeline;
1234 typedef struct _cmsStage_struct cmsStage;
1235 
1236 // Those are hi-level pipelines
1237 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels);
1238 CMSAPI void              CMSEXPORT cmsPipelineFree(cmsPipeline* lut);
1239 CMSAPI cmsPipeline*      CMSEXPORT cmsPipelineDup(const cmsPipeline* Orig);
1240 
1241 CMSAPI cmsContext        CMSEXPORT cmsGetPipelineContextID(const cmsPipeline* lut);
1242 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineInputChannels(const cmsPipeline* lut);
1243 CMSAPI cmsUInt32Number   CMSEXPORT cmsPipelineOutputChannels(const cmsPipeline* lut);


1270 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocIdentity(cmsContext ContextID, cmsUInt32Number nChannels);
1271 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocToneCurves(cmsContext ContextID, cmsUInt32Number nChannels, cmsToneCurve* const Curves[]);
1272 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocMatrix(cmsContext ContextID, cmsUInt32Number Rows, cmsUInt32Number Cols, const cmsFloat64Number* Matrix, const cmsFloat64Number* Offset);
1273 
1274 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLut16bit(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1275 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLutFloat(cmsContext ContextID, cmsUInt32Number nGridPoints, cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1276 
1277 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsUInt16Number* Table);
1278 CMSAPI cmsStage*         CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const cmsUInt32Number clutPoints[], cmsUInt32Number inputChan, cmsUInt32Number outputChan, const cmsFloat32Number* Table);
1279 
1280 CMSAPI cmsStage*         CMSEXPORT cmsStageDup(cmsStage* mpe);
1281 CMSAPI void              CMSEXPORT cmsStageFree(cmsStage* mpe);
1282 CMSAPI cmsStage*         CMSEXPORT cmsStageNext(const cmsStage* mpe);
1283 
1284 CMSAPI cmsUInt32Number   CMSEXPORT cmsStageInputChannels(const cmsStage* mpe);
1285 CMSAPI cmsUInt32Number   CMSEXPORT cmsStageOutputChannels(const cmsStage* mpe);
1286 CMSAPI cmsStageSignature CMSEXPORT cmsStageType(const cmsStage* mpe);
1287 CMSAPI void*             CMSEXPORT cmsStageData(const cmsStage* mpe);
1288 
1289 // Sampling
1290 typedef cmsInt32Number (* cmsSAMPLER16)   (CMSREGISTER const cmsUInt16Number In[],
1291                                            CMSREGISTER cmsUInt16Number Out[],
1292                                            CMSREGISTER void * Cargo);
1293 
1294 typedef cmsInt32Number (* cmsSAMPLERFLOAT)(CMSREGISTER const cmsFloat32Number In[],
1295                                            CMSREGISTER cmsFloat32Number Out[],
1296                                            CMSREGISTER void * Cargo);
1297 
1298 // Use this flag to prevent changes being written to destination
1299 #define SAMPLER_INSPECT     0x01000000
1300 
1301 // For CLUT only
1302 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe,    cmsSAMPLER16 Sampler, void* Cargo, cmsUInt32Number dwFlags);
1303 CMSAPI cmsBool           CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void* Cargo, cmsUInt32Number dwFlags);
1304 
1305 // Slicers
1306 CMSAPI cmsBool           CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1307                                                    cmsSAMPLER16 Sampler, void * Cargo);
1308 
1309 CMSAPI cmsBool           CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[],
1310                                                    cmsSAMPLERFLOAT Sampler, void * Cargo);
1311 
1312 // Multilocalized Unicode management ---------------------------------------------------------------------------------------
1313 
1314 typedef struct _cms_MLU_struct cmsMLU;
1315 
1316 #define  cmsNoLanguage "\0\0"


1667 #define INTENT_PRESERVE_K_PLANE_RELATIVE_COLORIMETRIC 14
1668 #define INTENT_PRESERVE_K_PLANE_SATURATION            15
1669 
1670 // Call with NULL as parameters to get the intent count
1671 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1672 CMSAPI cmsUInt32Number  CMSEXPORT cmsGetSupportedIntentsTHR(cmsContext ContextID, cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions);
1673 
1674 // Flags
1675 
1676 #define cmsFLAGS_NOCACHE                  0x0040    // Inhibit 1-pixel cache
1677 #define cmsFLAGS_NOOPTIMIZE               0x0100    // Inhibit optimizations
1678 #define cmsFLAGS_NULLTRANSFORM            0x0200    // Don't transform anyway
1679 
1680 // Proofing flags
1681 #define cmsFLAGS_GAMUTCHECK               0x1000    // Out of Gamut alarm
1682 #define cmsFLAGS_SOFTPROOFING             0x4000    // Do softproofing
1683 
1684 // Misc
1685 #define cmsFLAGS_BLACKPOINTCOMPENSATION   0x2000
1686 #define cmsFLAGS_NOWHITEONWHITEFIXUP      0x0004    // Don't fix scum dot
1687 #define cmsFLAGS_HIGHRESPRECALC           0x0400    // Use more memory to give better accuracy
1688 #define cmsFLAGS_LOWRESPRECALC            0x0800    // Use less memory to minimize resources
1689 
1690 // For devicelink creation
1691 #define cmsFLAGS_8BITS_DEVICELINK         0x0008   // Create 8 bits devicelinks
1692 #define cmsFLAGS_GUESSDEVICECLASS         0x0020   // Guess device class (for transform2devicelink)
1693 #define cmsFLAGS_KEEP_SEQUENCE            0x0080   // Keep profile sequence for devicelink creation
1694 
1695 // Specific to a particular optimizations
1696 #define cmsFLAGS_FORCE_CLUT               0x0002    // Force CLUT optimization
1697 #define cmsFLAGS_CLUT_POST_LINEARIZATION  0x0001    // create postlinearization tables if possible
1698 #define cmsFLAGS_CLUT_PRE_LINEARIZATION   0x0010    // create prelinearization tables if possible
1699 
1700 // Specific to unbounded mode
1701 #define cmsFLAGS_NONEGATIVES              0x8000    // Prevent negative numbers in floating point transforms
1702 
1703 // Copy alpha channels when transforming
1704 #define cmsFLAGS_COPY_ALPHA               0x04000000 // Alpha channels are copied on cmsDoTransform()
1705 
1706 // Fine-tune control over number of gridpoints
1707 #define cmsFLAGS_GRIDPOINTS(n)           (((n) & 0xFF) << 16)


< prev index next >