lcms2.h 100 KB

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