lcms2.h 96 KB

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