lcms2mt.h 107 KB

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