Leaked source code of windows server 2003
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.

1046 lines
26 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: gdiicm *
  3. * *
  4. * Definitions needed for client side objects. *
  5. * *
  6. * Copyright (c) 1993-1999 Microsoft Corporation *
  7. \**************************************************************************/
  8. //
  9. // ICM
  10. //
  11. #if DBG
  12. #define DBG_ICM 1
  13. #else
  14. #define DBG_ICM 0
  15. #endif
  16. #if DBG_ICM
  17. #define DBG_ICM_API 0x00000001
  18. #define DBG_ICM_WRN 0x00000002
  19. #define DBG_ICM_MSG 0x00000004
  20. #define DBG_ICM_COMPATIBLEDC 0x00000008
  21. #define DBG_ICM_METAFILE 0x00000010
  22. extern ULONG DbgIcm;
  23. //
  24. // trace APIs
  25. //
  26. #define ICMAPI(s) \
  27. if (DbgIcm & DBG_ICM_API) \
  28. { \
  29. DbgPrint ## s; \
  30. }
  31. #define ICMMSG(s) \
  32. if (DbgIcm & DBG_ICM_MSG) \
  33. { \
  34. DbgPrint ## s; \
  35. }
  36. #define ICMWRN(s) \
  37. if (DbgIcm & DBG_ICM_WRN) \
  38. { \
  39. DbgPrint ## s; \
  40. }
  41. #else
  42. #define ICMAPI(s)
  43. #define ICMMSG(s)
  44. #define ICMWRN(s)
  45. #endif
  46. #define LOAD_ICMDLL(errCode) if ((ghICM == NULL) && (!IcmInitialize())) { \
  47. WARNING("gdi32: Can't load mscms.dll\n"); \
  48. return((errCode)); \
  49. }
  50. //
  51. // The direction of color transform
  52. //
  53. #define ICM_FORWARD 0x0001
  54. #define ICM_BACKWARD 0x0002
  55. //
  56. // Default intents
  57. //
  58. #define LCS_DEFAULT_INTENT LCS_GM_IMAGES
  59. #define DM_DEFAULT_INTENT DMICM_CONTRAST
  60. typedef struct _PROFILECALLBACK_DATA
  61. {
  62. PWSTR pwszFileName;
  63. BOOL bFound;
  64. } PROFILECALLBACK_DATA, *PPROFILECALLBACK_DATA;
  65. //
  66. // The flags for DIB_TRANSLATE_INFO.TranslateType
  67. //
  68. #define TRANSLATE_BITMAP 0x0001
  69. #define TRANSLATE_HEADER 0x0002
  70. typedef struct _DIB_TRANSLATE_INFO
  71. {
  72. ULONG TranslateType;
  73. BMFORMAT SourceColorType;
  74. BMFORMAT TranslateColorType;
  75. ULONG SourceWidth;
  76. ULONG SourceHeight;
  77. ULONG SourceBitCount;
  78. LPBITMAPINFO TranslateBitmapInfo;
  79. ULONG TranslateBitmapInfoSize;
  80. PVOID pvSourceBits;
  81. ULONG cjSourceBits;
  82. PVOID pvTranslateBits;
  83. ULONG cjTranslateBits;
  84. } DIB_TRANSLATE_INFO, *PDIB_TRANSLATE_INFO;
  85. //
  86. // Cached Color Space Structure
  87. //
  88. typedef struct _CACHED_COLORSPACE
  89. {
  90. LIST_ENTRY ListEntry;
  91. HGDIOBJ hObj;
  92. FLONG flInfo;
  93. ULONG cRef;
  94. HPROFILE hProfile;
  95. DWORD ColorIntent;
  96. BMFORMAT ColorFormat;
  97. PROFILE ColorProfile;
  98. LOGCOLORSPACEW LogColorSpace;
  99. } CACHED_COLORSPACE, *PCACHED_COLORSPACE;
  100. //
  101. // CACHED_COLORSPACE.flInfo
  102. //
  103. #define HGDIOBJ_SPECIFIC_COLORSPACE 0x010000
  104. #define NOT_CACHEABLE_COLORSPACE 0x020000
  105. #define NEED_TO_FREE_PROFILE 0x040000 // ColorProfile.pProfileData must be GlobalFree()
  106. #define NEED_TO_DEL_PROFILE 0x080000
  107. #define NEED_TO_DEL_PROFILE_WITH_HOBJ 0x100000
  108. #define ON_MEMORY_PROFILE 0x200000
  109. #define DEVICE_CALIBRATE_COLORSPACE 0x000001 // Enable "DeviceColorCalibration" during halftoning
  110. #define METAFILE_COLORSPACE (0x000002 | HGDIOBJ_SPECIFIC_COLORSPACE) // DC (metafile)
  111. #define DRIVER_COLORSPACE (0x000004 | HGDIOBJ_SPECIFIC_COLORSPACE) // DC (source)
  112. #define DIBSECTION_COLORSPACE (0x000010 | HGDIOBJ_SPECIFIC_COLORSPACE) // DIBSection
  113. #define GET_COLORSPACE_TYPE(x) ((x) & 0x000FFF)
  114. //
  115. // Cached Color Transform Structure
  116. //
  117. typedef struct _CACHED_COLORTRANSFORM
  118. {
  119. LIST_ENTRY ListEntry;
  120. FLONG flInfo;
  121. HDC hdc;
  122. ULONG cRef;
  123. HANDLE ColorTransform;
  124. PCACHED_COLORSPACE SourceColorSpace;
  125. PCACHED_COLORSPACE DestinationColorSpace;
  126. PCACHED_COLORSPACE TargetColorSpace;
  127. } CACHED_COLORTRANSFORM, *PCACHED_COLORTRANSFORM;
  128. //
  129. // CACHED_COLORTRANSFORM.flInfo
  130. //
  131. #define DEVICE_COLORTRANSFORM 0x0004
  132. #define CACHEABLE_COLORTRANSFORM 0x0010
  133. //
  134. // Matafiled ICC profile
  135. //
  136. typedef struct _MATAFILE_COLORPROFILE
  137. {
  138. LIST_ENTRY ListEntry;
  139. WCHAR ColorProfile[MAX_PATH];
  140. } METAFILE_COLORPROFILE, *PMETAFILE_COLORPROFILE;
  141. #define IDENT_COLORTRANSFORM ((PCACHED_COLORTRANSFORM)-1)
  142. //
  143. // Saved ICMINFO for SaveDC and RestoreDC API.
  144. //
  145. typedef struct _SAVED_ICMINFO
  146. {
  147. LIST_ENTRY ListEntry;
  148. DWORD dwSavedDepth; // Saved depth
  149. PCACHED_COLORSPACE pSourceColorSpace; // Pointer to source profile data
  150. PCACHED_COLORSPACE pDestColorSpace; // Pointer to destination profile data
  151. PCACHED_COLORSPACE pTargetColorSpace; // Pointer to target profile data
  152. PCACHED_COLORTRANSFORM pCXform; // Pointer to color transform
  153. PCACHED_COLORTRANSFORM pBackCXform; // Pointer to Backward color transform for GetXXX API
  154. PCACHED_COLORTRANSFORM pProofCXform; // Pointer to Proofing color transform for ColorMatchToTarget()
  155. } SAVED_ICMINFO, *PSAVED_ICMINFO;
  156. //
  157. // ICM related info associated to DC.
  158. //
  159. typedef struct _GDI_ICMINFO
  160. {
  161. LIST_ENTRY ListEntry;
  162. HDC hdc; // hdc who owns this ICM info.
  163. PVOID pvdcattr; // pointer to dcattr
  164. FLONG flInfo; // Flags
  165. PCACHED_COLORSPACE pSourceColorSpace; // Pointer to source profile data
  166. PCACHED_COLORSPACE pDestColorSpace; // Pointer to destination profile data
  167. PCACHED_COLORSPACE pTargetColorSpace; // Pointer to target profile data
  168. PCACHED_COLORTRANSFORM pCXform; // Pointer to color transform
  169. PCACHED_COLORTRANSFORM pBackCXform; // Pointer to Backward color transform for GetXXX API
  170. PCACHED_COLORTRANSFORM pProofCXform; // Pointer to Proofing color transform for ColorMatchToTarget()
  171. HCOLORSPACE hDefaultSrcColorSpace; // Handle (kernel-mode) to default source color space
  172. DWORD dwDefaultIntent; // default intent in LOGCOLORSPACE
  173. LIST_ENTRY SavedIcmInfo; // Saved ICMINFO for SaveDC and RestoreDC API
  174. WCHAR DefaultDstProfile[MAX_PATH]; // DC's default source color profile
  175. } GDI_ICMINFO, *PGDI_ICMINFO;
  176. //
  177. // GDI_ICMINFO.flInfo
  178. //
  179. #define ICM_VALID_DEFAULT_PROFILE 0x0001
  180. #define ICM_VALID_CURRENT_PROFILE 0x0002
  181. #define ICM_DELETE_SOURCE_COLORSPACE 0x0004
  182. #define ICM_ON_ICMINFO_LIST 0x0008
  183. #define ICM_UNDER_INITIALIZING 0x0010
  184. #define ICM_UNDER_CHANGING 0x0020
  185. #define ICM_IN_USE (ICM_UNDER_INITIALIZING|ICM_UNDER_CHANGING)
  186. //
  187. // PGDI_ICMINFO INIT_ICMINFO(hdc,pdcattr)
  188. //
  189. #define INIT_ICMINFO(hdc,pdcattr) (IcmInitIcmInfo((hdc),(pdcattr)))
  190. //
  191. // PGDI_ICMINFO GET_ICMINFO(PDC_ATTR)
  192. //
  193. #define GET_ICMINFO(pdcattr) ((PGDI_ICMINFO)((pdcattr)->pvICM))
  194. //
  195. // BOOL BEXIST_ICMINFO(PDC_ATTR)
  196. //
  197. #define BEXIST_ICMINFO(pdcattr) (((pdcattr)->pvICM != NULL) ? TRUE : FALSE)
  198. //
  199. // BOOL bNeedTranslateColor(PDC_ATTR)
  200. //
  201. #define bNeedTranslateColor(pdcattr) \
  202. (IS_ICM_HOST(pdcattr->lIcmMode) && \
  203. (!IS_ICM_LAZY_CORRECTION(pdcattr->lIcmMode)) && \
  204. (pdcattr->hcmXform != NULL))
  205. //
  206. // VOID IcmMarkInUseIcmInfo(PGDI_ICMINFO,BOOL)
  207. //
  208. #define IcmMarkInUseIcmInfo(pIcmInfo,bInUse) \
  209. ENTERCRITICALSECTION(&semListIcmInfo); \
  210. if ((bInUse)) \
  211. (pIcmInfo)->flInfo |= ICM_UNDER_CHANGING; \
  212. else \
  213. (pIcmInfo)->flInfo &= ~ICM_UNDER_CHANGING; \
  214. LEAVECRITICALSECTION(&semListIcmInfo);
  215. //
  216. // Functions exports from MSCMS.DLL
  217. //
  218. //
  219. // HPROFILE
  220. // OpenColorProfile(
  221. // PROFILE pProfile,
  222. // DWORD dwDesiredAccess,
  223. // DWORD dwShareMode,
  224. // DWORD dwCreationMode
  225. // );
  226. //
  227. typedef HPROFILE (FAR WINAPI * FPOPENCOLORPROFILEA)(PPROFILE, DWORD, DWORD, DWORD);
  228. typedef HPROFILE (FAR WINAPI * FPOPENCOLORPROFILEW)(PPROFILE, DWORD, DWORD, DWORD);
  229. //
  230. // BOOL
  231. // CloseColorProfile(
  232. // HPROFILE hProfile
  233. // );
  234. //
  235. typedef BOOL (FAR WINAPI * FPCLOSECOLORPROFILE)(HPROFILE);
  236. //
  237. // BOOL
  238. // IsColorProfileValid(
  239. // HPROFILE hProfile
  240. // );
  241. //
  242. typedef BOOL (FAR WINAPI * FPISCOLORPROFILEVALID)(HPROFILE);
  243. //
  244. // BOOL
  245. // CreateDeviceLinkProfile(
  246. // PHPROFILE pahProfile,
  247. // DWORD nProfiles,
  248. // PBYTE *nProfileData,
  249. // DWORD indexPreferredCMM
  250. // );
  251. //
  252. typedef BOOL (FAR WINAPI * FPCREATEDEVICELINKPROFILE)(PHPROFILE, DWORD, PBYTE *, DWORD);
  253. //
  254. // HTRANSFORM
  255. // CreateColorTransform(
  256. // LPLOGCOLORSPACE[A|W] pLogColorSpace,
  257. // HPROFILE hDestProfile,
  258. // HPROFILE hTargetProfile,
  259. // DWORD dwFlags
  260. // );
  261. //
  262. typedef HTRANSFORM (FAR WINAPI * FPCREATECOLORTRANSFORMA)(LPLOGCOLORSPACEA, HPROFILE, HPROFILE, DWORD);
  263. typedef HTRANSFORM (FAR WINAPI * FPCREATECOLORTRANSFORMW)(LPLOGCOLORSPACEW, HPROFILE, HPROFILE, DWORD);
  264. //
  265. // HTRANSFORM
  266. // CreateMultiProfileTransform(
  267. // PHPROFILE phProfile,
  268. // DWORD nProfiles,
  269. // PDWORD padwIntent,
  270. // DWORD nIntents,
  271. // DWORD dwFlags,
  272. // DWORD indexPreferredCMM
  273. // );
  274. //
  275. typedef HTRANSFORM (FAR WINAPI * FPCREATEMULTIPROFILETRANSFORM)(PHPROFILE, DWORD, PDWORD, DWORD, DWORD, DWORD);
  276. //
  277. // BOOL
  278. // DeleteColorTransform(
  279. // HTRANSFORM hxform
  280. // );
  281. //
  282. typedef BOOL (FAR WINAPI * FPDELETECOLORTRANSFORM)(HTRANSFORM);
  283. //
  284. // BOOL
  285. // TranslateBitmapBits(
  286. // HTRANSFORM hxform,
  287. // PVOID pSrcBits,
  288. // BMFORMAT bmInput,
  289. // DWORD dwWidth,
  290. // DWORD dwHeight,
  291. // DWORD dwInputStride,
  292. // PVOID pDestBits,
  293. // BMFORMAT bmOutput,
  294. // DWORD dwOutputStride,
  295. // PBMCALLBACKFN pfnCallback,
  296. // ULONG ulCallbackData
  297. // );
  298. //
  299. typedef BOOL (FAR WINAPI * FPTRANSLATEBITMAPBITS)(HTRANSFORM, PVOID, BMFORMAT, DWORD, DWORD, DWORD, PVOID, BMFORMAT, DWORD, PBMCALLBACKFN, ULONG);
  300. //
  301. // BOOL
  302. // TranslateColors(
  303. // HTRANSFORM hxform,
  304. // PCOLOR paInputColors,
  305. // DWORD nColors,
  306. // COLORTYPE ctInput,
  307. // PCOLOR paOutputColors,
  308. // COLORTYPE ctOutput
  309. // );
  310. //
  311. typedef BOOL (FAR WINAPI * FPTRANSLATECOLORS)(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PCOLOR, COLORTYPE);
  312. //
  313. // BOOL
  314. // CheckBitmapBits(
  315. // HTRANSFORM hxform,
  316. // PVOID pSrcBits,
  317. // BMFORMAT bmInput,
  318. // DWORD dwWidth,
  319. // DWORD dwHeight,
  320. // DWORD dwStride,
  321. // PBYTE paResult,
  322. // PBMCALLBACKFN pfnCallback,
  323. // ULONG ulCallbackData
  324. // );
  325. //
  326. typedef BOOL (FAR WINAPI * FPCHECKBITMAPBITS)(HTRANSFORM , PVOID, BMFORMAT, DWORD, DWORD, DWORD, PBYTE, PBMCALLBACKFN, ULONG);
  327. //
  328. // BOOL
  329. // TranslateColors(
  330. // HTRANSFORM hxform,
  331. // PCOLOR paInputColors,
  332. // DWORD nColors,
  333. // COLORTYPE ctInput,
  334. // PCOLOR paOutputColors,
  335. // COLORTYPE ctOutput
  336. // );
  337. //
  338. typedef BOOL (FAR WINAPI * FPTRANSLATECOLORS)(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PCOLOR, COLORTYPE);
  339. //
  340. // BOOL
  341. // CheckColors(
  342. // HTRANSFORM hxform,
  343. // PCOLOR paInputColors,
  344. // DWORD nColors,
  345. // COLORTYPE ctInput,
  346. // PBYTE paResult
  347. // );
  348. //
  349. typedef BOOL (FAR WINAPI * FPCHECKCOLORS)(HTRANSFORM, PCOLOR, DWORD, COLORTYPE, PBYTE);
  350. //
  351. // DWORD
  352. // GetCMMInfo(
  353. // HTRANSFORM hxform,
  354. // DWORD dwInfo
  355. // );
  356. //
  357. typedef DWORD (FAR WINAPI * FPGETCMMINFO)(HTRANSFORM, DWORD);
  358. //
  359. // BOOL
  360. // RegisterCMM(
  361. // PCTSTR pMachineName,
  362. // DWORD cmmID,
  363. // PCTSTR pCMMdll
  364. // );
  365. //
  366. typedef BOOL (FAR WINAPI * FPREGISTERCMMA)(PCSTR, DWORD, PCSTR);
  367. typedef BOOL (FAR WINAPI * FPREGISTERCMMW)(PCWSTR, DWORD, PCWSTR);
  368. //
  369. // BOOL
  370. // UnregisterCMM(
  371. // PCTSTR pMachineName,
  372. // DWORD cmmID
  373. // );
  374. //
  375. typedef BOOL (FAR WINAPI * FPUNREGISTERCMMA)(PCSTR, DWORD);
  376. typedef BOOL (FAR WINAPI * FPUNREGISTERCMMW)(PCWSTR, DWORD);
  377. //
  378. // BOOL
  379. // SelectCMM(
  380. // DWORD dwCMMType
  381. // );
  382. //
  383. typedef BOOL (FAR WINAPI * FPSELECTCMM)(DWORD);
  384. //
  385. // BOOL
  386. // InstallColorProfile(
  387. // PCTSTR pMachineName,
  388. // PCTSTR pProfileName
  389. // );
  390. //
  391. typedef BOOL (FAR WINAPI * FPINSTALLCOLORPROFILEA)(PCSTR, PCSTR);
  392. typedef BOOL (FAR WINAPI * FPINSTALLCOLORPROFILEW)(PCWSTR, PCWSTR);
  393. //
  394. // BOOL
  395. // UninstallColorProfile(
  396. // PCTSTR pMachineName,
  397. // PCTSTR pProfileName,
  398. // BOOL bDelete
  399. // );
  400. //
  401. typedef BOOL (FAR WINAPI * FPUNINSTALLCOLORPROFILEA)(PCSTR, PCSTR, BOOL);
  402. typedef BOOL (FAR WINAPI * FPUNINSTALLCOLORPROFILEW)(PCWSTR, PCWSTR, BOOL);
  403. //
  404. // BOOL
  405. // EnumColorProfiles(
  406. // PCTSTR pMachineName,
  407. // PENUMTYPE[A|W] pEnumRecord,
  408. // PBYTE pBuffer,
  409. // PDWORD pdwSize,
  410. // PDWORD pnProfiles
  411. // );
  412. //
  413. typedef BOOL (FAR WINAPI * FPENUMCOLORPROFILESA)(PCSTR, PENUMTYPEA, PBYTE, PDWORD, PDWORD);
  414. typedef BOOL (FAR WINAPI * FPENUMCOLORPROFILESW)(PCWSTR, PENUMTYPEW, PBYTE, PDWORD, PDWORD);
  415. //
  416. // BOOL
  417. // GetStandardColorSpaceProfile(
  418. // PCTSTR pMachineName,
  419. // DWORD dwSCS,
  420. // PSTR pBuffer,
  421. // PDWORD pdwSize
  422. // );
  423. //
  424. typedef BOOL (FAR WINAPI * FPGETSTANDARDCOLORSPACEPROFILEA)(PCSTR, DWORD, PSTR, PDWORD);
  425. typedef BOOL (FAR WINAPI * FPGETSTANDARDCOLORSPACEPROFILEW)(PCWSTR, DWORD, PWSTR, PDWORD);
  426. //
  427. // BOOL
  428. // GetColorProfileHeader(
  429. // HPROFILE hProfile,
  430. // PPROFILEHEADER pProfileHeader
  431. // );
  432. //
  433. typedef BOOL (FAR WINAPI * FPGETCOLORPROFILEHEADER)(HPROFILE, PPROFILEHEADER);
  434. //
  435. // BOOL
  436. // GetColorDirectory(
  437. // PCTSTR pMachineName,
  438. // PTSTR pBuffer,
  439. // PDWORD pdwSize
  440. // );
  441. typedef BOOL (FAR WINAPI * FPGETCOLORDIRECTORYA)(PCSTR, PSTR, PDWORD);
  442. typedef BOOL (FAR WINAPI * FPGETCOLORDIRECTORYW)(PCWSTR, PWSTR, PDWORD);
  443. //
  444. // BOOL WINAPI CreateProfileFromLogColorSpaceA(
  445. // LPLOGCOLORSPACEA pLogColorSpace,
  446. // PBYTE *pBuffer
  447. // );
  448. //
  449. typedef BOOL (FAR WINAPI * FPCREATEPROFILEFROMLOGCOLORSPACEA)(LPLOGCOLORSPACEA,PBYTE *);
  450. typedef BOOL (FAR WINAPI * FPCREATEPROFILEFROMLOGCOLORSPACEW)(LPLOGCOLORSPACEW,PBYTE *);
  451. //
  452. // BOOL InternalGetDeviceConfig(
  453. // LPCTSTR pDeviceName,
  454. // DWORD dwDeviceClass
  455. // DWORD dwConfigType,
  456. // PVOID pConfig,
  457. // PDWORD pdwSize
  458. // );
  459. //
  460. typedef BOOL (FAR * FPINTERNALGETDEVICECONFIG)(LPCWSTR,DWORD,DWORD,PVOID,PDWORD);
  461. extern HINSTANCE ghICM;
  462. extern BOOL gbICMEnabledOnceBefore;
  463. extern RTL_CRITICAL_SECTION semListIcmInfo;
  464. extern RTL_CRITICAL_SECTION semColorTransformCache;
  465. extern RTL_CRITICAL_SECTION semColorSpaceCache;
  466. extern LIST_ENTRY ListIcmInfo;
  467. extern LIST_ENTRY ListCachedColorSpace;
  468. extern LIST_ENTRY ListCachedColorTransform;
  469. //
  470. // ANSI version function in MSCMS.DLL will not called.
  471. //
  472. // extern FPOPENCOLORPROFILEA fpOpenColorProfileA;
  473. // extern FPCREATECOLORTRANSFORMA fpCreateColorTransformA;
  474. // extern FPREGISTERCMMA fpRegisterCMMA;
  475. // extern FPUNREGISTERCMMA fpUnregisterCMMA;
  476. // extern FPINSTALLCOLORPROFILEA fpInstallColorProfileA;
  477. // extern FPUNINSTALLCOLORPROFILEA fpUninstallColorProfileA;
  478. // extern FPGETSTANDARDCOLORSPACEPROFILEA fpGetStandardColorSpaceProfileA;
  479. // extern FPENUMCOLORPROFILESA fpEnumColorProfilesA;
  480. // extern FPGETCOLORDIRECTORYA fpGetColorDirectoryA;
  481. //
  482. // And Following function does not used from gdi32.dll
  483. //
  484. // extern FPISCOLORPROFILEVALID fpIsColorProfileValid;
  485. // extern FPCREATEDEVICELINKPROFILE fpCreateDeviceLinkProfile;
  486. // extern FPTRANSLATECOLORS fpTranslateColors;
  487. // extern FPCHECKCOLORS fpCheckColors;
  488. // extern FPGETCMMINFO fpGetCMMInfo;
  489. // extern FPSELECTCMM fpSelectCMM;
  490. //
  491. extern FPOPENCOLORPROFILEW fpOpenColorProfileW;
  492. extern FPCLOSECOLORPROFILE fpCloseColorProfile;
  493. extern FPCREATECOLORTRANSFORMW fpCreateColorTransformW;
  494. extern FPDELETECOLORTRANSFORM fpDeleteColorTransform;
  495. extern FPTRANSLATECOLORS fpTranslateColors;
  496. extern FPTRANSLATEBITMAPBITS fpTranslateBitmapBits;
  497. extern FPCHECKBITMAPBITS fpCheckBitmapBits;
  498. extern FPREGISTERCMMW fpRegisterCMMW;
  499. extern FPUNREGISTERCMMW fpUnregisterCMMW;
  500. extern FPINSTALLCOLORPROFILEW fpInstallColorProfileW;
  501. extern FPUNINSTALLCOLORPROFILEW fpUninstallColorProfileW;
  502. extern FPENUMCOLORPROFILESW fpEnumColorProfilesW;
  503. extern FPGETSTANDARDCOLORSPACEPROFILEW fpGetStandardColorSpaceProfileW;
  504. extern FPGETCOLORPROFILEHEADER fpGetColorProfileHeader;
  505. extern FPGETCOLORDIRECTORYW fpGetColorDirectoryW;
  506. extern FPCREATEPROFILEFROMLOGCOLORSPACEW fpCreateProfileFromLogColorSpaceW;
  507. extern FPCREATEMULTIPROFILETRANSFORM fpCreateMultiProfileTransform;
  508. extern FPINTERNALGETDEVICECONFIG fpInternalGetDeviceConfig;
  509. //
  510. // Functions GDI internal use (defined in icm.c)
  511. //
  512. //
  513. // Color Translation Functions
  514. //
  515. BOOL
  516. IcmTranslateDIB(
  517. HDC hdc,
  518. PDC_ATTR pdcattr,
  519. ULONG nColors,
  520. PVOID pBitsIn,
  521. PVOID *ppBitsOut,
  522. PBITMAPINFO pbmi,
  523. PBITMAPINFO *pbmiNew,
  524. DWORD *pcjbmiNew,
  525. DWORD dwNumScan,
  526. UINT iUsage,
  527. DWORD dwFlags,
  528. PCACHED_COLORSPACE *ppBitmapColorSpace,
  529. PCACHED_COLORTRANSFORM *ppCXform
  530. );
  531. BOOL
  532. IcmTranslateCOLORREF(
  533. HDC hdc,
  534. PDC_ATTR pdcattr,
  535. COLORREF ColorIn,
  536. COLORREF *ColorOut,
  537. DWORD Flags
  538. );
  539. BOOL
  540. IcmTranslateBrushColor(
  541. HDC hdc,
  542. PDC_ATTR pdcattr,
  543. HBRUSH hbrush
  544. );
  545. BOOL
  546. IcmTranslatePenColor(
  547. HDC hdc,
  548. PDC_ATTR pdcattr,
  549. HPEN hpen
  550. );
  551. BOOL
  552. IcmTranslateExtPenColor(
  553. HDC hdc,
  554. PDC_ATTR pdcattr,
  555. HPEN hpen
  556. );
  557. BOOL
  558. IcmTranslateColorObjects(
  559. HDC hdc,
  560. PDC_ATTR pdcattr,
  561. BOOL bICMEnable
  562. );
  563. BOOL
  564. IcmTranslateTRIVERTEX(
  565. HDC hdc,
  566. PDC_ATTR pdcattr,
  567. PTRIVERTEX pVertex,
  568. ULONG nVertex
  569. );
  570. BOOL
  571. IcmTranslatePaletteEntry(
  572. HDC hdc,
  573. PDC_ATTR pdcattr,
  574. PALETTEENTRY *pColorIn,
  575. PALETTEENTRY *pColorOut,
  576. UINT NumberOfEntries
  577. );
  578. //
  579. // DC related functions
  580. //
  581. PGDI_ICMINFO
  582. IcmInitIcmInfo(
  583. HDC hdc,
  584. PDC_ATTR pdcattr
  585. );
  586. BOOL
  587. IcmCleanupIcmInfo(
  588. PDC_ATTR pdcattr,
  589. PGDI_ICMINFO pIcmInfo
  590. );
  591. PGDI_ICMINFO
  592. IcmGetUnusedIcmInfo(
  593. HDC hdc
  594. );
  595. BOOL
  596. IcmInitLocalDC(
  597. HDC hdc,
  598. HANDLE hPrinter,
  599. CONST DEVMODEW *pdm,
  600. BOOL bReset
  601. );
  602. BOOL
  603. IcmDeleteLocalDC(
  604. HDC hdc,
  605. PDC_ATTR pdcattr,
  606. PGDI_ICMINFO pIcmInfo
  607. );
  608. BOOL
  609. IcmUpdateLocalDCColorSpace(
  610. HDC hdc,
  611. PDC_ATTR pdcattr
  612. );
  613. VOID
  614. IcmReleaseDCColorSpace(
  615. PGDI_ICMINFO pIcmInfo,
  616. BOOL bReleaseDC
  617. );
  618. BOOL
  619. IcmUpdateDCColorInfo(
  620. HDC hdc,
  621. PDC_ATTR pdcattr
  622. );
  623. BOOL
  624. IcmEnableForCompatibleDC(
  625. HDC hdcCompatible,
  626. HDC hdcDevice,
  627. PDC_ATTR pdcaDevice
  628. );
  629. BOOL
  630. IcmSaveDC(
  631. HDC hdc,
  632. PDC_ATTR pdcattr,
  633. PGDI_ICMINFO pIcmInfo
  634. );
  635. VOID
  636. IcmRestoreDC(
  637. PDC_ATTR pdcattr,
  638. int iLevel,
  639. PGDI_ICMINFO pIcmInfo
  640. );
  641. //
  642. // SelectObject functions
  643. //
  644. BOOL
  645. IcmSelectColorTransform (
  646. HDC hdc,
  647. PDC_ATTR pdcattr,
  648. PCACHED_COLORTRANSFORM pCXform,
  649. BOOL bDeviceCalibrate
  650. );
  651. HBRUSH
  652. IcmSelectBrush (
  653. HDC hdc,
  654. PDC_ATTR pdcattr,
  655. HBRUSH hbrushNew
  656. );
  657. HPEN
  658. IcmSelectPen(
  659. HDC hdc,
  660. PDC_ATTR pdcattr,
  661. HPEN hpenNew
  662. );
  663. HPEN
  664. IcmSelectExtPen(
  665. HDC hdc,
  666. PDC_ATTR pdcattr,
  667. HPEN hpenNew
  668. );
  669. //
  670. // Profile Enumuration related
  671. //
  672. int
  673. IcmEnumColorProfile(
  674. HDC hdc,
  675. PVOID pvCallBack,
  676. LPARAM lParam,
  677. BOOL bAnsiCallBack,
  678. PDEVMODEW pDevModeW,
  679. DWORD *pdwColorSpaceFlag
  680. );
  681. int CALLBACK
  682. IcmQueryProfileCallBack(
  683. LPWSTR lpFileName,
  684. LPARAM lAppData
  685. );
  686. int CALLBACK
  687. IcmFindProfileCallBack(
  688. LPWSTR lpFileName,
  689. LPARAM lAppData
  690. );
  691. BOOL
  692. IcmCreateTemporaryColorProfile(
  693. LPWSTR TemporaryColorProfile,
  694. LPBYTE ProfileData,
  695. DWORD ProfileDataSize
  696. );
  697. //
  698. // Filename/Path related.
  699. //
  700. PWSTR
  701. GetFileNameFromPath(
  702. PWSTR pwszFileName
  703. );
  704. PWSZ
  705. BuildIcmProfilePath(
  706. PWSZ FileName,
  707. PWSZ FullPathFileName,
  708. ULONG BufferSize
  709. );
  710. //
  711. // Color Transform management
  712. //
  713. PCACHED_COLORTRANSFORM
  714. IcmGetFirstNonUsedColorTransform(
  715. VOID
  716. );
  717. PCACHED_COLORTRANSFORM
  718. IcmGetColorTransform(
  719. HDC hdc,
  720. PCACHED_COLORSPACE pSourceColorSpace,
  721. PCACHED_COLORSPACE pDestColorSpace,
  722. PCACHED_COLORSPACE pTargetColorSpace,
  723. BOOL bNeedDeviceXform
  724. );
  725. PCACHED_COLORTRANSFORM
  726. IcmCreateColorTransform(
  727. HDC hdc,
  728. PDC_ATTR pdcattr,
  729. PCACHED_COLORSPACE lpOptionalColorSpace,
  730. DWORD dwFlags
  731. );
  732. BOOL
  733. IcmDeleteColorTransform(
  734. HANDLE hcmXformToBeDeleted,
  735. BOOL bForceDelete
  736. );
  737. BOOL
  738. IcmDeleteDCColorTransforms(
  739. PGDI_ICMINFO pIcmInfo
  740. );
  741. BOOL
  742. IcmDeleteCachedColorTransforms(
  743. HDC hdc
  744. );
  745. BOOL
  746. IcmIsCacheable(
  747. PCACHED_COLORSPACE pColorSpace
  748. );
  749. //
  750. // Color Space/Profile management
  751. //
  752. HCOLORSPACE WINAPI
  753. CreateColorSpaceInternalW(
  754. LPLOGCOLORSPACEW lpLogColorSpace,
  755. DWORD dwCreateFlags
  756. );
  757. BOOL
  758. SetICMProfileInternalA(
  759. HDC hdc,
  760. LPSTR pszFileName,
  761. PCACHED_COLORSPACE pColorSpace,
  762. DWORD dwFlags
  763. );
  764. BOOL
  765. SetICMProfileInternalW(
  766. HDC hdc,
  767. LPWSTR pwszFileName,
  768. PCACHED_COLORSPACE pColorSpace,
  769. DWORD dwFlags
  770. );
  771. BOOL WINAPI
  772. ColorMatchToTargetInternal(
  773. HDC hdc,
  774. PCACHED_COLORSPACE pTargetColorSpace,
  775. DWORD uiAction
  776. );
  777. HCOLORSPACE
  778. IcmSetSourceColorSpace(
  779. HDC hdc,
  780. HCOLORSPACE hColorSpace,
  781. PCACHED_COLORSPACE pColorSpace,
  782. DWORD dwFlags
  783. );
  784. BOOL
  785. IcmSetDestinationColorSpace(
  786. HDC hdc,
  787. LPWSTR pwszFileName,
  788. PCACHED_COLORSPACE pColorSpace,
  789. DWORD dwFlags
  790. );
  791. BOOL
  792. IcmSetTargetColorSpace(
  793. HDC hdc,
  794. PCACHED_COLORSPACE pColorSpace,
  795. DWORD uiAction
  796. );
  797. BMFORMAT
  798. IcmGetProfileColorFormat(
  799. HPROFILE hProfile
  800. );
  801. BOOL
  802. IcmCreateProfileFromLCS(
  803. LPLOGCOLORSPACEW lpLogColorSpaceW,
  804. PVOID *ppvProfileData,
  805. PULONG pulProfileSize
  806. );
  807. PCACHED_COLORSPACE
  808. IcmCreateColorSpaceByColorSpace(
  809. HGDIOBJ hObj,
  810. LPLOGCOLORSPACEW lpLogColorSpace,
  811. PPROFILE pProfileData,
  812. DWORD dwFlags
  813. );
  814. PCACHED_COLORSPACE
  815. IcmCreateColorSpaceByName(
  816. HGDIOBJ hObj,
  817. PWSZ ColorProfileName,
  818. DWORD dwIntent,
  819. DWORD dwFlags
  820. );
  821. PCACHED_COLORSPACE
  822. IcmGetColorSpaceByHandle(
  823. HGDIOBJ hObj,
  824. HCOLORSPACE hColorSpace,
  825. LPLOGCOLORSPACEW lpLogColorSpace,
  826. DWORD dwFlags
  827. );
  828. PCACHED_COLORSPACE
  829. IcmGetColorSpaceByColorSpace(
  830. HGDIOBJ hObj,
  831. LPLOGCOLORSPACEW lpLogColorSpace,
  832. PPROFILE pProfileData,
  833. DWORD dwFlags
  834. );
  835. PCACHED_COLORSPACE
  836. IcmGetColorSpaceByName(
  837. HGDIOBJ hObj,
  838. PWSZ ColorProfileName,
  839. DWORD dwIntent,
  840. DWORD dwFlags
  841. );
  842. BOOL
  843. IcmSameColorSpace(
  844. PCACHED_COLORSPACE pColorSpaceA,
  845. PCACHED_COLORSPACE pColorSapceB
  846. );
  847. VOID
  848. IcmReleaseColorSpace(
  849. HGDIOBJ hObj,
  850. PCACHED_COLORSPACE pColorSpace,
  851. BOOL bReleaseDC
  852. );
  853. BOOL
  854. IcmReleaseCachedColorSpace(
  855. HGDIOBJ hObj
  856. );
  857. int
  858. IcmAskDriverForColorProfile(
  859. PLDC pldc,
  860. ULONG ulQueryMode,
  861. PDEVMODEW pDevMode,
  862. PWSTR pProfileName,
  863. DWORD *pdwColorSpaceFlag
  864. );
  865. BOOL
  866. IcmRealizeColorProfile(
  867. PCACHED_COLORSPACE pColorSpace,
  868. BOOL bCheckColorFormat
  869. );
  870. VOID
  871. IcmUnrealizeColorProfile(
  872. PCACHED_COLORSPACE pColorSpace
  873. );
  874. //
  875. // Metafile related
  876. //
  877. VOID
  878. IcmInsertMetafileList(
  879. PLIST_ENTRY pAttachedColorProfile,
  880. PWSZ ProfileName
  881. );
  882. BOOL
  883. IcmCheckMetafileList(
  884. PLIST_ENTRY pAttachedColorProfile,
  885. PWSZ ProfileName
  886. );
  887. VOID
  888. IcmFreeMetafileList(
  889. PLIST_ENTRY pAttachedColorProfile
  890. );
  891. //
  892. // Bitmap color space
  893. //
  894. BOOL
  895. IcmGetBitmapColorSpace(
  896. LPBITMAPINFO pbmi,
  897. LPLOGCOLORSPACEW plcspw,
  898. PPROFILE pProfileData,
  899. PDWORD pdwFlags
  900. );
  901. PCACHED_COLORSPACE
  902. IcmGetColorSpaceforBitmap(
  903. HBITMAP hbm
  904. );
  905. //
  906. // Icm Blting
  907. //
  908. BOOL
  909. IcmStretchBlt(HDC hdc, int x, int y, int cx, int cy,
  910. HDC hdcSrc, int x1, int y1, int cx1, int cy1, DWORD rop,
  911. PDC_ATTR pdcattr, PDC_ATTR pdcattrSrc);