lcms2.h 102 KB

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