lcms2.h 100 KB

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