Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

914 lines
29 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. icm.h
  5. Abstract:
  6. Public header file for Image Color Management
  7. Revision History:
  8. --*/
  9. #ifndef _ICM_H_
  10. #define _ICM_H_
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. //
  18. // Support for named color profiles
  19. //
  20. typedef char COLOR_NAME[32];
  21. typedef COLOR_NAME *PCOLOR_NAME, *LPCOLOR_NAME;
  22. typedef struct tagNAMED_PROFILE_INFO{
  23. DWORD dwFlags;
  24. DWORD dwCount;
  25. DWORD dwCountDevCoordinates;
  26. COLOR_NAME szPrefix;
  27. COLOR_NAME szSuffix;
  28. }NAMED_PROFILE_INFO;
  29. typedef NAMED_PROFILE_INFO *PNAMED_PROFILE_INFO, *LPNAMED_PROFILE_INFO;
  30. //
  31. // Color spaces
  32. //
  33. // The following color spaces are supported.
  34. // Gray, RGB, CMYK, XYZ, Yxy, Lab, generic 3 channel color spaces where
  35. // the profiles defines how to interpret the 3 channels, named color spaces
  36. // which can either be indices into the space or have color names, and
  37. // multichannel spaces with 1 byte per channel upto MAX_COLOR_CHANNELS.
  38. //
  39. #define MAX_COLOR_CHANNELS 8 // maximum number of HiFi color channels
  40. struct GRAYCOLOR {
  41. WORD gray;
  42. };
  43. struct RGBCOLOR {
  44. WORD red;
  45. WORD green;
  46. WORD blue;
  47. };
  48. struct CMYKCOLOR {
  49. WORD cyan;
  50. WORD magenta;
  51. WORD yellow;
  52. WORD black;
  53. };
  54. struct XYZCOLOR {
  55. WORD X;
  56. WORD Y;
  57. WORD Z;
  58. };
  59. struct YxyCOLOR {
  60. WORD Y;
  61. WORD x;
  62. WORD y;
  63. };
  64. struct LabCOLOR {
  65. WORD L;
  66. WORD a;
  67. WORD b;
  68. };
  69. struct GENERIC3CHANNEL {
  70. WORD ch1;
  71. WORD ch2;
  72. WORD ch3;
  73. };
  74. struct NAMEDCOLOR {
  75. DWORD dwIndex;
  76. };
  77. struct HiFiCOLOR {
  78. BYTE channel[MAX_COLOR_CHANNELS];
  79. };
  80. typedef union tagCOLOR {
  81. struct GRAYCOLOR gray;
  82. struct RGBCOLOR rgb;
  83. struct CMYKCOLOR cmyk;
  84. struct XYZCOLOR XYZ;
  85. struct YxyCOLOR Yxy;
  86. struct LabCOLOR Lab;
  87. struct GENERIC3CHANNEL gen3ch;
  88. struct NAMEDCOLOR named;
  89. struct HiFiCOLOR hifi;
  90. struct { // alignment padding.
  91. DWORD reserved1;
  92. VOID *reserved2;
  93. };
  94. } COLOR;
  95. typedef COLOR *PCOLOR, *LPCOLOR;
  96. typedef enum {
  97. COLOR_GRAY = 1,
  98. COLOR_RGB,
  99. COLOR_XYZ,
  100. COLOR_Yxy,
  101. COLOR_Lab,
  102. COLOR_3_CHANNEL, // WORD per channel
  103. COLOR_CMYK,
  104. COLOR_5_CHANNEL, // BYTE per channel
  105. COLOR_6_CHANNEL, // - do -
  106. COLOR_7_CHANNEL, // - do -
  107. COLOR_8_CHANNEL, // - do -
  108. COLOR_NAMED,
  109. } COLORTYPE;
  110. typedef COLORTYPE *PCOLORTYPE, *LPCOLORTYPE;
  111. //
  112. // Bitmap formats supported
  113. //
  114. typedef enum {
  115. //
  116. // 16bpp - 5 bits per channel. The most significant bit is ignored.
  117. //
  118. BM_x555RGB = 0x0000,
  119. BM_x555XYZ = 0x0101,
  120. BM_x555Yxy,
  121. BM_x555Lab,
  122. BM_x555G3CH,
  123. //
  124. // Packed 8 bits per channel => 8bpp for GRAY and
  125. // 24bpp for the 3 channel colors, more for hifi channels
  126. //
  127. BM_RGBTRIPLETS = 0x0002,
  128. BM_BGRTRIPLETS = 0x0004,
  129. BM_XYZTRIPLETS = 0x0201,
  130. BM_YxyTRIPLETS,
  131. BM_LabTRIPLETS,
  132. BM_G3CHTRIPLETS,
  133. BM_5CHANNEL,
  134. BM_6CHANNEL,
  135. BM_7CHANNEL,
  136. BM_8CHANNEL,
  137. BM_GRAY,
  138. //
  139. // 32bpp - 8 bits per channel. The most significant byte is ignored
  140. // for the 3 channel colors.
  141. //
  142. BM_xRGBQUADS = 0x0008,
  143. BM_xBGRQUADS = 0x0010,
  144. BM_xG3CHQUADS = 0x0304,
  145. BM_KYMCQUADS,
  146. BM_CMYKQUADS = 0x0020,
  147. //
  148. // 32bpp - 10 bits per channel. The 2 most significant bits are ignored.
  149. //
  150. BM_10b_RGB = 0x0009,
  151. BM_10b_XYZ = 0x0401,
  152. BM_10b_Yxy,
  153. BM_10b_Lab,
  154. BM_10b_G3CH,
  155. //
  156. // 32bpp - named color indices (1-based)
  157. //
  158. BM_NAMED_INDEX,
  159. //
  160. // Packed 16 bits per channel => 16bpp for GRAY and
  161. // 48bpp for the 3 channel colors.
  162. //
  163. BM_16b_RGB = 0x000A,
  164. BM_16b_XYZ = 0x0501,
  165. BM_16b_Yxy,
  166. BM_16b_Lab,
  167. BM_16b_G3CH,
  168. BM_16b_GRAY,
  169. //
  170. // 16 bpp - 5 bits for Red & Blue, 6 bits for Green
  171. //
  172. BM_565RGB = 0x0001,
  173. } BMFORMAT;
  174. typedef BMFORMAT *PBMFORMAT, *LPBMFORMAT;
  175. //
  176. // Callback function definition
  177. //
  178. typedef BOOL (WINAPI *PBMCALLBACKFN)(ULONG, ULONG, LPARAM);
  179. typedef PBMCALLBACKFN LPBMCALLBACKFN;
  180. //
  181. // ICC profile header
  182. //
  183. typedef struct tagPROFILEHEADER {
  184. DWORD phSize; // profile size in bytes
  185. DWORD phCMMType; // CMM for this profile
  186. DWORD phVersion; // profile format version number
  187. DWORD phClass; // type of profile
  188. DWORD phDataColorSpace; // color space of data
  189. DWORD phConnectionSpace; // PCS
  190. DWORD phDateTime[3]; // date profile was created
  191. DWORD phSignature; // magic number
  192. DWORD phPlatform; // primary platform
  193. DWORD phProfileFlags; // various bit settings
  194. DWORD phManufacturer; // device manufacturer
  195. DWORD phModel; // device model number
  196. DWORD phAttributes[2]; // device attributes
  197. DWORD phRenderingIntent; // rendering intent
  198. CIEXYZ phIlluminant; // profile illuminant
  199. DWORD phCreator; // profile creator
  200. BYTE phReserved[44]; // reserved for future use
  201. } PROFILEHEADER;
  202. typedef PROFILEHEADER *PPROFILEHEADER, *LPPROFILEHEADER;
  203. //
  204. // Profile class values
  205. //
  206. #define CLASS_MONITOR 'mntr'
  207. #define CLASS_PRINTER 'prtr'
  208. #define CLASS_SCANNER 'scnr'
  209. #define CLASS_LINK 'link'
  210. #define CLASS_ABSTRACT 'abst'
  211. #define CLASS_COLORSPACE 'spac'
  212. #define CLASS_NAMED 'nmcl'
  213. //
  214. // Color space values
  215. //
  216. #define SPACE_XYZ 'XYZ '
  217. #define SPACE_Lab 'Lab '
  218. #define SPACE_Luv 'Luv '
  219. #define SPACE_YCbCr 'YCbr'
  220. #define SPACE_Yxy 'Yxy '
  221. #define SPACE_RGB 'RGB '
  222. #define SPACE_GRAY 'GRAY'
  223. #define SPACE_HSV 'HSV '
  224. #define SPACE_HLS 'HLS '
  225. #define SPACE_CMYK 'CMYK'
  226. #define SPACE_CMY 'CMY '
  227. #define SPACE_2_CHANNEL '2CLR'
  228. #define SPACE_3_CHANNEL '3CLR'
  229. #define SPACE_4_CHANNEL '4CLR'
  230. #define SPACE_5_CHANNEL '5CLR'
  231. #define SPACE_6_CHANNEL '6CLR'
  232. #define SPACE_7_CHANNEL '7CLR'
  233. #define SPACE_8_CHANNEL '8CLR'
  234. //
  235. // Profile flag bitfield values
  236. //
  237. #define FLAG_EMBEDDEDPROFILE 0x00000001
  238. #define FLAG_DEPENDENTONDATA 0x00000002
  239. //
  240. // Profile attributes bitfield values
  241. //
  242. #define ATTRIB_TRANSPARENCY 0x00000001
  243. #define ATTRIB_MATTE 0x00000002
  244. //
  245. // Rendering Intents
  246. //
  247. // + INTENT_PERCEPTUAL = LCS_GM_IMAGES for LOGCOLORSPACE
  248. // = DMICM_CONTRAST for DEVMODE
  249. // = "Pictures" for SetupColorMathing/Printer UI
  250. //
  251. // + INTENT_RELATIVE_COLORIMETRIC = LCS_GM_GRAPHICS for LOGCOLORSPACE
  252. // = DMICM_COLORIMETRIC for DEVMODE
  253. // = "Proof" for SetupColorMatching/Printer UI
  254. //
  255. // + INTENT_SATURATION = LCS_GM_BUSINESS for LOGCOLORSPACE
  256. // = DMICM_SATURATE for DEVMODE
  257. // = "Graphics" for SetupColorMatching/Printer UI
  258. //
  259. // + INTENT_ABSOLUTE_COLORIMETRIC = LCS_GM_ABS_COLORIMETRIC for LOGCOLORSPACE
  260. // = DMICM_ABS_COLORIMETRIC for DEVMODE
  261. // = "Match" for SetupColorMatching/Printer UI
  262. //
  263. #define INTENT_PERCEPTUAL 0
  264. #define INTENT_RELATIVE_COLORIMETRIC 1
  265. #define INTENT_SATURATION 2
  266. #define INTENT_ABSOLUTE_COLORIMETRIC 3
  267. //
  268. // Profile data structure
  269. //
  270. typedef struct tagPROFILE {
  271. DWORD dwType; // profile type
  272. PVOID pProfileData; // filename or buffer containing profile
  273. DWORD cbDataSize; // size of profile data
  274. } PROFILE;
  275. typedef PROFILE *PPROFILE, *LPPROFILE;
  276. //
  277. // Profile types to be used in the PROFILE structure
  278. //
  279. #define PROFILE_FILENAME 1 // profile data is NULL terminated filename
  280. #define PROFILE_MEMBUFFER 2 // profile data is a buffer containing
  281. // the profile
  282. //
  283. // Desired access mode for opening profiles
  284. //
  285. #define PROFILE_READ 1 // opened for read access
  286. #define PROFILE_READWRITE 2 // opened for read and write access
  287. //
  288. // Handles returned to applications
  289. //
  290. typedef HANDLE HPROFILE; // handle to profile object
  291. typedef HPROFILE *PHPROFILE;
  292. typedef HANDLE HTRANSFORM; // handle to color transform object
  293. //
  294. // CMM selection for CreateMultiProfileTransform and SelectCMM.
  295. //
  296. #define INDEX_DONT_CARE 0
  297. #define CMM_FROM_PROFILE INDEX_DONT_CARE // Use CMM specified in profile.
  298. #define CMM_WINDOWS_DEFAULT 'Win ' // Use Windows default CMM always.
  299. //
  300. // Tags found in ICC profiles
  301. //
  302. typedef DWORD TAGTYPE;
  303. typedef TAGTYPE *PTAGTYPE, *LPTAGTYPE;
  304. //
  305. // Profile enumeration data structure
  306. //
  307. #define ENUM_TYPE_VERSION 0x0300
  308. typedef struct tagENUMTYPEA {
  309. DWORD dwSize; // structure size
  310. DWORD dwVersion; // structure version
  311. DWORD dwFields; // bit fields
  312. PCSTR pDeviceName; // device friendly name
  313. DWORD dwMediaType; // media type
  314. DWORD dwDitheringMode; // dithering mode
  315. DWORD dwResolution[2]; // x and y resolutions
  316. DWORD dwCMMType; // cmm ID
  317. DWORD dwClass; // profile class
  318. DWORD dwDataColorSpace; // color space of data
  319. DWORD dwConnectionSpace; // pcs
  320. DWORD dwSignature; // magic number
  321. DWORD dwPlatform; // primary platform
  322. DWORD dwProfileFlags; // various bit settings in profile
  323. DWORD dwManufacturer; // manufacturer ID
  324. DWORD dwModel; // model ID
  325. DWORD dwAttributes[2]; // device attributes
  326. DWORD dwRenderingIntent; // rendering intent
  327. DWORD dwCreator; // profile creator
  328. DWORD dwDeviceClass; // device class
  329. } ENUMTYPEA, *PENUMTYPEA, *LPENUMTYPEA;
  330. typedef struct tagENUMTYPEW {
  331. DWORD dwSize; // structure size
  332. DWORD dwVersion; // structure version
  333. DWORD dwFields; // bit fields
  334. PCWSTR pDeviceName; // device friendly name
  335. DWORD dwMediaType; // media type
  336. DWORD dwDitheringMode; // dithering mode
  337. DWORD dwResolution[2]; // x and y resolutions
  338. DWORD dwCMMType; // cmm ID
  339. DWORD dwClass; // profile class
  340. DWORD dwDataColorSpace; // color space of data
  341. DWORD dwConnectionSpace; // pcs
  342. DWORD dwSignature; // magic number
  343. DWORD dwPlatform; // primary platform
  344. DWORD dwProfileFlags; // various bit settings in profile
  345. DWORD dwManufacturer; // manufacturer ID
  346. DWORD dwModel; // model ID
  347. DWORD dwAttributes[2]; // device attributes
  348. DWORD dwRenderingIntent; // rendering intent
  349. DWORD dwCreator; // profile creator
  350. DWORD dwDeviceClass; // device class
  351. } ENUMTYPEW, *PENUMTYPEW, *LPENUMTYPEW;
  352. //
  353. // Bitfields for enumeration record above
  354. //
  355. #define ET_DEVICENAME 0x00000001
  356. #define ET_MEDIATYPE 0x00000002
  357. #define ET_DITHERMODE 0x00000004
  358. #define ET_RESOLUTION 0x00000008
  359. #define ET_CMMTYPE 0x00000010
  360. #define ET_CLASS 0x00000020
  361. #define ET_DATACOLORSPACE 0x00000040
  362. #define ET_CONNECTIONSPACE 0x00000080
  363. #define ET_SIGNATURE 0x00000100
  364. #define ET_PLATFORM 0x00000200
  365. #define ET_PROFILEFLAGS 0x00000400
  366. #define ET_MANUFACTURER 0x00000800
  367. #define ET_MODEL 0x00001000
  368. #define ET_ATTRIBUTES 0x00002000
  369. #define ET_RENDERINGINTENT 0x00004000
  370. #define ET_CREATOR 0x00008000
  371. #define ET_DEVICECLASS 0x00010000
  372. //
  373. // Flags for creating color transforms
  374. //
  375. #define PROOF_MODE 0x00000001
  376. #define NORMAL_MODE 0x00000002
  377. #define BEST_MODE 0x00000003
  378. #define ENABLE_GAMUT_CHECKING 0x00010000
  379. #define USE_RELATIVE_COLORIMETRIC 0x00020000
  380. #define FAST_TRANSLATE 0x00040000
  381. #define RESERVED 0x80000000
  382. //
  383. // Paremeter for GetPS2ColorSpaceArray
  384. //
  385. #define CSA_A 1
  386. #define CSA_ABC 2
  387. #define CSA_DEF 3
  388. #define CSA_DEFG 4
  389. #define CSA_GRAY 5
  390. #define CSA_RGB 6
  391. #define CSA_CMYK 7
  392. #define CSA_Lab 8
  393. //
  394. // Parameter for CMGetInfo()
  395. //
  396. #define CMM_WIN_VERSION 0
  397. #define CMM_IDENT 1
  398. #define CMM_DRIVER_VERSION 2
  399. #define CMM_DLL_VERSION 3
  400. #define CMM_VERSION 4
  401. #define CMM_DESCRIPTION 5
  402. #define CMM_LOGOICON 6
  403. //
  404. // Parameter for CMTranslateRGBs()
  405. //
  406. #define CMS_FORWARD 0
  407. #define CMS_BACKWARD 1
  408. //
  409. // Constants for SetupColorMatching()
  410. //
  411. #define COLOR_MATCH_VERSION 0x0200
  412. //
  413. // Constants for flags
  414. //
  415. #define CMS_DISABLEICM 1 // Disable color matching
  416. #define CMS_ENABLEPROOFING 2 // Enable proofing
  417. #define CMS_SETRENDERINTENT 4 // Use passed in value
  418. #define CMS_SETPROOFINTENT 8
  419. #define CMS_SETMONITORPROFILE 0x10 // Use passed in profile name initially
  420. #define CMS_SETPRINTERPROFILE 0x20
  421. #define CMS_SETTARGETPROFILE 0x40
  422. #define CMS_USEHOOK 0x80 // Use hook procedure in lpfnHook
  423. #define CMS_USEAPPLYCALLBACK 0x100 // Use callback procedure when applied
  424. #define CMS_USEDESCRIPTION 0x200 // Use profile description in UI
  425. // (default is filename)
  426. #define CMS_DISABLEINTENT 0x400 // Disable intent selection (render & proofing) always
  427. #define CMS_DISABLERENDERINTENT 0x800 // Disable rendering intent selection while in proofing mode
  428. // Only proofing intent selection is enabled.
  429. //
  430. // Used to denote too-small buffers (output only)
  431. //
  432. #define CMS_MONITOROVERFLOW 0x80000000L
  433. #define CMS_PRINTEROVERFLOW 0x40000000L
  434. #define CMS_TARGETOVERFLOW 0x20000000L
  435. //
  436. // Structures (both ANSI and Unicode)
  437. //
  438. struct _tagCOLORMATCHSETUPW;
  439. struct _tagCOLORMATCHSETUPA;
  440. typedef BOOL (WINAPI *PCMSCALLBACKW)(struct _tagCOLORMATCHSETUPW *,LPARAM);
  441. typedef BOOL (WINAPI *PCMSCALLBACKA)(struct _tagCOLORMATCHSETUPA *,LPARAM);
  442. typedef struct _tagCOLORMATCHSETUPW {
  443. DWORD dwSize; // Size of structure in bytes
  444. DWORD dwVersion; // Set to COLOR_MATCH_VERSION
  445. DWORD dwFlags; // See constants listed previously
  446. HWND hwndOwner; // Window handle of owner
  447. PCWSTR pSourceName; // Name of Image Source, defaults to "sRGB Color Space"
  448. PCWSTR pDisplayName; // If null, defaults to first enumerated monitor
  449. PCWSTR pPrinterName; // If null, defaults to default printer.
  450. DWORD dwRenderIntent; // Rendering Intent
  451. DWORD dwProofingIntent; // Rendering Intent for Proofing
  452. PWSTR pMonitorProfile; // Monitor profile name
  453. DWORD ccMonitorProfile; // Size of above in characters
  454. PWSTR pPrinterProfile; // Printer profile name
  455. DWORD ccPrinterProfile; // Size of above in characters
  456. PWSTR pTargetProfile; // Target profile name
  457. DWORD ccTargetProfile; // Size of above in characters
  458. DLGPROC lpfnHook; // Hook Procedure address
  459. LPARAM lParam; // Given to hook procedure at WM_INITDIALOG
  460. PCMSCALLBACKW lpfnApplyCallback; // Callback Procedure address when apply is pushed
  461. LPARAM lParamApplyCallback; // Given to callback Procedure for apply
  462. } COLORMATCHSETUPW, *PCOLORMATCHSETUPW, *LPCOLORMATCHSETUPW;
  463. typedef struct _tagCOLORMATCHSETUPA {
  464. DWORD dwSize; // Size of structure in bytes
  465. DWORD dwVersion; // Set to COLOR_MATCH_VERSION
  466. DWORD dwFlags; // See constants listed previously
  467. HWND hwndOwner; // Window handle of owner
  468. PCSTR pSourceName; // Name of Image Source, defaults to "This Document"
  469. PCSTR pDisplayName; // If null, defaults to first enumerated monitor
  470. PCSTR pPrinterName; // If null, defaults to default printer.
  471. DWORD dwRenderIntent; // Rendering Intent
  472. DWORD dwProofingIntent; // Rendering Intent for Proofing
  473. PSTR pMonitorProfile; // Monitor profile name
  474. DWORD ccMonitorProfile; // Size of above in characters
  475. PSTR pPrinterProfile; // Printer profile name
  476. DWORD ccPrinterProfile; // Size of above in characters
  477. PSTR pTargetProfile; // Target profile name
  478. DWORD ccTargetProfile; // Size of above in characters
  479. DLGPROC lpfnHook; // Hook Procedure address
  480. LPARAM lParam; // Given to hook procedure at WM_INITDIALOG
  481. PCMSCALLBACKA lpfnApplyCallback; // Callback Procedure address when apply is pushed
  482. LPARAM lParamApplyCallback; // Given to callback Procedure for apply
  483. } COLORMATCHSETUPA, *PCOLORMATCHSETUPA, *LPCOLORMATCHSETUPA;
  484. //
  485. // Windows API definitions
  486. //
  487. HPROFILE WINAPI OpenColorProfileA(PPROFILE, DWORD, DWORD, DWORD);
  488. HPROFILE WINAPI OpenColorProfileW(PPROFILE, DWORD, DWORD, DWORD);
  489. BOOL WINAPI CloseColorProfile(HPROFILE);
  490. BOOL WINAPI GetColorProfileFromHandle(HPROFILE, PBYTE, PDWORD);
  491. BOOL WINAPI IsColorProfileValid(HPROFILE, PBOOL);
  492. BOOL WINAPI CreateProfileFromLogColorSpaceA(LPLOGCOLORSPACEA, PBYTE*);
  493. BOOL WINAPI CreateProfileFromLogColorSpaceW(LPLOGCOLORSPACEW, PBYTE*);
  494. BOOL WINAPI GetCountColorProfileElements(HPROFILE, PDWORD);
  495. BOOL WINAPI GetColorProfileHeader(HPROFILE, PPROFILEHEADER);
  496. BOOL WINAPI GetColorProfileElementTag(HPROFILE, DWORD, PTAGTYPE);
  497. BOOL WINAPI IsColorProfileTagPresent(HPROFILE, TAGTYPE, PBOOL);
  498. BOOL WINAPI GetColorProfileElement(HPROFILE, TAGTYPE, DWORD, PDWORD, PVOID, PBOOL);
  499. BOOL WINAPI SetColorProfileHeader(HPROFILE, PPROFILEHEADER);
  500. BOOL WINAPI SetColorProfileElementSize(HPROFILE, TAGTYPE, DWORD);
  501. BOOL WINAPI SetColorProfileElement(HPROFILE, TAGTYPE, DWORD, PDWORD, PVOID);
  502. BOOL WINAPI SetColorProfileElementReference(HPROFILE, TAGTYPE, TAGTYPE);
  503. BOOL WINAPI GetPS2ColorSpaceArray (HPROFILE, DWORD, DWORD, PBYTE, PDWORD, PBOOL);
  504. BOOL WINAPI GetPS2ColorRenderingIntent(HPROFILE, DWORD, PBYTE, PDWORD);
  505. BOOL WINAPI GetPS2ColorRenderingDictionary(HPROFILE, DWORD, PBYTE, PDWORD, PBOOL);
  506. BOOL WINAPI GetNamedProfileInfo(HPROFILE, PNAMED_PROFILE_INFO);
  507. BOOL WINAPI ConvertColorNameToIndex(HPROFILE, PCOLOR_NAME, PDWORD, DWORD);
  508. BOOL WINAPI ConvertIndexToColorName(HPROFILE, PDWORD, PCOLOR_NAME, DWORD);
  509. BOOL WINAPI CreateDeviceLinkProfile(PHPROFILE, DWORD, PDWORD, DWORD, DWORD, PBYTE*, DWORD);
  510. HTRANSFORM WINAPI CreateColorTransformA(LPLOGCOLORSPACEA, HPROFILE, HPROFILE, DWORD);
  511. HTRANSFORM WINAPI CreateColorTransformW(LPLOGCOLORSPACEW, HPROFILE, HPROFILE, DWORD);
  512. HTRANSFORM WINAPI CreateMultiProfileTransform(PHPROFILE, DWORD, PDWORD, DWORD, DWORD, DWORD);
  513. BOOL WINAPI DeleteColorTransform(HTRANSFORM);
  514. BOOL WINAPI TranslateBitmapBits(HTRANSFORM, PVOID, BMFORMAT, DWORD, DWORD, DWORD, PVOID, BMFORMAT, DWORD, PBMCALLBACKFN, LPARAM);
  515. BOOL WINAPI CheckBitmapBits(HTRANSFORM , PVOID, BMFORMAT, DWORD, DWORD, DWORD, PBYTE, PBMCALLBACKFN, LPARAM);
  516. BOOL WINAPI TranslateColors(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PCOLOR, COLORTYPE);
  517. BOOL WINAPI CheckColors(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PBYTE);
  518. DWORD WINAPI GetCMMInfo(HTRANSFORM, DWORD);
  519. BOOL WINAPI RegisterCMMA(PCSTR, DWORD, PCSTR);
  520. BOOL WINAPI RegisterCMMW(PCWSTR, DWORD, PCWSTR);
  521. BOOL WINAPI UnregisterCMMA(PCSTR, DWORD);
  522. BOOL WINAPI UnregisterCMMW(PCWSTR, DWORD);
  523. BOOL WINAPI SelectCMM(DWORD);
  524. BOOL WINAPI GetColorDirectoryA(PCSTR, PSTR, PDWORD);
  525. BOOL WINAPI GetColorDirectoryW(PCWSTR, PWSTR, PDWORD);
  526. BOOL WINAPI InstallColorProfileA(PCSTR, PCSTR);
  527. BOOL WINAPI InstallColorProfileW(PCWSTR, PCWSTR);
  528. BOOL WINAPI UninstallColorProfileA(PCSTR, PCSTR, BOOL);
  529. BOOL WINAPI UninstallColorProfileW(PCWSTR, PCWSTR, BOOL);
  530. BOOL WINAPI EnumColorProfilesA(PCSTR, PENUMTYPEA, PBYTE, PDWORD, PDWORD);
  531. BOOL WINAPI EnumColorProfilesW(PCWSTR, PENUMTYPEW, PBYTE, PDWORD, PDWORD);
  532. BOOL WINAPI SetStandardColorSpaceProfileA(PCSTR, DWORD, PCSTR);
  533. BOOL WINAPI SetStandardColorSpaceProfileW(PCWSTR, DWORD, PCWSTR);
  534. BOOL WINAPI GetStandardColorSpaceProfileA(PCSTR, DWORD, PSTR, PDWORD);
  535. BOOL WINAPI GetStandardColorSpaceProfileW(PCWSTR, DWORD, PWSTR, PDWORD);
  536. BOOL WINAPI AssociateColorProfileWithDeviceA(PCSTR, PCSTR, PCSTR);
  537. BOOL WINAPI AssociateColorProfileWithDeviceW(PCWSTR, PCWSTR, PCWSTR);
  538. BOOL WINAPI DisassociateColorProfileFromDeviceA(PCSTR, PCSTR, PCSTR);
  539. BOOL WINAPI DisassociateColorProfileFromDeviceW(PCWSTR, PCWSTR, PCWSTR);
  540. BOOL WINAPI SetupColorMatchingW(PCOLORMATCHSETUPW pcms);
  541. BOOL WINAPI SetupColorMatchingA(PCOLORMATCHSETUPA pcms);
  542. #ifdef UNICODE
  543. #define ENUMTYPE ENUMTYPEW
  544. #define PENUMTYPE PENUMTYPEW
  545. #define COLORMATCHSETUP COLORMATCHSETUPW
  546. #define PCOLORMATCHSETUP PCOLORMATCHSETUPW
  547. #define LPCOLORMATCHSETUP LPCOLORMATCHSETUPW
  548. #define PCMSCALLBACK PCMSCALLBACKW
  549. #define CreateColorTransform CreateColorTransformW
  550. #define OpenColorProfile OpenColorProfileW
  551. #define CreateProfileFromLogColorSpace CreateProfileFromLogColorSpaceW
  552. #define RegisterCMM RegisterCMMW
  553. #define UnregisterCMM UnregisterCMMW
  554. #define GetColorDirectory GetColorDirectoryW
  555. #define InstallColorProfile InstallColorProfileW
  556. #define UninstallColorProfile UninstallColorProfileW
  557. #define AssociateColorProfileWithDevice AssociateColorProfileWithDeviceW
  558. #define DisassociateColorProfileFromDevice DisassociateColorProfileFromDeviceW
  559. #define EnumColorProfiles EnumColorProfilesW
  560. #define SetStandardColorSpaceProfile SetStandardColorSpaceProfileW
  561. #define GetStandardColorSpaceProfile GetStandardColorSpaceProfileW
  562. #define SetupColorMatching SetupColorMatchingW
  563. #else
  564. #define ENUMTYPE ENUMTYPEA
  565. #define PENUMTYPE PENUMTYPEA
  566. #define COLORMATCHSETUP COLORMATCHSETUPA
  567. #define PCOLORMATCHSETUP PCOLORMATCHSETUPA
  568. #define LPCOLORMATCHSETUP LPCOLORMATCHSETUPA
  569. #define PCMSCALLBACK PCMSCALLBACKA
  570. #define CreateColorTransform CreateColorTransformA
  571. #define OpenColorProfile OpenColorProfileA
  572. #define CreateProfileFromLogColorSpace CreateProfileFromLogColorSpaceA
  573. #define RegisterCMM RegisterCMMA
  574. #define UnregisterCMM UnregisterCMMA
  575. #define GetColorDirectory GetColorDirectoryA
  576. #define InstallColorProfile InstallColorProfileA
  577. #define UninstallColorProfile UninstallColorProfileA
  578. #define AssociateColorProfileWithDevice AssociateColorProfileWithDeviceA
  579. #define DisassociateColorProfileFromDevice DisassociateColorProfileFromDeviceA
  580. #define EnumColorProfiles EnumColorProfilesA
  581. #define SetStandardColorSpaceProfile SetStandardColorSpaceProfileA
  582. #define GetStandardColorSpaceProfile GetStandardColorSpaceProfileA
  583. #define SetupColorMatching SetupColorMatchingA
  584. #endif // !UNICODE
  585. //
  586. // Transform returned by CMM
  587. //
  588. typedef HANDLE HCMTRANSFORM;
  589. //
  590. // Pointer to ICC color profile data.
  591. //
  592. typedef PVOID LPDEVCHARACTER;
  593. //
  594. // CMM API definition
  595. //
  596. BOOL WINAPI CMCheckColors(
  597. HCMTRANSFORM hcmTransform, // transform handle
  598. LPCOLOR lpaInputColors, // array of COLORs
  599. DWORD nColors, // COLOR array size
  600. COLORTYPE ctInput, // input color type
  601. LPBYTE lpaResult // buffer for results
  602. );
  603. BOOL WINAPI CMCheckColorsInGamut(
  604. HCMTRANSFORM hcmTransform, // transform handle
  605. RGBTRIPLE *lpaRGBTriple, // RGB triple array
  606. LPBYTE lpaResult, // buffer for results
  607. UINT nCount // result buffer size
  608. );
  609. BOOL WINAPI CMCheckRGBs(
  610. HCMTRANSFORM hcmTransform, // transform handle
  611. LPVOID lpSrcBits, // source bitmap bits
  612. BMFORMAT bmInput, // source bitmap format
  613. DWORD dwWidth, // source bitmap width
  614. DWORD dwHeight, // source bitmap hight
  615. DWORD dwStride, // source bitmap delta
  616. LPBYTE lpaResult, // buffer for results
  617. PBMCALLBACKFN pfnCallback, // pointer to callback function
  618. LPARAM ulCallbackData // caller-defined parameter to callback
  619. );
  620. BOOL WINAPI CMConvertColorNameToIndex(
  621. HPROFILE hProfile,
  622. PCOLOR_NAME paColorName,
  623. PDWORD paIndex,
  624. DWORD dwCount
  625. );
  626. BOOL WINAPI CMConvertIndexToColorName(
  627. HPROFILE hProfile,
  628. PDWORD paIndex,
  629. PCOLOR_NAME paColorName,
  630. DWORD dwCount
  631. );
  632. BOOL WINAPI CMCreateDeviceLinkProfile(
  633. PHPROFILE pahProfiles, // array of profile handles
  634. DWORD nProfiles, // profile handle array size
  635. PDWORD padwIntents, // array of rendering intents
  636. DWORD nIntents, // intent array size
  637. DWORD dwFlags, // transform creation flags
  638. LPBYTE *lpProfileData // pointer to pointer to buffer
  639. );
  640. HCMTRANSFORM WINAPI CMCreateMultiProfileTransform(
  641. PHPROFILE pahProfiles, // array of profile handles
  642. DWORD nProfiles, // profile handle array size
  643. PDWORD padwIntents, // array of rendering intents
  644. DWORD nIntents, // intent array size
  645. DWORD dwFlags // transform creation flags
  646. );
  647. BOOL WINAPI CMCreateProfile(
  648. LPLOGCOLORSPACEA lpColorSpace, // pointer to a logical color space
  649. LPDEVCHARACTER *lpProfileData // pointer to pointer to buffer
  650. );
  651. BOOL WINAPI CMCreateProfileW(
  652. LPLOGCOLORSPACEW lpColorSpace, // pointer to a logical color space
  653. LPDEVCHARACTER *lpProfileData // pointer to pointer to buffer
  654. );
  655. HCMTRANSFORM WINAPI CMCreateTransform(
  656. LPLOGCOLORSPACEA lpColorSpace, // pointer to logical color space
  657. LPDEVCHARACTER lpDevCharacter, // profile data
  658. LPDEVCHARACTER lpTargetDevCharacter // target profile data
  659. );
  660. HCMTRANSFORM WINAPI CMCreateTransformW(
  661. LPLOGCOLORSPACEW lpColorSpace, // pointer to logical color space
  662. LPDEVCHARACTER lpDevCharacter, // profile data
  663. LPDEVCHARACTER lpTargetDevCharacter // target profile data
  664. );
  665. HCMTRANSFORM WINAPI CMCreateTransformExt(
  666. LPLOGCOLORSPACEA lpColorSpace, // pointer to logical color space
  667. LPDEVCHARACTER lpDevCharacter, // profile data
  668. LPDEVCHARACTER lpTargetDevCharacter, // target profile data
  669. DWORD dwFlags // creation flags
  670. );
  671. HCMTRANSFORM WINAPI CMCreateTransformExtW(
  672. LPLOGCOLORSPACEW lpColorSpace, // pointer to logical color space
  673. LPDEVCHARACTER lpDevCharacter, // profile data
  674. LPDEVCHARACTER lpTargetDevCharacter, // target profile data
  675. DWORD dwFlags // creation flags
  676. );
  677. BOOL WINAPI CMDeleteTransform(
  678. HCMTRANSFORM hcmTransform // transform handle to be deleted.
  679. );
  680. DWORD WINAPI CMGetInfo(
  681. DWORD dwInfo
  682. );
  683. BOOL WINAPI CMGetNamedProfileInfo(
  684. HPROFILE hProfile, // profile handle
  685. PNAMED_PROFILE_INFO pNamedProfileInfo // pointer to named profile info
  686. );
  687. BOOL WINAPI CMGetPS2ColorRenderingDictionary(
  688. HPROFILE hProfile,
  689. DWORD dwIntent,
  690. LPBYTE lpBuffer,
  691. LPDWORD lpcbSize,
  692. LPBOOL lpbBinary
  693. );
  694. BOOL WINAPI CMGetPS2ColorRenderingIntent(
  695. HPROFILE hProfile,
  696. DWORD dwIntent,
  697. LPBYTE lpBuffer,
  698. LPDWORD lpcbSize
  699. );
  700. BOOL WINAPI CMGetPS2ColorSpaceArray(
  701. HPROFILE hProfile,
  702. DWORD dwIntent,
  703. DWORD dwCSAType,
  704. LPBYTE lpBuffer,
  705. LPDWORD lpcbSize,
  706. LPBOOL lpbBinary
  707. );
  708. BOOL WINAPI CMIsProfileValid(
  709. HPROFILE hProfile, // proflle handle
  710. LPBOOL lpbValid // buffer for result.
  711. );
  712. BOOL WINAPI CMTranslateColors(
  713. HCMTRANSFORM hcmTransform, // transform handle
  714. LPCOLOR lpaInputColors, // pointer to input color array
  715. DWORD nColors, // number of color in color array
  716. COLORTYPE ctInput, // input color type
  717. LPCOLOR lpaOutputColors, // pointer to output color array
  718. COLORTYPE ctOutput // output color type
  719. );
  720. BOOL WINAPI CMTranslateRGB(
  721. HCMTRANSFORM hcmTransform,
  722. COLORREF ColorRef,
  723. LPCOLORREF lpColorRef,
  724. DWORD dwFlags
  725. );
  726. BOOL WINAPI CMTranslateRGBs(
  727. HCMTRANSFORM hcmTransform,
  728. LPVOID lpSrcBits,
  729. BMFORMAT bmInput,
  730. DWORD dwWidth,
  731. DWORD dwHeight,
  732. DWORD dwStride,
  733. LPVOID lpDestBits,
  734. BMFORMAT bmOutput,
  735. DWORD dwTranslateDirection
  736. );
  737. BOOL WINAPI CMTranslateRGBsExt(
  738. HCMTRANSFORM hcmTransform,
  739. LPVOID lpSrcBits,
  740. BMFORMAT bmInput,
  741. DWORD dwWidth,
  742. DWORD dwHeight,
  743. DWORD dwInputStride,
  744. LPVOID lpDestBits,
  745. BMFORMAT bmOutput,
  746. DWORD dwOutputStride,
  747. LPBMCALLBACKFN lpfnCallback,
  748. LPARAM ulCallbackData
  749. );
  750. #ifdef __cplusplus
  751. }
  752. #endif
  753. #endif // ifndef _ICM_H_