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.

331 lines
7.5 KiB

  1. /******************************Module*Header*******************************
  2. * Module Name: icmobj.hxx
  3. *
  4. * This file contains the class prototypes for Color Space and ICM
  5. * objects
  6. *
  7. * Created: 23-Mar-1994
  8. * Author: Mark Enstrom (marke)
  9. *
  10. * Copyright (c) 1994-1999 Microsoft Corporation
  11. *
  12. \**************************************************************************/
  13. #ifndef _ICMOBJ_HXX
  14. #define _ICMOBJ_HXX
  15. #if DBG
  16. #define DBG_ICM 1
  17. #else
  18. #define DBG_ICM 0
  19. #endif
  20. /******************************Public*Class*******************************\
  21. * class COLORSPACE
  22. *
  23. * COLORSPACE class
  24. *
  25. * Fields
  26. *
  27. * DWORD _lcsSignature;
  28. * DWORD _lcsVersion;
  29. * DWORD _lcsSize;
  30. * LCSCSTYPE _lcsCSType;
  31. * LCSGAMUTMATCH _lcsIntent;
  32. * CIEXYZTRIPLE _lcsEndpoints;
  33. * DWORD _lcsGammaRed;
  34. * DWORD _lcsGammaGreen;
  35. * DWORD _lcsGammaBlue;
  36. * WCHAR _lcsFilename[MAX_PATH];
  37. * DWORD _lcsExFlags;
  38. *
  39. * 23-Mar-1994
  40. *
  41. * Mark Enstrom (marke)
  42. *
  43. \**************************************************************************/
  44. class COLORSPACE : public OBJECT
  45. {
  46. private:
  47. DWORD _lcsSignature;
  48. DWORD _lcsVersion;
  49. DWORD _lcsSize;
  50. LCSCSTYPE _lcsCSType;
  51. LCSGAMUTMATCH _lcsIntent;
  52. CIEXYZTRIPLE _lcsEndpoints;
  53. DWORD _lcsGammaRed;
  54. DWORD _lcsGammaGreen;
  55. DWORD _lcsGammaBlue;
  56. WCHAR _lcsFilename[MAX_PATH];
  57. DWORD _lcsExFlags;
  58. public:
  59. VOID lcsSignature(DWORD lcsSig) {_lcsSignature = lcsSig;}
  60. DWORD lcsSignature() {return(_lcsSignature);}
  61. VOID lcsVersion(DWORD lcsVer) {_lcsVersion = lcsVer;}
  62. DWORD lcsVersion() {return(_lcsVersion);}
  63. VOID lcsSize(DWORD lcsSize) {_lcsSize = lcsSize;}
  64. DWORD lcsSize() {return(_lcsSize);}
  65. VOID lcsCSType(DWORD lcsCSType) {_lcsCSType = lcsCSType;}
  66. DWORD lcsCSType() {return(_lcsCSType);}
  67. VOID lcsIntent(DWORD lcsIntent) {_lcsIntent = lcsIntent;}
  68. DWORD lcsIntent() {return(_lcsIntent);}
  69. VOID lcsGammaRed(DWORD lcsRed) {_lcsGammaRed = lcsRed;}
  70. DWORD lcsGammaRed() {return(_lcsGammaRed);}
  71. VOID lcsGammaGreen(DWORD lcsGreen) {_lcsGammaGreen = lcsGreen;}
  72. DWORD lcsGammaGreen() {return(_lcsGammaGreen);}
  73. VOID lcsGammaBlue(DWORD lcsBlue) {_lcsGammaBlue = lcsBlue;}
  74. DWORD lcsGammaBlue() {return(_lcsGammaBlue);}
  75. VOID vSETlcsEndpoints(LPCIEXYZTRIPLE pcz) {_lcsEndpoints = *pcz;}
  76. VOID vGETlcsEndpoints(LPCIEXYZTRIPLE pcz) {*pcz = _lcsEndpoints;}
  77. VOID vSETlcsFilename(PWCHAR pwName,ULONG length)
  78. {
  79. memcpy(&_lcsFilename[0],pwName,length);
  80. }
  81. VOID vGETlcsFilename(PWCHAR pwName,ULONG length)
  82. {
  83. memcpy(pwName,&_lcsFilename[0],length);
  84. }
  85. VOID lcsExFlags(DWORD dwFlags)
  86. {
  87. _lcsExFlags = dwFlags;
  88. }
  89. DWORD lcsExFlags() {return(_lcsExFlags);}
  90. //
  91. // common features
  92. //
  93. HCOLORSPACE hColorSpace() { return((HCOLORSPACE) hGet()); }
  94. };
  95. typedef COLORSPACE *PCOLORSPACE;
  96. /******************************Public*Class*******************************\
  97. * class COLORSPACEREF
  98. *
  99. * COLORSPACE reference from pointer or handle
  100. *
  101. * 23-Mar-1994
  102. *
  103. * Mark Enstrom (marke)
  104. *
  105. \**************************************************************************/
  106. class COLORSPACEREF
  107. {
  108. private:
  109. PCOLORSPACE _pColorSpace;
  110. public:
  111. COLORSPACEREF()
  112. {
  113. _pColorSpace = (PCOLORSPACE)NULL;
  114. }
  115. COLORSPACEREF(HCOLORSPACE hColorSpace)
  116. {
  117. _pColorSpace = (PCOLORSPACE)HmgShareCheckLock((HOBJ)hColorSpace, ICMLCS_TYPE);
  118. }
  119. ~COLORSPACEREF()
  120. {
  121. if (_pColorSpace != (PCOLORSPACE)NULL)
  122. {
  123. DEC_SHARE_REF_CNT(_pColorSpace);
  124. }
  125. }
  126. BOOL bValid() {return(_pColorSpace != (PCOLORSPACE)NULL);}
  127. PCOLORSPACE pColorSpace() {return(_pColorSpace);}
  128. };
  129. /******************************Public*Class*******************************\
  130. * class COLORTRANSFORM
  131. *
  132. * COLORTRANSFORM class
  133. *
  134. \*************************************************************************/
  135. class COLORTRANSFORM : public OBJECT
  136. {
  137. public:
  138. //
  139. // Color transform handle of driver's realization.
  140. //
  141. HANDLE _hDeviceColorTransform;
  142. public:
  143. //
  144. // common features
  145. //
  146. HANDLE hColorTransform() { return((HANDLE) hGet()); }
  147. };
  148. typedef COLORTRANSFORM *PCOLORTRANSFORM;
  149. /******************************Public*Class*******************************\
  150. * class COLORTRANSFORMOBJ
  151. *
  152. * COLORTRANSFORM reference class
  153. *
  154. \*************************************************************************/
  155. class COLORTRANSFORMOBJ
  156. {
  157. private:
  158. PCOLORTRANSFORM _pColorTransform;
  159. public:
  160. COLORTRANSFORMOBJ()
  161. {
  162. _pColorTransform = (PCOLORTRANSFORM) NULL;
  163. }
  164. COLORTRANSFORMOBJ(HANDLE hColorTransform)
  165. {
  166. _pColorTransform = (PCOLORTRANSFORM) HmgShareCheckLock((HOBJ)hColorTransform, ICMCXF_TYPE);
  167. }
  168. ~COLORTRANSFORMOBJ()
  169. {
  170. if (_pColorTransform != (PCOLORTRANSFORM) NULL)
  171. {
  172. DEC_SHARE_REF_CNT(_pColorTransform);
  173. }
  174. }
  175. //
  176. // Validation check
  177. //
  178. BOOL bValid()
  179. {
  180. return(_pColorTransform != (PCOLORTRANSFORM)NULL);
  181. }
  182. HANDLE hGetDeviceColorTransform()
  183. {
  184. return(_pColorTransform->_hDeviceColorTransform);
  185. }
  186. VOID vSetDeviceColorTransform(HANDLE h)
  187. {
  188. _pColorTransform->_hDeviceColorTransform = h;
  189. }
  190. HANDLE hCreate(XDCOBJ& dco, LOGCOLORSPACEW *pLogColorSpaceW,
  191. PVOID pvSource, ULONG cjSource,
  192. PVOID pvDestination, ULONG cjDestination,
  193. PVOID pvTarget, ULONG cjTarget);
  194. BOOL bDelete(XDCOBJ& dco,
  195. BOOL bProcessCleanup = FALSE);
  196. };
  197. //
  198. // Functions in icmapi.cxx
  199. //
  200. extern "C" {
  201. BOOL
  202. APIENTRY
  203. GreSetColorSpace(
  204. HDC hdc,
  205. HCOLORSPACE hColorSpace
  206. );
  207. BOOL
  208. WINAPI
  209. GreGetDeviceGammaRamp(
  210. HDC,
  211. LPVOID
  212. );
  213. BOOL
  214. WINAPI
  215. GreGetDeviceGammaRampInternal(
  216. HDEV,
  217. LPVOID
  218. );
  219. BOOL
  220. WINAPI
  221. GreSetDeviceGammaRamp(
  222. HDC,
  223. LPVOID,
  224. BOOL
  225. );
  226. BOOL
  227. WINAPI
  228. GreSetDeviceGammaRampInternal(
  229. HDEV,
  230. LPVOID,
  231. BOOL
  232. );
  233. }
  234. BOOL bDeleteColorSpace(HCOLORSPACE);
  235. INT cjGetLogicalColorSpace(HANDLE,INT,LPVOID);
  236. BOOL UpdateGammaRampOnDevice(HDEV,BOOL);
  237. ULONG GetColorManagementCaps(PDEVOBJ&);
  238. typedef struct _GAMMARAMP_ARRAY {
  239. WORD Red[256];
  240. WORD Green[256];
  241. WORD Blue[256];
  242. } GAMMARAMP_ARRAY, *PGAMMARAMP_ARRAY;
  243. #if DBG_ICM
  244. extern ULONG IcmDebugLevel;
  245. #define ICMDUMP(s) \
  246. if (IcmDebugLevel & 0x4) \
  247. { \
  248. DbgPrint ## s; \
  249. }
  250. #define ICMMSG(s) \
  251. if (IcmDebugLevel & 0x2) \
  252. { \
  253. DbgPrint ## s; \
  254. }
  255. #define ICMAPI(s) \
  256. if (IcmDebugLevel & 0x1) \
  257. { \
  258. DbgPrint ## s; \
  259. }
  260. #else
  261. #define ICMDUMP(s)
  262. #define ICMMSG(s)
  263. #define ICMAPI(s)
  264. #endif // DBG
  265. #endif