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.

4233 lines
111 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. winddi.h
  5. Abstract:
  6. Private entry points, defines and types for Windows NT GDI device
  7. driver interface.
  8. --*/
  9. #ifndef _WINDDI_
  10. #define _WINDDI_
  11. //
  12. // GUID definitions for use with kernel-mode GDI drivers
  13. //
  14. #ifndef _NO_DDRAWINT_NO_COM
  15. #ifndef EXTERN_C
  16. #ifdef __cplusplus
  17. #define EXTERN_C extern "C"
  18. #else // !defined(__cplusplus)
  19. #define EXTERN_C extern
  20. #endif // !defined(__cplusplus)
  21. #endif // !defined(EXTERN_C)
  22. #ifndef DEFINE_GUID
  23. #ifndef INITGUID
  24. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  25. EXTERN_C const GUID FAR name
  26. #else // !defined(INITGUID)
  27. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  28. EXTERN_C const GUID name \
  29. = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
  30. #endif // !defined(INITGUID)
  31. #endif // !defined(DEFINE_GUID)
  32. #ifndef DEFINE_GUIDEX
  33. #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
  34. #endif // !defined(DEFINE_GUIDEX)
  35. #ifndef STATICGUIDOF
  36. #define STATICGUIDOF(guid) STATIC_##guid
  37. #endif // !defined(STATICGUIDOF)
  38. #ifndef GUID_DEFINED
  39. #define GUID_DEFINED
  40. typedef struct _GUID {
  41. ULONG Data1;
  42. USHORT Data2;
  43. USHORT Data3;
  44. UCHAR Data4[8];
  45. } GUID;
  46. #endif // !defined(GUID_DEFINED)
  47. #ifndef IsEqualGUID
  48. #define IsEqualGUID(guid1, guid2) \
  49. (!memcmp((guid1), (guid2), sizeof(GUID)))
  50. #endif // !defined(IsEqualGUID)
  51. #ifndef IsEqualIID
  52. #define IsEqualIID IsEqualGUID
  53. #endif // !defined(IsEqualIID)
  54. #endif // !defined(_NO_DDRAWINT_NO_COM)
  55. //
  56. // Standard DirectX HAL includes
  57. //
  58. #include <ddrawint.h>
  59. #include <d3dnthal.h>
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63. //
  64. // drivers and other components that include this should NOT include
  65. // windows.h They should be system conponents that only use GDI internals
  66. // and therefore only include wingdi.h
  67. //
  68. #if defined(_X86_) && !defined(USERMODE_DRIVER) && !defined(BUILD_WOW6432)
  69. //
  70. // x86 does not support floating-point instruction in the kernel mode,
  71. // the floating-point data would like be handled 32bits value as double words.
  72. //
  73. typedef DWORD FLOATL;
  74. #else
  75. //
  76. // Any platform that has support for floats in the kernel
  77. //
  78. typedef FLOAT FLOATL;
  79. #endif // _X86_
  80. typedef LONG PTRDIFF;
  81. typedef PTRDIFF *PPTRDIFF;
  82. typedef LONG FIX;
  83. typedef FIX *PFIX;
  84. typedef ULONG ROP4;
  85. typedef ULONG MIX;
  86. typedef ULONG HGLYPH;
  87. typedef HGLYPH *PHGLYPH;
  88. #define HGLYPH_INVALID ((HGLYPH)-1)
  89. typedef ULONG IDENT;
  90. //
  91. // handles for font file and font context objects
  92. //
  93. typedef ULONG_PTR HFF;
  94. typedef ULONG_PTR HFC;
  95. #define HFF_INVALID ((HFF) 0)
  96. #define HFC_INVALID ((HFC) 0)
  97. #define FD_ERROR 0xFFFFFFFF
  98. #define DDI_ERROR 0xFFFFFFFF
  99. typedef struct _POINTE /* pte */
  100. {
  101. FLOATL x;
  102. FLOATL y;
  103. } POINTE, *PPOINTE;
  104. typedef union _FLOAT_LONG
  105. {
  106. FLOATL e;
  107. LONG l;
  108. } FLOAT_LONG, *PFLOAT_LONG;
  109. typedef struct _POINTFIX
  110. {
  111. FIX x;
  112. FIX y;
  113. } POINTFIX, *PPOINTFIX;
  114. typedef struct _RECTFX
  115. {
  116. FIX xLeft;
  117. FIX yTop;
  118. FIX xRight;
  119. FIX yBottom;
  120. } RECTFX, *PRECTFX;
  121. DECLARE_HANDLE(HBM);
  122. DECLARE_HANDLE(HDEV);
  123. DECLARE_HANDLE(HSURF);
  124. DECLARE_HANDLE(DHSURF);
  125. DECLARE_HANDLE(DHPDEV);
  126. DECLARE_HANDLE(HDRVOBJ);
  127. #define LTOFX(x) ((x)<<4)
  128. #define FXTOL(x) ((x)>>4)
  129. #define FXTOLFLOOR(x) ((x)>>4)
  130. #define FXTOLCEILING(x) ((x + 0x0F)>>4)
  131. #define FXTOLROUND(x) ((((x) >> 3) + 1) >> 1)
  132. // context information
  133. typedef struct _FD_XFORM {
  134. FLOATL eXX;
  135. FLOATL eXY;
  136. FLOATL eYX;
  137. FLOATL eYY;
  138. } FD_XFORM, *PFD_XFORM;
  139. typedef struct _FD_DEVICEMETRICS { // devm
  140. FLONG flRealizedType;
  141. POINTE pteBase;
  142. POINTE pteSide;
  143. LONG lD;
  144. FIX fxMaxAscender;
  145. FIX fxMaxDescender;
  146. POINTL ptlUnderline1;
  147. POINTL ptlStrikeOut;
  148. POINTL ptlULThickness;
  149. POINTL ptlSOThickness;
  150. ULONG cxMax; // max pel width of bitmaps
  151. // the fields formerly in REALIZE_EXTRA as well as some new fields:
  152. ULONG cyMax; // did not use to be here
  153. ULONG cjGlyphMax; // (cxMax + 7)/8 * cyMax, or at least it should be
  154. FD_XFORM fdxQuantized;
  155. LONG lNonLinearExtLeading;
  156. LONG lNonLinearIntLeading;
  157. LONG lNonLinearMaxCharWidth;
  158. LONG lNonLinearAvgCharWidth;
  159. // some new fields
  160. LONG lMinA;
  161. LONG lMinC;
  162. LONG lMinD;
  163. LONG alReserved[1]; // just in case we need it.
  164. } FD_DEVICEMETRICS, *PFD_DEVICEMETRICS;
  165. typedef struct _LIGATURE { /* lig */
  166. ULONG culSize;
  167. LPWSTR pwsz;
  168. ULONG chglyph;
  169. HGLYPH ahglyph[1];
  170. } LIGATURE, *PLIGATURE;
  171. typedef struct _FD_LIGATURE {
  172. ULONG culThis;
  173. ULONG ulType;
  174. ULONG cLigatures;
  175. LIGATURE alig[1];
  176. } FD_LIGATURE;
  177. // glyph handle must be 32 bit
  178. // signed 16 bit integer type denoting number of FUnit's
  179. typedef SHORT FWORD;
  180. // point in the 32.32 bit precission
  181. typedef struct _POINTQF // ptq
  182. {
  183. LARGE_INTEGER x;
  184. LARGE_INTEGER y;
  185. } POINTQF, *PPOINTQF;
  186. //. Structures
  187. // devm.flRealizedType flags
  188. // FDM_TYPE_ZERO_BEARINGS // all glyphs have zero a and c spaces
  189. // the following two features refer to all glyphs in this font realization
  190. // FDM_TYPE_CHAR_INC_EQUAL_BM_BASE // base width == cx for horiz, == cy for vert.
  191. // FDM_TYPE_MAXEXT_EQUAL_BM_SIDE // side width == cy for horiz, == cx for vert.
  192. #define FDM_TYPE_BM_SIDE_CONST 0x00000001
  193. #define FDM_TYPE_MAXEXT_EQUAL_BM_SIDE 0x00000002
  194. #define FDM_TYPE_CHAR_INC_EQUAL_BM_BASE 0x00000004
  195. #define FDM_TYPE_ZERO_BEARINGS 0x00000008
  196. #define FDM_TYPE_CONST_BEARINGS 0x00000010
  197. // structures for describing a supported set of glyphs in a font
  198. typedef struct _WCRUN {
  199. WCHAR wcLow; // lowest character in run inclusive
  200. USHORT cGlyphs; // wcHighInclusive = wcLow + cGlyphs - 1;
  201. HGLYPH *phg; // pointer to an array of cGlyphs HGLYPH's
  202. } WCRUN, *PWCRUN;
  203. // If phg is set to (HGLYPH *)NULL, for all wc's in this particular run
  204. // the handle can be computed as simple zero extension:
  205. // HGLYPH hg = (HGLYPH) wc;
  206. //
  207. // If phg is not NULL, memory pointed to by phg, allocated by the driver,
  208. // WILL NOT MOVE.
  209. typedef struct _FD_GLYPHSET {
  210. ULONG cjThis; // size of this structure in butes
  211. FLONG flAccel; // accel flags, bits to be explained below
  212. ULONG cGlyphsSupported; // sum over all wcrun's of wcrun.cGlyphs
  213. ULONG cRuns;
  214. WCRUN awcrun[1]; // an array of cRun WCRUN structures
  215. } FD_GLYPHSET, *PFD_GLYPHSET;
  216. typedef struct _FD_GLYPHATTR {
  217. ULONG cjThis; // size of this structure in butes
  218. ULONG cGlyphs;
  219. ULONG iMode;
  220. BYTE aGlyphAttr[1]; // an array of byte
  221. } FD_GLYPHATTR, *PFD_GLYPHATTR;
  222. // If GS_UNICODE_HANDLES bit is set,
  223. // for ALL WCRUNS in this FD_GLYPHSET the handles are
  224. // obtained by zero extending unicode code points of
  225. // the corresponding supported glyphs, i.e. all gs.phg's are NULL
  226. #define GS_UNICODE_HANDLES 0x00000001
  227. // If GS_8BIT_HANDLES bit is set, all handles are in 0-255 range.
  228. // This is just an ansi font then and we are really making up all
  229. // the unicode stuff about this font.
  230. #define GS_8BIT_HANDLES 0x00000002
  231. // all handles fit in 16 bits.
  232. // to 8 bit handles as it should.
  233. #define GS_16BIT_HANDLES 0x00000004
  234. // ligatures
  235. typedef struct _FD_KERNINGPAIR {
  236. WCHAR wcFirst;
  237. WCHAR wcSecond;
  238. FWORD fwdKern;
  239. } FD_KERNINGPAIR;
  240. // IFIMETRICS constants
  241. #define FM_VERSION_NUMBER 0x0
  242. //
  243. // IFIMETRICS::fsType flags
  244. //
  245. #define FM_TYPE_LICENSED 0x2
  246. #define FM_READONLY_EMBED 0x4
  247. #define FM_EDITABLE_EMBED 0x8
  248. #define FM_NO_EMBEDDING FM_TYPE_LICENSED
  249. //
  250. // IFIMETRICS::flInfo flags
  251. //
  252. #define FM_INFO_TECH_TRUETYPE 0x00000001
  253. #define FM_INFO_TECH_BITMAP 0x00000002
  254. #define FM_INFO_TECH_STROKE 0x00000004
  255. #define FM_INFO_TECH_OUTLINE_NOT_TRUETYPE 0x00000008
  256. #define FM_INFO_ARB_XFORMS 0x00000010
  257. #define FM_INFO_1BPP 0x00000020
  258. #define FM_INFO_4BPP 0x00000040
  259. #define FM_INFO_8BPP 0x00000080
  260. #define FM_INFO_16BPP 0x00000100
  261. #define FM_INFO_24BPP 0x00000200
  262. #define FM_INFO_32BPP 0x00000400
  263. #define FM_INFO_INTEGER_WIDTH 0x00000800
  264. #define FM_INFO_CONSTANT_WIDTH 0x00001000
  265. #define FM_INFO_NOT_CONTIGUOUS 0x00002000
  266. #define FM_INFO_TECH_MM 0x00004000
  267. #define FM_INFO_RETURNS_OUTLINES 0x00008000
  268. #define FM_INFO_RETURNS_STROKES 0x00010000
  269. #define FM_INFO_RETURNS_BITMAPS 0x00020000
  270. #define FM_INFO_DSIG 0x00040000 // FM_INFO_UNICODE_COMPLIANT
  271. #define FM_INFO_RIGHT_HANDED 0x00080000
  272. #define FM_INFO_INTEGRAL_SCALING 0x00100000
  273. #define FM_INFO_90DEGREE_ROTATIONS 0x00200000
  274. #define FM_INFO_OPTICALLY_FIXED_PITCH 0x00400000
  275. #define FM_INFO_DO_NOT_ENUMERATE 0x00800000
  276. #define FM_INFO_ISOTROPIC_SCALING_ONLY 0x01000000
  277. #define FM_INFO_ANISOTROPIC_SCALING_ONLY 0x02000000
  278. #define FM_INFO_TECH_CFF 0x04000000
  279. #define FM_INFO_FAMILY_EQUIV 0x08000000
  280. #define FM_INFO_DBCS_FIXED_PITCH 0x10000000
  281. #define FM_INFO_NONNEGATIVE_AC 0x20000000
  282. #define FM_INFO_IGNORE_TC_RA_ABLE 0x40000000
  283. #define FM_INFO_TECH_TYPE1 0x80000000
  284. // max number of charsets supported in a tt font, 16 according to win95 guys
  285. #define MAXCHARSETS 16
  286. //
  287. // IFIMETRICS::ulPanoseCulture
  288. //
  289. #define FM_PANOSE_CULTURE_LATIN 0x0
  290. //
  291. // IFMETRICS::fsSelection flags
  292. //
  293. #define FM_SEL_ITALIC 0x0001
  294. #define FM_SEL_UNDERSCORE 0x0002
  295. #define FM_SEL_NEGATIVE 0x0004
  296. #define FM_SEL_OUTLINED 0x0008
  297. #define FM_SEL_STRIKEOUT 0x0010
  298. #define FM_SEL_BOLD 0x0020
  299. #define FM_SEL_REGULAR 0x0040
  300. //
  301. // The FONTDIFF structure contains all of the fields that could
  302. // possibly change under simulation
  303. //
  304. typedef struct _FONTDIFF {
  305. BYTE jReserved1; // 0x0
  306. BYTE jReserved2; // 0x1
  307. BYTE jReserved3; // 0x2
  308. BYTE bWeight; // 0x3 Panose Weight
  309. USHORT usWinWeight; // 0x4
  310. FSHORT fsSelection; // 0x6
  311. FWORD fwdAveCharWidth; // 0x8
  312. FWORD fwdMaxCharInc; // 0xA
  313. POINTL ptlCaret; // 0xC
  314. } FONTDIFF;
  315. typedef struct _FONTSIM {
  316. PTRDIFF dpBold; // offset from beginning of FONTSIM to FONTDIFF
  317. PTRDIFF dpItalic; // offset from beginning of FONTSIM to FONTDIFF
  318. PTRDIFF dpBoldItalic; // offset from beginning of FONTSIM to FONTDIFF
  319. } FONTSIM;
  320. typedef struct _IFIMETRICS {
  321. ULONG cjThis; // includes attached information
  322. ULONG cjIfiExtra; // sizeof IFIEXTRA if any, formerly ulVersion
  323. PTRDIFF dpwszFamilyName;
  324. PTRDIFF dpwszStyleName;
  325. PTRDIFF dpwszFaceName;
  326. PTRDIFF dpwszUniqueName;
  327. PTRDIFF dpFontSim;
  328. LONG lEmbedId;
  329. LONG lItalicAngle;
  330. LONG lCharBias;
  331. // dpCharSet field replaced alReserved[0].
  332. // If the 3.51 pcl minidrivers are still to work on NT 4.0 this field must not
  333. // move because they will have 0 at this position.
  334. PTRDIFF dpCharSets; // only used if > 1 charset supported
  335. BYTE jWinCharSet; // as in LOGFONT::lfCharSet
  336. BYTE jWinPitchAndFamily; // as in LOGFONT::lfPitchAndFamily
  337. USHORT usWinWeight; // as in LOGFONT::lfWeight
  338. ULONG flInfo; // see above
  339. USHORT fsSelection; // see above
  340. USHORT fsType; // see above
  341. FWORD fwdUnitsPerEm; // em height
  342. FWORD fwdLowestPPEm; // readable limit
  343. FWORD fwdWinAscender;
  344. FWORD fwdWinDescender;
  345. FWORD fwdMacAscender;
  346. FWORD fwdMacDescender;
  347. FWORD fwdMacLineGap;
  348. FWORD fwdTypoAscender;
  349. FWORD fwdTypoDescender;
  350. FWORD fwdTypoLineGap;
  351. FWORD fwdAveCharWidth;
  352. FWORD fwdMaxCharInc;
  353. FWORD fwdCapHeight;
  354. FWORD fwdXHeight;
  355. FWORD fwdSubscriptXSize;
  356. FWORD fwdSubscriptYSize;
  357. FWORD fwdSubscriptXOffset;
  358. FWORD fwdSubscriptYOffset;
  359. FWORD fwdSuperscriptXSize;
  360. FWORD fwdSuperscriptYSize;
  361. FWORD fwdSuperscriptXOffset;
  362. FWORD fwdSuperscriptYOffset;
  363. FWORD fwdUnderscoreSize;
  364. FWORD fwdUnderscorePosition;
  365. FWORD fwdStrikeoutSize;
  366. FWORD fwdStrikeoutPosition;
  367. BYTE chFirstChar; // for win 3.1 compatibility
  368. BYTE chLastChar; // for win 3.1 compatibility
  369. BYTE chDefaultChar; // for win 3.1 compatibility
  370. BYTE chBreakChar; // for win 3.1 compatibility
  371. WCHAR wcFirstChar; // lowest supported code in Unicode set
  372. WCHAR wcLastChar; // highest supported code in Unicode set
  373. WCHAR wcDefaultChar;
  374. WCHAR wcBreakChar;
  375. POINTL ptlBaseline; //
  376. POINTL ptlAspect; // designed aspect ratio (bitmaps)
  377. POINTL ptlCaret; // points along caret
  378. RECTL rclFontBox; // bounding box for all glyphs (font space)
  379. BYTE achVendId[4]; // as per TrueType
  380. ULONG cKerningPairs;
  381. ULONG ulPanoseCulture;
  382. PANOSE panose;
  383. #if defined(_WIN64)
  384. //
  385. // IFIMETRICS must begin on a 64-bit boundary
  386. //
  387. PVOID Align;
  388. #endif
  389. } IFIMETRICS, *PIFIMETRICS;
  390. // rather than adding the fields of IFIEXTRA to IFIMETRICS itself
  391. // we add them as a separate structure. This structure, if present at all,
  392. // lies below IFIMETRICS in memory.
  393. // If IFIEXTRA is present at all, ifi.cjIfiExtra (formerly ulVersion)
  394. // will contain size of IFIEXTRA including any reserved fields.
  395. // That way ulVersion = 0 (NT 3.51 or less) printer minidrivers
  396. // will work with NT 4.0.
  397. typedef struct _IFIEXTRA
  398. {
  399. ULONG ulIdentifier; // used for Type 1 fonts only
  400. PTRDIFF dpFontSig; // nontrivial for tt only, at least for now.
  401. ULONG cig; // maxp->numGlyphs, # of distinct glyph indicies
  402. PTRDIFF dpDesignVector; // offset to design vector for mm instances
  403. PTRDIFF dpAxesInfoW; // offset to full axes info for base mm font
  404. ULONG aulReserved[1]; // in case we need even more stuff in the future
  405. } IFIEXTRA, *PIFIEXTRA;
  406. #define SIZEOFDV(cAxes) (offsetof(DESIGNVECTOR,dvValues) + (cAxes)*sizeof(LONG))
  407. #define SIZEOFAXIW(cAxes) (offsetof(AXESLISTW,axlAxisInfo) + (cAxes)*sizeof(AXISINFOW))
  408. #define SIZEOFAXIA(cAxes) (offsetof(AXESLISTA,axlAxisInfo) + (cAxes)*sizeof(AXISINFOA))
  409. /**************************************************************************\
  410. *
  411. \**************************************************************************/
  412. /* OpenGL DDI ExtEscape escape numbers (4352 - 4607) */
  413. #define OPENGL_CMD 4352 /* for OpenGL ExtEscape */
  414. #define OPENGL_GETINFO 4353 /* for OpenGL ExtEscape */
  415. #define WNDOBJ_SETUP 4354 /* for live video ExtEscape */
  416. /**************************************************************************\
  417. * Display Driver version numbers
  418. *
  419. * Note: DDI_DRIVER_VERSION has been removed. Drivers must specify
  420. * what version of the DDI they support using one of the below
  421. * DDI_DRIVER_VERSION_Xxx macros.
  422. * DDI_DRIVER_VERSION_NT4 is equivalent to old DDI_DRIVER_VERSION.
  423. \**************************************************************************/
  424. #define DDI_DRIVER_VERSION_NT4 0x00020000
  425. #define DDI_DRIVER_VERSION_SP3 0x00020003
  426. #define DDI_DRIVER_VERSION_NT5 0x00030000
  427. #define DDI_DRIVER_VERSION_NT5_01 0x00030100
  428. #define DDI_DRIVER_VERSION_NT5_01_SP1 0x00030101
  429. #define GDI_DRIVER_VERSION 0x4000 /* for NT version 4.0.00 */
  430. typedef LONG_PTR (APIENTRY *PFN)();
  431. typedef struct _DRVFN /* drvfn */
  432. {
  433. ULONG iFunc;
  434. PFN pfn;
  435. } DRVFN, *PDRVFN;
  436. /* Required functions */
  437. #define INDEX_DrvEnablePDEV 0L
  438. #define INDEX_DrvCompletePDEV 1L
  439. #define INDEX_DrvDisablePDEV 2L
  440. #define INDEX_DrvEnableSurface 3L
  441. #define INDEX_DrvDisableSurface 4L
  442. /* Other functions */
  443. #define INDEX_DrvAssertMode 5L
  444. #define INDEX_DrvOffset 6L // Obsolete
  445. #define INDEX_DrvResetPDEV 7L
  446. #define INDEX_DrvDisableDriver 8L
  447. #define INDEX_DrvCreateDeviceBitmap 10L
  448. #define INDEX_DrvDeleteDeviceBitmap 11L
  449. #define INDEX_DrvRealizeBrush 12L
  450. #define INDEX_DrvDitherColor 13L
  451. #define INDEX_DrvStrokePath 14L
  452. #define INDEX_DrvFillPath 15L
  453. #define INDEX_DrvStrokeAndFillPath 16L
  454. #define INDEX_DrvPaint 17L
  455. #define INDEX_DrvBitBlt 18L
  456. #define INDEX_DrvCopyBits 19L
  457. #define INDEX_DrvStretchBlt 20L
  458. #define INDEX_DrvSetPalette 22L
  459. #define INDEX_DrvTextOut 23L
  460. #define INDEX_DrvEscape 24L
  461. #define INDEX_DrvDrawEscape 25L
  462. #define INDEX_DrvQueryFont 26L
  463. #define INDEX_DrvQueryFontTree 27L
  464. #define INDEX_DrvQueryFontData 28L
  465. #define INDEX_DrvSetPointerShape 29L
  466. #define INDEX_DrvMovePointer 30L
  467. #define INDEX_DrvLineTo 31L
  468. #define INDEX_DrvSendPage 32L
  469. #define INDEX_DrvStartPage 33L
  470. #define INDEX_DrvEndDoc 34L
  471. #define INDEX_DrvStartDoc 35L
  472. #define INDEX_DrvGetGlyphMode 37L
  473. #define INDEX_DrvSynchronize 38L
  474. #define INDEX_DrvSaveScreenBits 40L
  475. #define INDEX_DrvGetModes 41L
  476. #define INDEX_DrvFree 42L
  477. #define INDEX_DrvDestroyFont 43L
  478. #define INDEX_DrvQueryFontCaps 44L
  479. #define INDEX_DrvLoadFontFile 45L
  480. #define INDEX_DrvUnloadFontFile 46L
  481. #define INDEX_DrvFontManagement 47L
  482. #define INDEX_DrvQueryTrueTypeTable 48L
  483. #define INDEX_DrvQueryTrueTypeOutline 49L
  484. #define INDEX_DrvGetTrueTypeFile 50L
  485. #define INDEX_DrvQueryFontFile 51L
  486. #define INDEX_DrvMovePanning 52L
  487. #define INDEX_DrvQueryAdvanceWidths 53L
  488. #define INDEX_DrvSetPixelFormat 54L
  489. #define INDEX_DrvDescribePixelFormat 55L
  490. #define INDEX_DrvSwapBuffers 56L
  491. #define INDEX_DrvStartBanding 57L
  492. #define INDEX_DrvNextBand 58L
  493. #define INDEX_DrvGetDirectDrawInfo 59L
  494. #define INDEX_DrvEnableDirectDraw 60L
  495. #define INDEX_DrvDisableDirectDraw 61L
  496. #define INDEX_DrvQuerySpoolType 62L
  497. #define INDEX_DrvIcmCreateColorTransform 64L
  498. #define INDEX_DrvIcmDeleteColorTransform 65L
  499. #define INDEX_DrvIcmCheckBitmapBits 66L
  500. #define INDEX_DrvIcmSetDeviceGammaRamp 67L
  501. #define INDEX_DrvGradientFill 68L
  502. #define INDEX_DrvStretchBltROP 69L
  503. #define INDEX_DrvPlgBlt 70L
  504. #define INDEX_DrvAlphaBlend 71L
  505. #define INDEX_DrvSynthesizeFont 72L
  506. #define INDEX_DrvGetSynthesizedFontFiles 73L
  507. #define INDEX_DrvTransparentBlt 74L
  508. #define INDEX_DrvQueryPerBandInfo 75L
  509. #define INDEX_DrvQueryDeviceSupport 76L
  510. #define INDEX_DrvReserved1 77L
  511. #define INDEX_DrvReserved2 78L
  512. #define INDEX_DrvReserved3 79L
  513. #define INDEX_DrvReserved4 80L
  514. #define INDEX_DrvReserved5 81L
  515. #define INDEX_DrvReserved6 82L
  516. #define INDEX_DrvReserved7 83L
  517. #define INDEX_DrvReserved8 84L
  518. #define INDEX_DrvDeriveSurface 85L
  519. #define INDEX_DrvQueryGlyphAttrs 86L
  520. #define INDEX_DrvNotify 87L
  521. #define INDEX_DrvSynchronizeSurface 88L
  522. #define INDEX_DrvResetDevice 89L
  523. #define INDEX_DrvReserved9 90L
  524. #define INDEX_DrvReserved10 91L
  525. #define INDEX_DrvReserved11 92L
  526. /* The total number of dispatched functions */
  527. #define INDEX_LAST 93L
  528. typedef struct tagDRVENABLEDATA
  529. {
  530. ULONG iDriverVersion;
  531. ULONG c;
  532. DRVFN *pdrvfn;
  533. } DRVENABLEDATA, *PDRVENABLEDATA;
  534. typedef struct tagDEVINFO
  535. {
  536. FLONG flGraphicsCaps;
  537. LOGFONTW lfDefaultFont;
  538. LOGFONTW lfAnsiVarFont;
  539. LOGFONTW lfAnsiFixFont;
  540. ULONG cFonts;
  541. ULONG iDitherFormat;
  542. USHORT cxDither;
  543. USHORT cyDither;
  544. HPALETTE hpalDefault;
  545. FLONG flGraphicsCaps2;
  546. } DEVINFO, *PDEVINFO;
  547. // flGraphicsCaps flags for DEVINFO:
  548. #define GCAPS_BEZIERS 0x00000001
  549. #define GCAPS_GEOMETRICWIDE 0x00000002
  550. #define GCAPS_ALTERNATEFILL 0x00000004
  551. #define GCAPS_WINDINGFILL 0x00000008
  552. #define GCAPS_HALFTONE 0x00000010
  553. #define GCAPS_COLOR_DITHER 0x00000020
  554. #define GCAPS_HORIZSTRIKE 0x00000040 // Obsolete
  555. #define GCAPS_VERTSTRIKE 0x00000080 // Obsolete
  556. #define GCAPS_OPAQUERECT 0x00000100
  557. #define GCAPS_VECTORFONT 0x00000200
  558. #define GCAPS_MONO_DITHER 0x00000400
  559. #define GCAPS_ASYNCCHANGE 0x00000800 // Obsolete
  560. #define GCAPS_ASYNCMOVE 0x00001000
  561. #define GCAPS_DONTJOURNAL 0x00002000
  562. #define GCAPS_DIRECTDRAW 0x00004000 // Obsolete
  563. #define GCAPS_ARBRUSHOPAQUE 0x00008000
  564. #define GCAPS_PANNING 0x00010000
  565. #define GCAPS_HIGHRESTEXT 0x00040000
  566. #define GCAPS_PALMANAGED 0x00080000
  567. #define GCAPS_DITHERONREALIZE 0x00200000
  568. #define GCAPS_NO64BITMEMACCESS 0x00400000 // Obsolete
  569. #define GCAPS_FORCEDITHER 0x00800000
  570. #define GCAPS_GRAY16 0x01000000
  571. #define GCAPS_ICM 0x02000000
  572. #define GCAPS_CMYKCOLOR 0x04000000
  573. #define GCAPS_LAYERED 0x08000000
  574. #define GCAPS_ARBRUSHTEXT 0x10000000
  575. #define GCAPS_SCREENPRECISION 0x20000000
  576. #define GCAPS_FONT_RASTERIZER 0x40000000 // the device has built in tt rasterizer
  577. #define GCAPS_NUP 0x80000000
  578. // flGraphicsCaps2 flags for DEVINFO:
  579. #define GCAPS2_JPEGSRC 0x00000001
  580. #define GCAPS2_xxxx 0x00000002
  581. #define GCAPS2_PNGSRC 0x00000008
  582. #define GCAPS2_CHANGEGAMMARAMP 0x00000010
  583. #define GCAPS2_ALPHACURSOR 0x00000020
  584. #define GCAPS2_SYNCFLUSH 0x00000040
  585. #define GCAPS2_SYNCTIMER 0x00000080
  586. #define GCAPS2_ICD_MULTIMON 0x00000100
  587. #define GCAPS2_MOUSETRAILS 0x00000200
  588. #define GCAPS2_RESERVED1 0x00000400
  589. typedef struct _LINEATTRS
  590. {
  591. FLONG fl;
  592. ULONG iJoin;
  593. ULONG iEndCap;
  594. FLOAT_LONG elWidth;
  595. FLOATL eMiterLimit;
  596. ULONG cstyle;
  597. PFLOAT_LONG pstyle;
  598. FLOAT_LONG elStyleState;
  599. } LINEATTRS, *PLINEATTRS;
  600. #define LA_GEOMETRIC 0x00000001
  601. #define LA_ALTERNATE 0x00000002
  602. #define LA_STARTGAP 0x00000004
  603. #define LA_STYLED 0x00000008
  604. #define JOIN_ROUND 0L
  605. #define JOIN_BEVEL 1L
  606. #define JOIN_MITER 2L
  607. #define ENDCAP_ROUND 0L
  608. #define ENDCAP_SQUARE 1L
  609. #define ENDCAP_BUTT 2L
  610. typedef LONG LDECI4;
  611. typedef struct _XFORML {
  612. FLOATL eM11;
  613. FLOATL eM12;
  614. FLOATL eM21;
  615. FLOATL eM22;
  616. FLOATL eDx;
  617. FLOATL eDy;
  618. } XFORML, *PXFORML;
  619. typedef struct _CIECHROMA
  620. {
  621. LDECI4 x;
  622. LDECI4 y;
  623. LDECI4 Y;
  624. }CIECHROMA;
  625. typedef struct _COLORINFO
  626. {
  627. CIECHROMA Red;
  628. CIECHROMA Green;
  629. CIECHROMA Blue;
  630. CIECHROMA Cyan;
  631. CIECHROMA Magenta;
  632. CIECHROMA Yellow;
  633. CIECHROMA AlignmentWhite;
  634. LDECI4 RedGamma;
  635. LDECI4 GreenGamma;
  636. LDECI4 BlueGamma;
  637. LDECI4 MagentaInCyanDye;
  638. LDECI4 YellowInCyanDye;
  639. LDECI4 CyanInMagentaDye;
  640. LDECI4 YellowInMagentaDye;
  641. LDECI4 CyanInYellowDye;
  642. LDECI4 MagentaInYellowDye;
  643. }COLORINFO, *PCOLORINFO;
  644. // Allowed values for GDIINFO.ulPrimaryOrder.
  645. #define PRIMARY_ORDER_ABC 0
  646. #define PRIMARY_ORDER_ACB 1
  647. #define PRIMARY_ORDER_BAC 2
  648. #define PRIMARY_ORDER_BCA 3
  649. #define PRIMARY_ORDER_CBA 4
  650. #define PRIMARY_ORDER_CAB 5
  651. // Allowed values for GDIINFO.ulHTPatternSize.
  652. #define HT_PATSIZE_2x2 0
  653. #define HT_PATSIZE_2x2_M 1
  654. #define HT_PATSIZE_4x4 2
  655. #define HT_PATSIZE_4x4_M 3
  656. #define HT_PATSIZE_6x6 4
  657. #define HT_PATSIZE_6x6_M 5
  658. #define HT_PATSIZE_8x8 6
  659. #define HT_PATSIZE_8x8_M 7
  660. #define HT_PATSIZE_10x10 8
  661. #define HT_PATSIZE_10x10_M 9
  662. #define HT_PATSIZE_12x12 10
  663. #define HT_PATSIZE_12x12_M 11
  664. #define HT_PATSIZE_14x14 12
  665. #define HT_PATSIZE_14x14_M 13
  666. #define HT_PATSIZE_16x16 14
  667. #define HT_PATSIZE_16x16_M 15
  668. #define HT_PATSIZE_SUPERCELL 16
  669. #define HT_PATSIZE_SUPERCELL_M 17
  670. #define HT_PATSIZE_USER 18
  671. #define HT_PATSIZE_MAX_INDEX HT_PATSIZE_USER
  672. #define HT_PATSIZE_DEFAULT HT_PATSIZE_SUPERCELL_M
  673. #define HT_USERPAT_CX_MIN 4
  674. #define HT_USERPAT_CX_MAX 256
  675. #define HT_USERPAT_CY_MIN 4
  676. #define HT_USERPAT_CY_MAX 256
  677. // Allowed values for GDIINFO.ulHTOutputFormat.
  678. #define HT_FORMAT_1BPP 0
  679. #define HT_FORMAT_4BPP 2
  680. #define HT_FORMAT_4BPP_IRGB 3
  681. #define HT_FORMAT_8BPP 4
  682. #define HT_FORMAT_16BPP 5
  683. #define HT_FORMAT_24BPP 6
  684. #define HT_FORMAT_32BPP 7
  685. // Allowed values for GDIINFO.flHTFlags.
  686. #define HT_FLAG_SQUARE_DEVICE_PEL 0x00000001
  687. #define HT_FLAG_HAS_BLACK_DYE 0x00000002
  688. #define HT_FLAG_ADDITIVE_PRIMS 0x00000004
  689. #define HT_FLAG_USE_8BPP_BITMASK 0x00000008
  690. #define HT_FLAG_INK_HIGH_ABSORPTION 0x00000010
  691. #define HT_FLAG_INK_ABSORPTION_INDICES 0x00000060
  692. #define HT_FLAG_DO_DEVCLR_XFORM 0x00000080
  693. #define HT_FLAG_OUTPUT_CMY 0x00000100
  694. #define HT_FLAG_PRINT_DRAFT_MODE 0x00000200
  695. #define HT_FLAG_INVERT_8BPP_BITMASK_IDX 0x00000400
  696. #define HT_FLAG_8BPP_CMY332_MASK 0xFF000000
  697. #define MAKE_CMYMASK_BYTE(c,m,y) ((BYTE)(((BYTE)(c) & 0x07) << 5) | \
  698. (BYTE)(((BYTE)(m) & 0x07) << 2) | \
  699. (BYTE)((BYTE)(y) & 0x03))
  700. #define MAKE_CMY332_MASK(c,m,y) ((DWORD)(((DWORD)(c) & 0x07) << 29) | \
  701. (DWORD)(((DWORD)(m) & 0x07) << 26) | \
  702. (DWORD)(((DWORD)(y) & 0x03) << 24))
  703. #define HT_FLAG_INK_ABSORPTION_IDX0 0x00000000
  704. #define HT_FLAG_INK_ABSORPTION_IDX1 0x00000020
  705. #define HT_FLAG_INK_ABSORPTION_IDX2 0x00000040
  706. #define HT_FLAG_INK_ABSORPTION_IDX3 0x00000060
  707. #define HT_FLAG_HIGHEST_INK_ABSORPTION (HT_FLAG_INK_HIGH_ABSORPTION | \
  708. HT_FLAG_INK_ABSORPTION_IDX3)
  709. #define HT_FLAG_HIGHER_INK_ABSORPTION (HT_FLAG_INK_HIGH_ABSORPTION | \
  710. HT_FLAG_INK_ABSORPTION_IDX2)
  711. #define HT_FLAG_HIGH_INK_ABSORPTION (HT_FLAG_INK_HIGH_ABSORPTION | \
  712. HT_FLAG_INK_ABSORPTION_IDX1)
  713. #define HT_FLAG_NORMAL_INK_ABSORPTION HT_FLAG_INK_ABSORPTION_IDX0
  714. #define HT_FLAG_LOW_INK_ABSORPTION (HT_FLAG_INK_ABSORPTION_IDX1)
  715. #define HT_FLAG_LOWER_INK_ABSORPTION (HT_FLAG_INK_ABSORPTION_IDX2)
  716. #define HT_FLAG_LOWEST_INK_ABSORPTION (HT_FLAG_INK_ABSORPTION_IDX3)
  717. // Setting/checking halftone 8bpp bitmask RGB mode
  718. #define HT_BITMASKPALRGB (DWORD)'0BGR'
  719. #define HT_SET_BITMASKPAL2RGB(pPal) (*((LPDWORD)(pPal)) = HT_BITMASKPALRGB)
  720. #define HT_IS_BITMASKPALRGB(pPal) (*((LPDWORD)(pPal)) == (DWORD)0)
  721. // Allowed values for GDIINFO.ulPhysicalPixelCharacteristics
  722. #define PPC_DEFAULT 0x0
  723. #define PPC_UNDEFINED 0x1
  724. #define PPC_RGB_ORDER_VERTICAL_STRIPES 0x2
  725. #define PPC_BGR_ORDER_VERTICAL_STRIPES 0x3
  726. #define PPC_RGB_ORDER_HORIZONTAL_STRIPES 0x4
  727. #define PPC_BGR_ORDER_HORIZONTAL_STRIPES 0x5
  728. // GDIINFO.ulPhysicalPixelGamma should be set either to the scaled
  729. // gamma (x1000) of the physical pixel or one of the following
  730. // values. For example, a 2.2 gamma would be represented as 2200
  731. #define PPG_DEFAULT 0
  732. #define PPG_SRGB 1
  733. //============================================================================
  734. // HALFTONE INFORMATION
  735. //============================================================================
  736. //
  737. // HT_FLAG_DO_DEVCLR_XFORM flag specified devices and/or drivers are required
  738. // gdi halftone to do a device transform when ICM is off, the device transform
  739. // take a input RGB value and map it to the device color space to produced
  740. // perceived density same as input RGB color values. This flag only valid if
  741. // it is a printer device surface and its format is 16bpp or 24bpp.
  742. //
  743. // ** If devices are additive and/or device surface is 1bpp, 4bpp or 8bpp, then
  744. // gdi halftone will always performed device transform regardless the
  745. // setting of HT_FLAG_DO_DEVCLR_XFORM flag.
  746. //
  747. // HT_FLAG_8BPP_CMY332_MASK - define the bit mask for 8-bpp format halftone
  748. // palette, this palette only used if a HT_FORMAT_8BPP is specified in
  749. // flHTOutputFormat and HT_FLAG_USE_8BPP_BITMASK bit is set in the flHTFlags.
  750. // if HT_FLAG_USE_8BPP_BITMAP is not set then a standard NT4.0 8-bpp format is
  751. // assumed. The format of 8BPP is set per PDEV, it cannot be changed after
  752. // the pDEV is created.
  753. //
  754. // To set HT_FLAG_8BPP_CMY332_MASK, macro MAKE_CMY332_MASK() can be used. When
  755. // specified, the bit mask cover total of 8 bits area which describe the
  756. // highest of level of CYAN, MAGENTA and YELLOW primary color, the maximum of
  757. // Cyan is 3 bits (7 levels), Magenta is 3 bits (7 levels) and Yellow is 2 bit
  758. // (3 levels).
  759. //
  760. // CMYMask Meaning
  761. // ======= =======
  762. // 0x6F Cyan=3, Magenta=3, Yellow=3
  763. // 0xFF Cyan=7, Magenta=7, Yellow=3
  764. // 0x25 Cyan=1, Magenta=1, Yellow=1, is same as using CMY 4bpp
  765. //
  766. // SPECIAL
  767. // CMYMask Meagning
  768. // ======= =======
  769. // 0x00 Gray scale 256 levels
  770. // 0x01 5 Levels (0-4) each of Cyan, Magenta and yellow, 5^3=125 color
  771. // 0x02 6 Levels (0-5) each of Cyan, Magenta and yellow, 6^3=216 color
  772. //
  773. // Any other invalid combinations (any of Cyan, Magenta, Yellow level bits is
  774. // 0 (zero) then it will returned palette entries 0
  775. //
  776. // The Palette indics are arranged as CMY entries with CYAN at highest bit
  777. // numbers and YELLOW at lowest bit number as shown below for palette indics
  778. // bit's (8 bit) definition.
  779. //
  780. // Pallete Index BIT#: 7 6 5 4 3 2 1 0
  781. // | | | | | |
  782. // +---C---+ +---M---+ +-Y-+
  783. // | | |
  784. // | | 0x03
  785. // | | +-- Yellow 0-3, Max=4 levels
  786. // | 0x1c
  787. // | +-- Magenta 0-7, Max=8 levels
  788. // 0xe0
  789. // +-- Cyan 0-7, Max=8 levels
  790. //
  791. //
  792. // If a primray color level in an index is greater than the prmary color
  793. // levels then it is eqaul to the maximum primary color level, for example
  794. // if C=7 (0xe0), and Cyan level only 5 then level 6 and 7 are same as 5
  795. //
  796. // To retrieve the palette definition for 8bpp format, use
  797. //
  798. // LONG APIENTRY
  799. // HT_Get8BPPMaskPalette(PPALETTEENTRY pPaletteEntry,
  800. // BOOL Use8BPPMaskPal,
  801. // BYTE CMYMask,
  802. // USHORT RedGamma,
  803. // USHORT GreenGamma,
  804. // USHORT BlueGamma);
  805. //
  806. // pPaletteEntry - Pointer to the PALETTEENTRY, if NULL it return palette
  807. // count needed,
  808. //
  809. // * See note below for the pPaletteEntry[0] special settings.
  810. //
  811. // Use8BPPmaskPal - FALSE if a NT4.0 standard 8bpp palette requested, FALSE
  812. // if a CMYMask 8bpp mask palette is needed.
  813. //
  814. // CMYMask - CMY bit mask for CMY as defined above. This must be the
  815. // same primary level as defined in GDIInfo.flHTFlags.
  816. // It should be same as ((GDIInfo.flHTFlags >> 24) & 0xFF).
  817. // The CMYMask also can be specified using predefined macro
  818. // MAKS_CMYMASK_BYTE(cLevel, mLevel, yLevel)
  819. //
  820. // RedGamma - Red gamma if Use8BPPMaskPal is FALSE, Cyan gamma
  821. // if Use8BPPMaskPal is TRUE
  822. //
  823. // GreenGamma - Green gamma if Use8BPPMaskPal is FALSE, Magenta gamma
  824. // if Use8BPPMaskPal is TRUE
  825. //
  826. // BlueGamma - Blue gamma if Use8BPPMaskPal is FALSE, Yellow gamma
  827. // if Use8BPPMaskPal is TRUE
  828. //
  829. //
  830. // ***************************************************************************
  831. // * SPECIAL NOTE for Windows NT version later than Windows 2000 Release *
  832. // ***************************************************************************
  833. // Current version of Window NT (Post Windows 2000) will Overloading the
  834. // pPaletteEntry in HT_Get8BPPMaskPalette(DoUseCMYMask) API to returned a
  835. // inverted indices palette based on additive palette entries composition.
  836. // Because Windows GDI ROP assume index 0 always black and last index always
  837. // white without checking the palette entries. (Indices based ROPs rather color
  838. // based) This cause many ROPS got wrong result which has inverted output.
  839. //
  840. // To correct this GDI ROPs behavior, the POST windows 2000 version of GDI
  841. // Halftone will supports a special CMY_INVERTED format. All new drivers should
  842. // use this CMY_INVERTED method for future compabilities
  843. //
  844. // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  845. // @ Following Steps are required for ALL POST Windows 2000 Drivers when @
  846. // @ using Window GDI Halftone 8bpp CMY332 Mask mode @
  847. // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  848. //
  849. // 1. Must set HT_FLAG_INVERT_8BPP_BITMASK_IDX flags
  850. //
  851. // 2. Must set pPaleteEntry[0] when calling HT_Get8BPPMaskPalette() with
  852. //
  853. // pPaletteEntry[0].peRed = 'R';
  854. // pPaletteEntry[0].peGreen = 'G';
  855. // pPaletteEntry[0].peBlue = 'B';
  856. // pPaletteEntry[0].peFlags = '0';
  857. //
  858. // The caller can use following supplied macro to set this for future
  859. // compabilities
  860. //
  861. // HT_SET_BITMASKPAL2RGB(pPaletteEntry)
  862. //
  863. // where pPaletteEntry is the pointer to the PALETTEENTRY that passed to
  864. // the HT_GET8BPPMaskPalette() fucntion call
  865. //
  866. // 3. Must Check the return Palette from HT_Get8BPPMaskPalette() using
  867. // following Macro
  868. //
  869. // HT_IS_BITMASKPALRGB(pPaletteEntry)
  870. //
  871. // where pPaletteEntry is the pointer to the PALETTEENTRY that passed to the
  872. // HT_GET8BPPMaskPalette() fucntion call,
  873. //
  874. // If this macro return FALSE then the current version of GDI HALFTONE does
  875. // NOT support the CMY_INVERTED 8bpp bitmaask mode and it only supports CMY
  876. // mode.
  877. //
  878. // If this macro return TRUE then the GDI HALFTONE DOES support the
  879. // CMY_INVERTED 8bpp bitmaask mode and the caller must using a translation
  880. // table to obtain final halftone surface bitmap 8bpp indices ink levels.
  881. //
  882. // 4. Behavior changes for GDI halftone that supports 8bpp CMY_INVERTED bitmask
  883. // mode, following is a list of changes of CMYMask mode passed to
  884. // the HT_Get8BPPMaskPalette()
  885. //
  886. // CMYMask CMY Mode Indices CMY_INVERTED Mode Indices
  887. // ======= ========================= =============================
  888. // 0 0: WHITE 0: BLACK
  889. // 1-254: Light->Dark Gray 1-254: Dark->Light Gray
  890. // 255: BLACK 255: WHITE
  891. // -------------------------------------------------------------------
  892. // 1 0: WHITE 0-65: BLACK
  893. // 1-123: 5^3 CMY color 66-188: 5^3 RGB color
  894. // 124-255: BLACK 189-255: WHITE
  895. // 127-128: Duplicate for XOR ROP
  896. // (CMY Levels 2:2:2)
  897. // -------------------------------------------------------------------
  898. // 2 0: WHITE 0-20: BLACK
  899. // 1-214: 6^3 CMY color 21-234: 6^3 RGB color
  900. // 215-255: BLACK 235-255: WHITE
  901. // -------------------------------------------------------------------
  902. // 3-255* 0: WHITE 0: BLACK
  903. // 1-254: CMY Color BitMask 1-254: Centered CxMxY BitMask*
  904. // 255: BLACK 255: WHITE
  905. // ===================================================================
  906. //
  907. // * For CMYMask mode 3-255, the valid combination must NOT have any
  908. // of Cyan, Magenta or Yellow ink level equal to 0.
  909. //
  910. // * The reason for CMY_INVERTED mode that pading BLACK and WHITE entires
  911. // at both end and have all other color in the middle is to make sure
  912. // all 256 color palette entries are even distributed so that GDI ROPs
  913. // (raster operation) will work more correctly. This is because GDI ROPs
  914. // are based on the indices not color
  915. //
  916. // * The CMY_INVERTED Mode has all non-black, non white indices centered
  917. // and even distributed within the total 256 palette indices. For
  918. // example; if a CMY=333 levels then it has total 3x3x3=27 indices,
  919. // these 27 indices will be centered by packing 114 black indices at
  920. // begining and packing 114 white indices at end to ensure that ROP
  921. // will be correct rendered.
  922. //
  923. // See following sample function of for how to generate these ink levels
  924. // and Windows 2000 CMY332 Index translation table
  925. //
  926. //
  927. // 5. For CMYMask index mode 0 to 255, the caller can use following sample
  928. // function to genrate INKLEVELS translation table
  929. //
  930. // The follwing structure and tables are examples of how to translate 8bpp
  931. // bitmask halftone bitmap indices to ink levels
  932. //
  933. // typedef struct _INKLEVELS {
  934. // BYTE Cyan; // Cyan level from 0 to max
  935. // BYTE Magenta; // Magenta level from 0 to max
  936. // BYTE Yellow; // Yellow level from 0 to max
  937. // BYTE CMY332Idx; // Original windows 2000 CMY332 Index
  938. // } INKLEVELS, *PINKLEVELS;
  939. //
  940. // To Compute a 8bpp translate table of INKLEVELS, following sample
  941. // function show how to genrate a INKLEVELS translate table for a valid
  942. // CMYMask range from 0 to 255. It can be use to generate either Windows
  943. // 2000 CMY Mode or new Post Windows 2000's CMY_INVERTED mode translation
  944. // table. It also generate a windows 2000 CMY Mode CMY332Idx so caller
  945. // can map CMY_INVERTED new indices to old index for current existing
  946. // indices processing function.
  947. //
  948. // Example Function that generate translate table for CMYMask 0 to 255,
  949. // the pInkLevels must pointed to a valid memory location of 256 INKLEVELS
  950. // entries, if return value is TRUE then it can be used to trnaslate 8bpp
  951. // indices to ink levels or mapp to the older CMY332 style indices.
  952. //
  953. //
  954. // BOOL
  955. // GenerateInkLevels(
  956. // PINKLEVELS pInkLevels, // Pointer to 256 INKLEVELS table
  957. // BYTE CMYMask, // CMYMask mode
  958. // BOOL CMYInverted // TRUE for CMY_INVERTED mode
  959. // )
  960. // {
  961. // PINKLEVELS pILDup;
  962. // PINKLEVELS pILEnd;
  963. // INKLEVELS InkLevels;
  964. // INT Count;
  965. // INT IdxInc;
  966. // INT cC;
  967. // INT cM;
  968. // INT cY;
  969. // INT xC;
  970. // INT xM;
  971. // INT xY;
  972. // INT iC;
  973. // INT iM;
  974. // INT iY;
  975. // INT mC;
  976. // INT mM;
  977. //
  978. //
  979. // switch (CMYMask) {
  980. //
  981. // case 0:
  982. //
  983. // cC =
  984. // cM =
  985. // xC =
  986. // xM = 0;
  987. // cY =
  988. // xY = 255;
  989. // break;
  990. //
  991. // case 1:
  992. // case 2:
  993. //
  994. // cC =
  995. // cM =
  996. // cY =
  997. // xC =
  998. // xM =
  999. // xY = 3 + (INT)CMYMask;
  1000. // break;
  1001. //
  1002. // default:
  1003. //
  1004. // cC = (INT)((CMYMask >> 5) & 0x07);
  1005. // cM = (INT)((CMYMask >> 2) & 0x07);
  1006. // cY = (INT)( CMYMask & 0x03);
  1007. // xC = 7;
  1008. // xM = 7;
  1009. // xY = 3;
  1010. // break;
  1011. // }
  1012. //
  1013. // Count = (cC + 1) * (cM + 1) * (cY + 1);
  1014. //
  1015. // if ((Count < 1) || (Count > 256)) {
  1016. //
  1017. // return(FALSE);
  1018. // }
  1019. //
  1020. // InkLevels.Cyan =
  1021. // InkLevels.Magenta =
  1022. // InkLevels.Yellow =
  1023. // InkLevels.CMY332Idx = 0;
  1024. // mC = (xM + 1) * (xY + 1);
  1025. // mM = xY + 1;
  1026. // pILDup = NULL;
  1027. //
  1028. // if (CMYInverted) {
  1029. //
  1030. // //
  1031. // // Move the pInkLevels to the first entry which center around
  1032. // // 256 table entries, if we skip any then all entries skipped
  1033. // // will be white (CMY levels all zeros). Because this is
  1034. // // CMY_INVERTED so entries start from back of the table and
  1035. // // moving backward to the begining of the table
  1036. // //
  1037. //
  1038. // pILEnd = pInkLevels - 1;
  1039. // IdxInc = ((256 - Count - (Count & 0x01)) / 2);
  1040. // pInkLevels += 255;
  1041. //
  1042. // while (IdxInc--) {
  1043. //
  1044. // *pInkLevels-- = InkLevels;
  1045. // }
  1046. //
  1047. // if (Count & 0x01) {
  1048. //
  1049. // //
  1050. // // If we have odd number of entries then we need to
  1051. // // duplicate the center one for correct XOR ROP to
  1052. // // operated correctly. The pILDup will always be index
  1053. // // 127, the duplication are indices 127, 128
  1054. // //
  1055. //
  1056. // pILDup = pInkLevels - (Count / 2) - 1;
  1057. // }
  1058. //
  1059. // //
  1060. // // We running from end of table to the begining, because
  1061. // // when in CMYInverted mode, the index 0 is black and index
  1062. // // 255 is white. Since we only generate 'Count' of index
  1063. // // and place them at center, we will change xC, xM, xY max.
  1064. // // index to same as cC, cM and cY.
  1065. // //
  1066. //
  1067. // IdxInc = -1;
  1068. // xC = cC;
  1069. // xM = cM;
  1070. // xY = cY;
  1071. //
  1072. // } else {
  1073. //
  1074. // IdxInc = 1;
  1075. // pILEnd = pInkLevels + 256;
  1076. // }
  1077. //
  1078. // //
  1079. // // At following, the composition of ink levels, index always
  1080. // // from 0 CMY Ink levels (WHITE) to maximum ink levels (BLACK),
  1081. // // the different with CMY_INVERTED mode is we compose it from
  1082. // // index 255 to index 0 rather than from index 0 to 255
  1083. // //
  1084. //
  1085. // if (CMYMask) {
  1086. //
  1087. // INT Idx332C;
  1088. // INT Idx332M;
  1089. //
  1090. // for (iC = 0, Idx332C = -mC; iC <= xC; iC++) {
  1091. //
  1092. // if (iC <= cC) {
  1093. //
  1094. // InkLevels.Cyan = (BYTE)iC;
  1095. // Idx332C += mC;
  1096. // }
  1097. //
  1098. // for (iM = 0, Idx332M = -mM; iM <= xM; iM++) {
  1099. //
  1100. // if (iM <= cM) {
  1101. //
  1102. // InkLevels.Magenta = (BYTE)iM;
  1103. // Idx332M += mM;
  1104. // }
  1105. //
  1106. // for (iY = 0; iY <= xY; iY++) {
  1107. //
  1108. // if (iY <= cY) {
  1109. //
  1110. // InkLevels.Yellow = (BYTE)iY;
  1111. // }
  1112. //
  1113. // InkLevels.CMY332Idx = (BYTE)(Idx332C + Idx332M) +
  1114. // InkLevels.Yellow;
  1115. // *pInkLevels = InkLevels;
  1116. //
  1117. // if ((pInkLevels += IdxInc) == pILDup) {
  1118. //
  1119. // *pInkLevels = InkLevels;
  1120. // pInkLevels += IdxInc;
  1121. // }
  1122. // }
  1123. // }
  1124. // }
  1125. //
  1126. // //
  1127. // // Now if we need to pack black at other end of the
  1128. // // translation table then do it here, Notice that InkLevels
  1129. // // are at cC, cM and cY here and the CMY332Idx is at BLACK
  1130. // //
  1131. //
  1132. // while (pInkLevels != pILEnd) {
  1133. //
  1134. // *pInkLevels = InkLevels;
  1135. // pInkLevels += IdxInc;
  1136. // }
  1137. //
  1138. // } else {
  1139. //
  1140. // //
  1141. // // Gray Scale case
  1142. // //
  1143. //
  1144. // for (iC = 0; iC < 256; iC++, pInkLevels += IdxInc) {
  1145. //
  1146. // pInkLevels->Cyan =
  1147. // pInkLevels->Magenta =
  1148. // pInkLevels->Yellow =
  1149. // pInkLevels->CMY332Idx = (BYTE)iC;
  1150. // }
  1151. // }
  1152. //
  1153. // return(TRUE);
  1154. // }
  1155. //
  1156. //
  1157. // 6. For CMYMask Mode 0 (Gray scale), the gray scale table just inverted
  1158. // between CMY and CMY_INVERTED mode.
  1159. //
  1160. // CMY mode: 0 to 255 gray scale from WHITE to BLACK increment,
  1161. // CMY_INVERTED Mode: 0 to 255 gray scale from BLACK to WHITE increment.
  1162. //
  1163. //
  1164. // 7. For CMYMask Mode 1 and 2, the caller should use a translation table for
  1165. // translate indices to CMY ink levels.
  1166. //
  1167. // 8. For CMYMode mode 3 to 255,
  1168. //
  1169. // if in CMY Mode (Windows 2000) is specified then The final CMY ink levels
  1170. // indices byte has following meanings
  1171. //
  1172. // Bit 7 6 5 4 3 2 1 0
  1173. // | | | | | |
  1174. // +---+ +---+ +=+
  1175. // | | |
  1176. // | | +-- Yellow 0-3 (Max. 4 levels)
  1177. // | |
  1178. // | +-- Magenta 0-7 (Max. 8 levels)
  1179. // |
  1180. // +-- Cyan 0-7 (Max. 8 levels)
  1181. //
  1182. //
  1183. // If a CMY_INVERTED mode is specified then caller must use a translation
  1184. // table to convert a index to the ink levels, to generate this table,
  1185. // please see above #5 description.
  1186. //
  1187. //============================================================================
  1188. // END HALFTONE INFORMATION
  1189. //============================================================================
  1190. typedef struct _GDIINFO
  1191. {
  1192. ULONG ulVersion;
  1193. ULONG ulTechnology;
  1194. ULONG ulHorzSize;
  1195. ULONG ulVertSize;
  1196. ULONG ulHorzRes;
  1197. ULONG ulVertRes;
  1198. ULONG cBitsPixel;
  1199. ULONG cPlanes;
  1200. ULONG ulNumColors;
  1201. ULONG flRaster;
  1202. ULONG ulLogPixelsX;
  1203. ULONG ulLogPixelsY;
  1204. ULONG flTextCaps;
  1205. ULONG ulDACRed;
  1206. ULONG ulDACGreen;
  1207. ULONG ulDACBlue;
  1208. ULONG ulAspectX;
  1209. ULONG ulAspectY;
  1210. ULONG ulAspectXY;
  1211. LONG xStyleStep;
  1212. LONG yStyleStep;
  1213. LONG denStyleStep;
  1214. POINTL ptlPhysOffset;
  1215. SIZEL szlPhysSize;
  1216. ULONG ulNumPalReg;
  1217. // These fields are for halftone initialization.
  1218. COLORINFO ciDevice;
  1219. ULONG ulDevicePelsDPI;
  1220. ULONG ulPrimaryOrder;
  1221. ULONG ulHTPatternSize;
  1222. ULONG ulHTOutputFormat;
  1223. ULONG flHTFlags;
  1224. ULONG ulVRefresh;
  1225. ULONG ulBltAlignment;
  1226. ULONG ulPanningHorzRes;
  1227. ULONG ulPanningVertRes;
  1228. ULONG xPanningAlignment;
  1229. ULONG yPanningAlignment;
  1230. // The following fields are for user defined halftone dither patterns. These
  1231. // fields are only checked if ulHTPatternSize is eqaul to HT_PATSIZE_USER.
  1232. //
  1233. // The user defined pHTPatA, pHTPatB, pHTPatC pointers correspond to the primary
  1234. // color order defined in ulPrimaryOrder as PRIMARY_ORDER_xxx.
  1235. //
  1236. // The size of halftone dither pattern must range from 4 to 256. For each
  1237. // dither pattern, pHTPatA, pHTPatB, pHTPatC must point to a
  1238. // valid byte array of (cxHTPat x cyHTPat) size. pHTPatA, pHTPatB and
  1239. // pHTPatC may point to the same dither pattern array.
  1240. //
  1241. // Each byte threshold within the dither pattern defines the additive
  1242. // intensity threshold of pixels. A zero threshold value indicates the pixel
  1243. // location is ignored (always black), while 1 to 255 threshold values give the
  1244. // dither pattern 255 level of grays.
  1245. ULONG cxHTPat; // cxHTPat must range from 4-256
  1246. ULONG cyHTPat; // cyHTPat must range from 4-256
  1247. LPBYTE pHTPatA; // for Primary Color Order A
  1248. LPBYTE pHTPatB; // for Primary Color Order B
  1249. LPBYTE pHTPatC; // for Primary Color Order C
  1250. // Shade and blend caps
  1251. ULONG flShadeBlend;
  1252. ULONG ulPhysicalPixelCharacteristics;
  1253. ULONG ulPhysicalPixelGamma;
  1254. } GDIINFO, *PGDIINFO;
  1255. /*
  1256. * User objects
  1257. */
  1258. typedef struct _BRUSHOBJ
  1259. {
  1260. ULONG iSolidColor;
  1261. PVOID pvRbrush;
  1262. FLONG flColorType;
  1263. } BRUSHOBJ;
  1264. //
  1265. // BRUSHOBJ::flColorType
  1266. //
  1267. #define BR_DEVICE_ICM 0x01
  1268. #define BR_HOST_ICM 0x02
  1269. #define BR_CMYKCOLOR 0x04
  1270. #define BR_ORIGCOLOR 0x08
  1271. typedef struct _CLIPOBJ
  1272. {
  1273. ULONG iUniq;
  1274. RECTL rclBounds;
  1275. BYTE iDComplexity;
  1276. BYTE iFComplexity;
  1277. BYTE iMode;
  1278. BYTE fjOptions;
  1279. } CLIPOBJ;
  1280. typedef struct _DRIVEROBJ DRIVEROBJ;
  1281. typedef BOOL (CALLBACK * FREEOBJPROC)(DRIVEROBJ *pDriverObj);
  1282. typedef struct _DRIVEROBJ
  1283. {
  1284. PVOID pvObj;
  1285. FREEOBJPROC pFreeProc;
  1286. HDEV hdev;
  1287. DHPDEV dhpdev;
  1288. } DRIVEROBJ;
  1289. typedef struct _FONTOBJ
  1290. {
  1291. ULONG iUniq;
  1292. ULONG iFace;
  1293. ULONG cxMax;
  1294. FLONG flFontType;
  1295. ULONG_PTR iTTUniq;
  1296. ULONG_PTR iFile;
  1297. SIZE sizLogResPpi;
  1298. ULONG ulStyleSize;
  1299. PVOID pvConsumer;
  1300. PVOID pvProducer;
  1301. } FONTOBJ;
  1302. typedef struct _BLENDOBJ
  1303. {
  1304. BLENDFUNCTION BlendFunction;
  1305. }BLENDOBJ,*PBLENDOBJ;
  1306. typedef BYTE GAMMA_TABLES[2][256];
  1307. //
  1308. // FONTOBJ::flFontType
  1309. //
  1310. #define FO_TYPE_RASTER RASTER_FONTTYPE /* 0x1 */
  1311. #define FO_TYPE_DEVICE DEVICE_FONTTYPE /* 0x2 */
  1312. #define FO_TYPE_TRUETYPE TRUETYPE_FONTTYPE /* 0x4 */
  1313. #define FO_TYPE_OPENTYPE OPENTYPE_FONTTYPE /* 0X8 */
  1314. #define FO_SIM_BOLD 0x00002000
  1315. #define FO_SIM_ITALIC 0x00004000
  1316. #define FO_EM_HEIGHT 0x00008000
  1317. #define FO_GRAY16 0x00010000 /* [1] */
  1318. #define FO_NOGRAY16 0x00020000 /* [1] */
  1319. #define FO_NOHINTS 0x00040000 /* [3] */
  1320. #define FO_NO_CHOICE 0x00080000 /* [3] */
  1321. // new accelerators so that printer drivers do not need to look to ifimetrics
  1322. #define FO_CFF 0x00100000
  1323. #define FO_POSTSCRIPT 0x00200000
  1324. #define FO_MULTIPLEMASTER 0x00400000
  1325. #define FO_VERT_FACE 0x00800000
  1326. #define FO_DBCS_FONT 0X01000000
  1327. // cleartype flags for horizontally or vertically striped LCD screen
  1328. #define FO_NOCLEARTYPE 0x02000000
  1329. #define FO_CLEARTYPE_X 0x10000000
  1330. #define FO_CLEARTYPE_Y 0x20000000
  1331. #define FO_CLEARTYPENATURAL_X 0x40000000
  1332. /**************************************************************************\
  1333. *
  1334. * [1]
  1335. *
  1336. * If the FO_GRAY16 flag is set then the bitmaps of the font
  1337. * are 4-bit per pixel blending (alpha) values. A value of zero
  1338. * means that the the resulting pixel should be equal to the
  1339. * background color. If the value of the alpha value is k != 0
  1340. * then the resulting pixel must be:
  1341. *
  1342. * c0 = background color
  1343. * c1 = foreground color
  1344. * b = blending value = (k+1)/16 // {k = 1,2,..,15}
  1345. * b = 0 (k = 0)
  1346. * d0 = gamma[c0], d1 = gamma[c1] // luminance components
  1347. * d = (1 - b)*d0 + b*d1 // blended luminance
  1348. * c = lambda[d] // blended device voltage
  1349. *
  1350. * where gamma[] takes a color component from application space
  1351. * to CIE space and labmda[] takes a color from CIE space to
  1352. * device color space
  1353. *
  1354. * GDI will set this bit if it request a font be gray scaled
  1355. * to 16 values then GDI will set FO_GRAY16 upon entry to
  1356. * DrvQueryFontData(). If the font driver cannot (or will
  1357. * not) grayscale a particular realization of a font then the
  1358. * font provider will zero out FO_GRAY16 and set FO_NOGRAY16
  1359. * to inform GDI that
  1360. * the gray scaling request cannot (or should not) be
  1361. * satisfied.
  1362. *
  1363. * [2]
  1364. *
  1365. * The FO_NOHINTS indicates that hints were not used in the formation
  1366. * of the glyph images. GDI will set this bit to request that hinting
  1367. * be supressed. The font provider will set this bit accroding to the
  1368. * rendering scheme that it used in generating the glyph image.
  1369. *
  1370. * [3]
  1371. *
  1372. * The FO_NO_CHOICE flag indicates that the flags FO_GRAY16 and
  1373. * FO_NOHINTS must be obeyed if at all possible.
  1374. *
  1375. \**************************************************************************/
  1376. typedef struct _PALOBJ
  1377. {
  1378. ULONG ulReserved;
  1379. } PALOBJ;
  1380. typedef struct _PATHOBJ
  1381. {
  1382. FLONG fl;
  1383. ULONG cCurves;
  1384. } PATHOBJ;
  1385. typedef struct _SURFOBJ
  1386. {
  1387. DHSURF dhsurf;
  1388. HSURF hsurf;
  1389. DHPDEV dhpdev;
  1390. HDEV hdev;
  1391. SIZEL sizlBitmap;
  1392. ULONG cjBits;
  1393. PVOID pvBits;
  1394. PVOID pvScan0;
  1395. LONG lDelta;
  1396. ULONG iUniq;
  1397. ULONG iBitmapFormat;
  1398. USHORT iType;
  1399. USHORT fjBitmap;
  1400. } SURFOBJ;
  1401. typedef struct _WNDOBJ
  1402. {
  1403. CLIPOBJ coClient;
  1404. PVOID pvConsumer;
  1405. RECTL rclClient;
  1406. SURFOBJ *psoOwner;
  1407. } WNDOBJ, *PWNDOBJ;
  1408. typedef struct _XFORMOBJ
  1409. {
  1410. ULONG ulReserved;
  1411. } XFORMOBJ;
  1412. typedef struct _XLATEOBJ
  1413. {
  1414. ULONG iUniq;
  1415. FLONG flXlate;
  1416. USHORT iSrcType; // Obsolete
  1417. USHORT iDstType; // Obsolete
  1418. ULONG cEntries;
  1419. ULONG *pulXlate;
  1420. } XLATEOBJ;
  1421. /*
  1422. * BRUSHOBJ callbacks
  1423. */
  1424. PVOID APIENTRY BRUSHOBJ_pvAllocRbrush(
  1425. BRUSHOBJ *pbo,
  1426. ULONG cj
  1427. );
  1428. PVOID APIENTRY BRUSHOBJ_pvGetRbrush(
  1429. BRUSHOBJ *pbo
  1430. );
  1431. ULONG APIENTRY BRUSHOBJ_ulGetBrushColor(
  1432. BRUSHOBJ *pbo
  1433. );
  1434. HANDLE APIENTRY BRUSHOBJ_hGetColorTransform(
  1435. BRUSHOBJ *pbo
  1436. );
  1437. /*
  1438. * CLIPOBJ callbacks
  1439. */
  1440. #define DC_TRIVIAL 0
  1441. #define DC_RECT 1
  1442. #define DC_COMPLEX 3
  1443. #define FC_RECT 1
  1444. #define FC_RECT4 2
  1445. #define FC_COMPLEX 3
  1446. #define TC_RECTANGLES 0
  1447. #define TC_PATHOBJ 2
  1448. #define OC_BANK_CLIP 1 // Obsolete
  1449. #define CT_RECTANGLES 0L
  1450. #define CD_RIGHTDOWN 0L
  1451. #define CD_LEFTDOWN 1L
  1452. #define CD_RIGHTUP 2L
  1453. #define CD_LEFTUP 3L
  1454. #define CD_ANY 4L
  1455. #define CD_LEFTWARDS 1L
  1456. #define CD_UPWARDS 2L
  1457. typedef struct _ENUMRECTS
  1458. {
  1459. ULONG c;
  1460. RECTL arcl[1];
  1461. } ENUMRECTS;
  1462. ULONG APIENTRY CLIPOBJ_cEnumStart(
  1463. CLIPOBJ *pco,
  1464. BOOL bAll,
  1465. ULONG iType,
  1466. ULONG iDirection,
  1467. ULONG cLimit
  1468. );
  1469. BOOL APIENTRY CLIPOBJ_bEnum(
  1470. CLIPOBJ *pco,
  1471. ULONG cj,
  1472. ULONG *pul
  1473. );
  1474. PATHOBJ* APIENTRY CLIPOBJ_ppoGetPath(
  1475. CLIPOBJ* pco
  1476. );
  1477. /*
  1478. * FONTOBJ callbacks
  1479. */
  1480. typedef struct _GLYPHBITS
  1481. {
  1482. POINTL ptlOrigin;
  1483. SIZEL sizlBitmap;
  1484. BYTE aj[1];
  1485. } GLYPHBITS;
  1486. #define FO_HGLYPHS 0L
  1487. #define FO_GLYPHBITS 1L
  1488. #define FO_PATHOBJ 2L
  1489. #define FD_NEGATIVE_FONT 1L
  1490. #define FO_DEVICE_FONT 1L
  1491. #define FO_OUTLINE_CAPABLE 2L
  1492. typedef union _GLYPHDEF
  1493. {
  1494. GLYPHBITS *pgb;
  1495. PATHOBJ *ppo;
  1496. } GLYPHDEF;
  1497. typedef struct _GLYPHPOS /* gp */
  1498. {
  1499. HGLYPH hg;
  1500. GLYPHDEF *pgdf;
  1501. POINTL ptl;
  1502. } GLYPHPOS,*PGLYPHPOS;
  1503. // individual glyph data
  1504. // r is a unit vector along the baseline in device coordinates.
  1505. // s is a unit vector in the ascent direction in device coordinates.
  1506. // A, B, and C, are simple tranforms of the notional space versions into
  1507. // (28.4) device coordinates. The dot products of those vectors with r
  1508. // are recorded here. Note that the high words of ptqD are also 28.4
  1509. // device coordinates. The low words provide extra accuracy.
  1510. // THE STRUCTURE DIFFERS IN ORDERING FROM NT 3.51 VERSION OF THE STRUCTURE.
  1511. // ptqD has been moved to the bottom.
  1512. // This requires only recompile of all the drivers.
  1513. typedef struct _GLYPHDATA {
  1514. GLYPHDEF gdf; // pointer to GLYPHBITS or to PATHOBJ
  1515. HGLYPH hg; // glyhp handle
  1516. FIX fxD; // Character increment amount: D*r.
  1517. FIX fxA; // Prebearing amount: A*r.
  1518. FIX fxAB; // Advancing edge of character: (A+B)*r.
  1519. FIX fxInkTop; // Baseline to inkbox top along s.
  1520. FIX fxInkBottom; // Baseline to inkbox bottom along s.
  1521. RECTL rclInk; // Ink box with sides parallel to x,y axes
  1522. POINTQF ptqD; // Character increment vector: D=A+B+C.
  1523. } GLYPHDATA;
  1524. // flAccel flags for STROBJ
  1525. // SO_FLAG_DEFAULT_PLACEMENT // defult inc vectors used to position chars
  1526. // SO_HORIZONTAL // "left to right" or "right to left"
  1527. // SO_VERTICAL // "top to bottom" or "bottom to top"
  1528. // SO_REVERSED // set if horiz & "right to left" or if vert & "bottom to top"
  1529. // SO_ZERO_BEARINGS // all glyphs have zero a and c spaces
  1530. // SO_CHAR_INC_EQUAL_BM_BASE // base == cx for horiz, == cy for vert.
  1531. // SO_MAXEXT_EQUAL_BM_SIDE // side == cy for horiz, == cx for vert.
  1532. // do not substitute device font for tt font even if device font sub table
  1533. // tells the driver this should be done
  1534. // SO_DO_NOT_SUBSTITUTE_DEVICE_FONT
  1535. #define SO_FLAG_DEFAULT_PLACEMENT 0x00000001
  1536. #define SO_HORIZONTAL 0x00000002
  1537. #define SO_VERTICAL 0x00000004
  1538. #define SO_REVERSED 0x00000008
  1539. #define SO_ZERO_BEARINGS 0x00000010
  1540. #define SO_CHAR_INC_EQUAL_BM_BASE 0x00000020
  1541. #define SO_MAXEXT_EQUAL_BM_SIDE 0x00000040
  1542. #define SO_DO_NOT_SUBSTITUTE_DEVICE_FONT 0x00000080
  1543. #define SO_GLYPHINDEX_TEXTOUT 0x00000100
  1544. #define SO_ESC_NOT_ORIENT 0x00000200
  1545. #define SO_DXDY 0x00000400
  1546. #define SO_CHARACTER_EXTRA 0x00000800
  1547. #define SO_BREAK_EXTRA 0x00001000
  1548. typedef struct _STROBJ
  1549. {
  1550. ULONG cGlyphs; // # of glyphs to render
  1551. FLONG flAccel; // accel flags
  1552. ULONG ulCharInc; // non-zero only if fixed pitch font, equal to advanced width.
  1553. RECTL rclBkGround; // bk ground rect of the string in device coords
  1554. GLYPHPOS *pgp; // If non-NULL then has all glyphs.
  1555. LPWSTR pwszOrg; // pointer to original unicode string.
  1556. } STROBJ;
  1557. typedef struct _FONTINFO /* fi */
  1558. {
  1559. ULONG cjThis;
  1560. FLONG flCaps;
  1561. ULONG cGlyphsSupported;
  1562. ULONG cjMaxGlyph1;
  1563. ULONG cjMaxGlyph4;
  1564. ULONG cjMaxGlyph8;
  1565. ULONG cjMaxGlyph32;
  1566. } FONTINFO, *PFONTINFO;
  1567. ULONG APIENTRY FONTOBJ_cGetAllGlyphHandles(
  1568. FONTOBJ *pfo,
  1569. HGLYPH *phg
  1570. );
  1571. VOID APIENTRY FONTOBJ_vGetInfo(
  1572. FONTOBJ *pfo,
  1573. ULONG cjSize,
  1574. FONTINFO *pfi
  1575. );
  1576. ULONG APIENTRY FONTOBJ_cGetGlyphs(
  1577. FONTOBJ *pfo,
  1578. ULONG iMode,
  1579. ULONG cGlyph,
  1580. HGLYPH *phg,
  1581. PVOID *ppvGlyph
  1582. );
  1583. GAMMA_TABLES* APIENTRY FONTOBJ_pGetGammaTables(
  1584. FONTOBJ *pfo
  1585. );
  1586. XFORMOBJ * APIENTRY FONTOBJ_pxoGetXform(
  1587. FONTOBJ *pfo
  1588. );
  1589. IFIMETRICS * APIENTRY FONTOBJ_pifi(
  1590. FONTOBJ *pfo
  1591. );
  1592. FD_GLYPHSET * APIENTRY FONTOBJ_pfdg(
  1593. FONTOBJ *pfo
  1594. );
  1595. PVOID APIENTRY FONTOBJ_pvTrueTypeFontFile(
  1596. FONTOBJ *pfo,
  1597. ULONG *pcjFile
  1598. );
  1599. PBYTE APIENTRY FONTOBJ_pjOpenTypeTablePointer (
  1600. FONTOBJ *pfo,
  1601. ULONG ulTag,
  1602. ULONG *pcjTable
  1603. );
  1604. LPWSTR APIENTRY FONTOBJ_pwszFontFilePaths (
  1605. FONTOBJ *pfo,
  1606. ULONG *pcwc
  1607. );
  1608. // for now only one mode is defined for glyph attributes
  1609. #define FO_ATTR_MODE_ROTATE 1
  1610. PFD_GLYPHATTR APIENTRY FONTOBJ_pQueryGlyphAttrs(
  1611. FONTOBJ *pfo,
  1612. ULONG iMode
  1613. );
  1614. /*
  1615. * PALOBJ callbacks
  1616. */
  1617. #define PAL_INDEXED 0x00000001
  1618. #define PAL_BITFIELDS 0x00000002
  1619. #define PAL_RGB 0x00000004
  1620. #define PAL_BGR 0x00000008
  1621. #define PAL_CMYK 0x00000010
  1622. ULONG APIENTRY PALOBJ_cGetColors(
  1623. PALOBJ *ppalo,
  1624. ULONG iStart,
  1625. ULONG cColors,
  1626. ULONG *pulColors
  1627. );
  1628. /*
  1629. * PATHOBJ callbacks
  1630. */
  1631. #define PO_BEZIERS 0x00000001
  1632. #define PO_ELLIPSE 0x00000002
  1633. #define PO_ALL_INTEGERS 0x00000004
  1634. #define PO_ENUM_AS_INTEGERS 0x00000008
  1635. #define PD_BEGINSUBPATH 0x00000001
  1636. #define PD_ENDSUBPATH 0x00000002
  1637. #define PD_RESETSTYLE 0x00000004
  1638. #define PD_CLOSEFIGURE 0x00000008
  1639. #define PD_BEZIERS 0x00000010
  1640. #define PD_ALL (PD_BEGINSUBPATH | \
  1641. PD_ENDSUBPATH | \
  1642. PD_RESETSTYLE | \
  1643. PD_CLOSEFIGURE | \
  1644. PD_BEZIERS)
  1645. typedef struct _PATHDATA
  1646. {
  1647. FLONG flags;
  1648. ULONG count;
  1649. POINTFIX *pptfx;
  1650. } PATHDATA, *PPATHDATA;
  1651. typedef struct _RUN
  1652. {
  1653. LONG iStart;
  1654. LONG iStop;
  1655. } RUN, *PRUN;
  1656. typedef struct _CLIPLINE
  1657. {
  1658. POINTFIX ptfxA;
  1659. POINTFIX ptfxB;
  1660. LONG lStyleState;
  1661. ULONG c;
  1662. RUN arun[1];
  1663. } CLIPLINE, *PCLIPLINE;
  1664. VOID APIENTRY PATHOBJ_vEnumStart(
  1665. PATHOBJ *ppo
  1666. );
  1667. BOOL APIENTRY PATHOBJ_bEnum(
  1668. PATHOBJ *ppo,
  1669. PATHDATA *ppd
  1670. );
  1671. VOID APIENTRY PATHOBJ_vEnumStartClipLines(
  1672. PATHOBJ *ppo,
  1673. CLIPOBJ *pco,
  1674. SURFOBJ *pso,
  1675. LINEATTRS *pla
  1676. );
  1677. BOOL APIENTRY PATHOBJ_bEnumClipLines(
  1678. PATHOBJ *ppo,
  1679. ULONG cb,
  1680. CLIPLINE *pcl
  1681. );
  1682. BOOL APIENTRY PATHOBJ_bMoveTo(
  1683. PATHOBJ *ppo,
  1684. POINTFIX ptfx
  1685. );
  1686. BOOL APIENTRY PATHOBJ_bPolyLineTo(
  1687. PATHOBJ *ppo,
  1688. POINTFIX *pptfx,
  1689. ULONG cptfx
  1690. );
  1691. BOOL APIENTRY PATHOBJ_bPolyBezierTo(
  1692. PATHOBJ *ppo,
  1693. POINTFIX *pptfx,
  1694. ULONG cptfx
  1695. );
  1696. BOOL APIENTRY PATHOBJ_bCloseFigure(
  1697. PATHOBJ *ppo
  1698. );
  1699. VOID APIENTRY PATHOBJ_vGetBounds(
  1700. PATHOBJ *ppo,
  1701. PRECTFX prectfx
  1702. );
  1703. /*
  1704. * STROBJ callbacks
  1705. */
  1706. VOID APIENTRY STROBJ_vEnumStart(
  1707. STROBJ *pstro
  1708. );
  1709. BOOL APIENTRY STROBJ_bEnum(
  1710. STROBJ *pstro,
  1711. ULONG *pc,
  1712. PGLYPHPOS *ppgpos
  1713. );
  1714. BOOL APIENTRY STROBJ_bEnumPositionsOnly(
  1715. STROBJ *pstro,
  1716. ULONG *pc,
  1717. PGLYPHPOS *ppgpos
  1718. );
  1719. DWORD APIENTRY STROBJ_dwGetCodePage(
  1720. STROBJ *pstro
  1721. );
  1722. FIX APIENTRY STROBJ_fxCharacterExtra(
  1723. STROBJ *pstro
  1724. );
  1725. FIX APIENTRY STROBJ_fxBreakExtra(
  1726. STROBJ *pstro
  1727. );
  1728. BOOL APIENTRY STROBJ_bGetAdvanceWidths(
  1729. STROBJ *pso,
  1730. ULONG iFirst,
  1731. ULONG c,
  1732. POINTQF *pptqD
  1733. );
  1734. #define SGI_EXTRASPACE 0
  1735. /*
  1736. * SURFOBJ callbacks
  1737. */
  1738. #define STYPE_BITMAP 0L
  1739. #define STYPE_DEVICE 1L
  1740. #define STYPE_DEVBITMAP 3L
  1741. #define BMF_1BPP 1L
  1742. #define BMF_4BPP 2L
  1743. #define BMF_8BPP 3L
  1744. #define BMF_16BPP 4L
  1745. #define BMF_24BPP 5L
  1746. #define BMF_32BPP 6L
  1747. #define BMF_4RLE 7L
  1748. #define BMF_8RLE 8L
  1749. #define BMF_JPEG 9L
  1750. #define BMF_PNG 10L
  1751. #define BMF_TOPDOWN 0x0001
  1752. #define BMF_NOZEROINIT 0x0002
  1753. #define BMF_DONTCACHE 0x0004
  1754. #define BMF_USERMEM 0x0008
  1755. #define BMF_KMSECTION 0x0010
  1756. #define BMF_NOTSYSMEM 0x0020
  1757. #define BMF_WINDOW_BLT 0x0040
  1758. #define BMF_UMPDMEM 0x0080
  1759. #define BMF_RESERVED 0xFF00
  1760. /*
  1761. * XFORMOBJ callbacks
  1762. */
  1763. #define GX_IDENTITY 0L
  1764. #define GX_OFFSET 1L
  1765. #define GX_SCALE 2L
  1766. #define GX_GENERAL 3L
  1767. #define XF_LTOL 0L
  1768. #define XF_INV_LTOL 1L
  1769. #define XF_LTOFX 2L
  1770. #define XF_INV_FXTOL 3L
  1771. ULONG APIENTRY XFORMOBJ_iGetXform(
  1772. XFORMOBJ *pxo,
  1773. XFORML *pxform
  1774. );
  1775. BOOL APIENTRY XFORMOBJ_bApplyXform(
  1776. XFORMOBJ *pxo,
  1777. ULONG iMode,
  1778. ULONG cPoints,
  1779. PVOID pvIn,
  1780. PVOID pvOut
  1781. );
  1782. HANDLE APIENTRY XFORMOBJ_cmGetTransform(
  1783. XFORMOBJ *pxo
  1784. );
  1785. /*
  1786. * XLATEOBJ callbacks
  1787. */
  1788. #define XO_TRIVIAL 0x00000001
  1789. #define XO_TABLE 0x00000002
  1790. #define XO_TO_MONO 0x00000004
  1791. #define XO_FROM_CMYK 0x00000008
  1792. #define XO_DEVICE_ICM 0x00000010 // ICM on Device
  1793. #define XO_HOST_ICM 0x00000020 // ICM on Engine/Apps
  1794. #define XO_SRCPALETTE 1
  1795. #define XO_DESTPALETTE 2
  1796. #define XO_DESTDCPALETTE 3
  1797. #define XO_SRCBITFIELDS 4
  1798. #define XO_DESTBITFIELDS 5
  1799. ULONG APIENTRY XLATEOBJ_iXlate(
  1800. XLATEOBJ *pxlo,
  1801. ULONG iColor
  1802. );
  1803. ULONG * APIENTRY XLATEOBJ_piVector(
  1804. XLATEOBJ *pxlo
  1805. );
  1806. ULONG APIENTRY XLATEOBJ_cGetPalette(
  1807. XLATEOBJ *pxlo,
  1808. ULONG iPal,
  1809. ULONG cPal,
  1810. ULONG *pPal
  1811. );
  1812. HANDLE APIENTRY XLATEOBJ_hGetColorTransform(
  1813. XLATEOBJ *pxlo
  1814. );
  1815. /*
  1816. * Engine callbacks - error logging
  1817. */
  1818. #ifdef USERMODE_DRIVER
  1819. #define EngGetLastError GetLastError
  1820. #define EngSetLastError SetLastError
  1821. #else // !USERMODE_DRIVER
  1822. VOID APIENTRY EngSetLastError(ULONG);
  1823. ULONG APIENTRY EngGetLastError();
  1824. #endif // !USERMODE_DRIVER
  1825. /*
  1826. * Engine callbacks - Surfaces
  1827. */
  1828. #define HOOK_BITBLT 0x00000001
  1829. #define HOOK_STRETCHBLT 0x00000002
  1830. #define HOOK_PLGBLT 0x00000004
  1831. #define HOOK_TEXTOUT 0x00000008
  1832. #define HOOK_PAINT 0x00000010 // Obsolete
  1833. #define HOOK_STROKEPATH 0x00000020
  1834. #define HOOK_FILLPATH 0x00000040
  1835. #define HOOK_STROKEANDFILLPATH 0x00000080
  1836. #define HOOK_LINETO 0x00000100
  1837. #define HOOK_COPYBITS 0x00000400
  1838. #define HOOK_MOVEPANNING 0x00000800 // Obsolete
  1839. #define HOOK_SYNCHRONIZE 0x00001000
  1840. #define HOOK_STRETCHBLTROP 0x00002000
  1841. #define HOOK_SYNCHRONIZEACCESS 0x00004000 // Obsolete
  1842. #define HOOK_TRANSPARENTBLT 0x00008000
  1843. #define HOOK_ALPHABLEND 0x00010000
  1844. #define HOOK_GRADIENTFILL 0x00020000
  1845. #define HOOK_FLAGS 0x0003b5ff
  1846. HBITMAP APIENTRY EngCreateBitmap(
  1847. SIZEL sizl,
  1848. LONG lWidth,
  1849. ULONG iFormat,
  1850. FLONG fl,
  1851. PVOID pvBits
  1852. );
  1853. HSURF APIENTRY EngCreateDeviceSurface(
  1854. DHSURF dhsurf,
  1855. SIZEL sizl,
  1856. ULONG iFormatCompat
  1857. );
  1858. HBITMAP APIENTRY EngCreateDeviceBitmap(
  1859. DHSURF dhsurf,
  1860. SIZEL sizl,
  1861. ULONG iFormatCompat
  1862. );
  1863. BOOL APIENTRY EngDeleteSurface(
  1864. HSURF hsurf
  1865. );
  1866. SURFOBJ * APIENTRY EngLockSurface(
  1867. HSURF hsurf
  1868. );
  1869. VOID APIENTRY EngUnlockSurface(
  1870. SURFOBJ *pso
  1871. );
  1872. BOOL APIENTRY EngEraseSurface(
  1873. SURFOBJ *pso,
  1874. RECTL *prcl,
  1875. ULONG iColor
  1876. );
  1877. BOOL APIENTRY EngAssociateSurface(
  1878. HSURF hsurf,
  1879. HDEV hdev,
  1880. FLONG flHooks
  1881. );
  1882. #define MS_NOTSYSTEMMEMORY 0x0001
  1883. #define MS_SHAREDACCESS 0x0002
  1884. BOOL APIENTRY EngModifySurface(
  1885. HSURF hsurf,
  1886. HDEV hdev,
  1887. FLONG flHooks,
  1888. FLONG flSurface,
  1889. DHSURF dhsurf,
  1890. VOID* pvScan0,
  1891. LONG lDelta,
  1892. VOID* pvReserved
  1893. );
  1894. BOOL APIENTRY EngMarkBandingSurface(
  1895. HSURF hsurf
  1896. );
  1897. BOOL APIENTRY EngCheckAbort(
  1898. SURFOBJ *pso
  1899. );
  1900. /*
  1901. * Engine callbacks - Paths
  1902. */
  1903. PATHOBJ * APIENTRY EngCreatePath();
  1904. VOID APIENTRY EngDeletePath(
  1905. PATHOBJ *ppo
  1906. );
  1907. /*
  1908. * Engine callbacks - Palettes
  1909. */
  1910. HPALETTE APIENTRY EngCreatePalette(
  1911. ULONG iMode,
  1912. ULONG cColors,
  1913. ULONG *pulColors,
  1914. FLONG flRed,
  1915. FLONG flGreen,
  1916. FLONG flBlue
  1917. );
  1918. ULONG APIENTRY EngQueryPalette(
  1919. HPALETTE hpal,
  1920. ULONG *piMode,
  1921. ULONG cColors,
  1922. ULONG *pulColors);
  1923. BOOL APIENTRY EngDeletePalette(
  1924. HPALETTE hpal
  1925. );
  1926. /*
  1927. * Engine callbacks - Clipping
  1928. */
  1929. CLIPOBJ * APIENTRY EngCreateClip();
  1930. VOID APIENTRY EngDeleteClip(
  1931. CLIPOBJ *pco
  1932. );
  1933. /*
  1934. * Function prototypes
  1935. */
  1936. //
  1937. // User-mode printer driver information-query entrypoint
  1938. //
  1939. BOOL APIENTRY
  1940. APIENTRY
  1941. DrvQueryDriverInfo(
  1942. DWORD dwMode,
  1943. PVOID pBuffer,
  1944. DWORD cbBuf,
  1945. PDWORD pcbNeeded
  1946. );
  1947. #define DRVQUERY_USERMODE 1
  1948. // These are the only EXPORTED functions for ANY driver
  1949. BOOL APIENTRY DrvEnableDriver(
  1950. ULONG iEngineVersion,
  1951. ULONG cj,
  1952. DRVENABLEDATA *pded
  1953. );
  1954. /*
  1955. * Driver functions
  1956. */
  1957. VOID APIENTRY DrvDisableDriver();
  1958. DHPDEV APIENTRY DrvEnablePDEV(
  1959. DEVMODEW *pdm,
  1960. LPWSTR pwszLogAddress,
  1961. ULONG cPat,
  1962. HSURF *phsurfPatterns,
  1963. ULONG cjCaps,
  1964. ULONG *pdevcaps,
  1965. ULONG cjDevInfo,
  1966. DEVINFO *pdi,
  1967. HDEV hdev,
  1968. LPWSTR pwszDeviceName,
  1969. HANDLE hDriver
  1970. );
  1971. #define HS_DDI_MAX 6
  1972. ULONG APIENTRY DrvResetDevice(
  1973. DHPDEV dhpdev,
  1974. PVOID Reserved
  1975. );
  1976. #define DRD_SUCCESS 0
  1977. #define DRD_ERROR 1
  1978. BOOL APIENTRY DrvResetPDEV(
  1979. DHPDEV dhpdevOld,
  1980. DHPDEV dhpdevNew
  1981. );
  1982. VOID APIENTRY DrvCompletePDEV(
  1983. DHPDEV dhpdev,
  1984. HDEV hdev
  1985. );
  1986. BOOL APIENTRY DrvOffset( // Obsolete
  1987. SURFOBJ* pso,
  1988. LONG x,
  1989. LONG y,
  1990. FLONG flReserved
  1991. );
  1992. HSURF APIENTRY DrvEnableSurface(
  1993. DHPDEV dhpdev
  1994. );
  1995. VOID APIENTRY DrvSynchronize(
  1996. DHPDEV dhpdev,
  1997. RECTL *prcl
  1998. );
  1999. VOID APIENTRY DrvDisableSurface(
  2000. DHPDEV dhpdev
  2001. );
  2002. VOID APIENTRY DrvDisablePDEV(
  2003. DHPDEV dhpdev
  2004. );
  2005. /* DrvSaveScreenBits - iMode definitions */
  2006. #define SS_SAVE 0
  2007. #define SS_RESTORE 1
  2008. #define SS_FREE 2
  2009. ULONG_PTR APIENTRY DrvSaveScreenBits(
  2010. SURFOBJ *pso,
  2011. ULONG iMode,
  2012. ULONG_PTR ident,
  2013. RECTL *prcl
  2014. );
  2015. /*
  2016. * Desktops
  2017. */
  2018. BOOL APIENTRY DrvAssertMode(
  2019. DHPDEV dhpdev,
  2020. BOOL bEnable
  2021. );
  2022. ULONG APIENTRY DrvGetModes(
  2023. HANDLE hDriver,
  2024. ULONG cjSize,
  2025. DEVMODEW *pdm
  2026. );
  2027. VOID APIENTRY DrvMovePanning(
  2028. LONG x,
  2029. LONG y,
  2030. FLONG fl
  2031. );
  2032. BOOL APIENTRY DrvPlgBlt(
  2033. SURFOBJ *psoTrg,
  2034. SURFOBJ *psoSrc,
  2035. SURFOBJ *psoMsk,
  2036. CLIPOBJ *pco,
  2037. XLATEOBJ *pxlo,
  2038. COLORADJUSTMENT *pca,
  2039. POINTL *pptlBrushOrg,
  2040. POINTFIX *pptfx,
  2041. RECTL *prcl,
  2042. POINTL *pptl,
  2043. ULONG iMode
  2044. );
  2045. /*
  2046. * Bitmaps
  2047. */
  2048. HBITMAP APIENTRY DrvCreateDeviceBitmap(
  2049. DHPDEV dhpdev,
  2050. SIZEL sizl,
  2051. ULONG iFormat
  2052. );
  2053. VOID APIENTRY DrvDeleteDeviceBitmap(
  2054. DHSURF dhsurf
  2055. );
  2056. /*
  2057. * Palettes
  2058. */
  2059. BOOL APIENTRY DrvSetPalette(
  2060. DHPDEV dhpdev,
  2061. PALOBJ *ppalo,
  2062. FLONG fl,
  2063. ULONG iStart,
  2064. ULONG cColors
  2065. );
  2066. /*
  2067. * Brushes
  2068. */
  2069. #define DM_DEFAULT 0x00000001
  2070. #define DM_MONOCHROME 0x00000002
  2071. #define DCR_SOLID 0
  2072. #define DCR_DRIVER 1
  2073. #define DCR_HALFTONE 2
  2074. ULONG APIENTRY DrvDitherColor(
  2075. DHPDEV dhpdev,
  2076. ULONG iMode,
  2077. ULONG rgb,
  2078. ULONG *pul
  2079. );
  2080. BOOL APIENTRY DrvRealizeBrush(
  2081. BRUSHOBJ *pbo,
  2082. SURFOBJ *psoTarget,
  2083. SURFOBJ *psoPattern,
  2084. SURFOBJ *psoMask,
  2085. XLATEOBJ *pxlo,
  2086. ULONG iHatch
  2087. );
  2088. #define RB_DITHERCOLOR 0x80000000L
  2089. /*
  2090. * Fonts
  2091. */
  2092. PIFIMETRICS APIENTRY DrvQueryFont(
  2093. DHPDEV dhpdev,
  2094. ULONG_PTR iFile,
  2095. ULONG iFace,
  2096. ULONG_PTR *pid
  2097. );
  2098. // #define QFT_UNICODE 0L
  2099. #define QFT_LIGATURES 1L
  2100. #define QFT_KERNPAIRS 2L
  2101. #define QFT_GLYPHSET 3L
  2102. PVOID APIENTRY DrvQueryFontTree(
  2103. DHPDEV dhpdev,
  2104. ULONG_PTR iFile,
  2105. ULONG iFace,
  2106. ULONG iMode,
  2107. ULONG_PTR *pid
  2108. );
  2109. #define QFD_GLYPHANDBITMAP 1L
  2110. #define QFD_GLYPHANDOUTLINE 2L
  2111. #define QFD_MAXEXTENTS 3L
  2112. #define QFD_TT_GLYPHANDBITMAP 4L
  2113. #define QFD_TT_GRAY1_BITMAP 5L
  2114. #define QFD_TT_GRAY2_BITMAP 6L
  2115. #define QFD_TT_GRAY4_BITMAP 8L
  2116. #define QFD_TT_GRAY8_BITMAP 9L
  2117. #define QFD_TT_MONO_BITMAP QFD_TT_GRAY1_BITMAP
  2118. LONG APIENTRY DrvQueryFontData(
  2119. DHPDEV dhpdev,
  2120. FONTOBJ *pfo,
  2121. ULONG iMode,
  2122. HGLYPH hg,
  2123. GLYPHDATA *pgd,
  2124. PVOID pv,
  2125. ULONG cjSize
  2126. );
  2127. VOID APIENTRY DrvFree(
  2128. PVOID pv,
  2129. ULONG_PTR id);
  2130. VOID APIENTRY DrvDestroyFont(
  2131. FONTOBJ *pfo);
  2132. // Capability flags for DrvQueryCaps.
  2133. #define QC_OUTLINES 0x00000001
  2134. #define QC_1BIT 0x00000002
  2135. #define QC_4BIT 0x00000004
  2136. //
  2137. // This is a mask of the capabilites of a font provider that can return more
  2138. // than just glyph metrics (i.e., bitmaps and/or outlines). If a driver has
  2139. // one or more of these capabilities, then it is FONT DRIVER.
  2140. //
  2141. // Drivers should only set individual bits. GDI will check if any are turned on
  2142. // using this define.
  2143. //
  2144. #define QC_FONTDRIVERCAPS ( QC_OUTLINES | QC_1BIT | QC_4BIT )
  2145. LONG APIENTRY DrvQueryFontCaps(
  2146. ULONG culCaps,
  2147. ULONG *pulCaps
  2148. );
  2149. // fStatus is a new flag NT 5.0
  2150. #define FF_SIGNATURE_VERIFIED 0x1
  2151. #define FF_IGNORED_SIGNATURE 0x2
  2152. ULONG_PTR APIENTRY DrvLoadFontFile(
  2153. ULONG cFiles, // number of font files associated with this font
  2154. ULONG_PTR *piFile, // handles for individual files, cFiles of them
  2155. PVOID *ppvView, // array of cFiles views
  2156. ULONG *pcjView, // array of their sizes
  2157. DESIGNVECTOR *pdv, // only non null for mm instances
  2158. ULONG ulLangID,
  2159. ULONG ulFastCheckSum
  2160. );
  2161. BOOL APIENTRY DrvUnloadFontFile(
  2162. ULONG_PTR iFile
  2163. );
  2164. LONG APIENTRY DrvQueryTrueTypeTable(
  2165. ULONG_PTR iFile,
  2166. ULONG ulFont,
  2167. ULONG ulTag,
  2168. PTRDIFF dpStart,
  2169. ULONG cjBuf,
  2170. BYTE *pjBuf,
  2171. PBYTE *ppjTable,
  2172. ULONG *pcjTable
  2173. );
  2174. BOOL APIENTRY DrvQueryAdvanceWidths(
  2175. DHPDEV dhpdev,
  2176. FONTOBJ *pfo,
  2177. ULONG iMode,
  2178. HGLYPH *phg,
  2179. PVOID pvWidths,
  2180. ULONG cGlyphs
  2181. );
  2182. // Values for iMode
  2183. #define QAW_GETWIDTHS 0
  2184. #define QAW_GETEASYWIDTHS 1
  2185. // values for bMetricsOnly. even though declared as BOOL
  2186. // by adding TTO_QUBICS, this is becoming a flag field.
  2187. // For versions of NT 4.0 and earlier, this value is always
  2188. // set to zero by GDI.
  2189. #define TTO_METRICS_ONLY 1
  2190. #define TTO_QUBICS 2
  2191. #define TTO_UNHINTED 4
  2192. LONG APIENTRY DrvQueryTrueTypeOutline(
  2193. DHPDEV dhpdev,
  2194. FONTOBJ *pfo,
  2195. HGLYPH hglyph,
  2196. BOOL bMetricsOnly,
  2197. GLYPHDATA *pgldt,
  2198. ULONG cjBuf,
  2199. TTPOLYGONHEADER *ppoly
  2200. );
  2201. PVOID APIENTRY DrvGetTrueTypeFile (
  2202. ULONG_PTR iFile,
  2203. ULONG *pcj
  2204. );
  2205. // values for ulMode:
  2206. #define QFF_DESCRIPTION 1L
  2207. #define QFF_NUMFACES 2L
  2208. LONG APIENTRY DrvQueryFontFile(
  2209. ULONG_PTR iFile,
  2210. ULONG ulMode,
  2211. ULONG cjBuf,
  2212. ULONG *pulBuf
  2213. );
  2214. /*
  2215. * BitBlt
  2216. */
  2217. BOOL APIENTRY DrvBitBlt(
  2218. SURFOBJ *psoTrg,
  2219. SURFOBJ *psoSrc,
  2220. SURFOBJ *psoMask,
  2221. CLIPOBJ *pco,
  2222. XLATEOBJ *pxlo,
  2223. RECTL *prclTrg,
  2224. POINTL *pptlSrc,
  2225. POINTL *pptlMask,
  2226. BRUSHOBJ *pbo,
  2227. POINTL *pptlBrush,
  2228. ROP4 rop4
  2229. );
  2230. BOOL APIENTRY DrvStretchBlt(
  2231. SURFOBJ *psoDest,
  2232. SURFOBJ *psoSrc,
  2233. SURFOBJ *psoMask,
  2234. CLIPOBJ *pco,
  2235. XLATEOBJ *pxlo,
  2236. COLORADJUSTMENT *pca,
  2237. POINTL *pptlHTOrg,
  2238. RECTL *prclDest,
  2239. RECTL *prclSrc,
  2240. POINTL *pptlMask,
  2241. ULONG iMode
  2242. );
  2243. BOOL APIENTRY DrvStretchBltROP(
  2244. SURFOBJ *psoDest,
  2245. SURFOBJ *psoSrc,
  2246. SURFOBJ *psoMask,
  2247. CLIPOBJ *pco,
  2248. XLATEOBJ *pxlo,
  2249. COLORADJUSTMENT *pca,
  2250. POINTL *pptlHTOrg,
  2251. RECTL *prclDest,
  2252. RECTL *prclSrc,
  2253. POINTL *pptlMask,
  2254. ULONG iMode,
  2255. BRUSHOBJ *pbo,
  2256. DWORD rop4
  2257. );
  2258. BOOL APIENTRY DrvAlphaBlend(
  2259. SURFOBJ *psoDest,
  2260. SURFOBJ *psoSrc,
  2261. CLIPOBJ *pco,
  2262. XLATEOBJ *pxlo,
  2263. RECTL *prclDest,
  2264. RECTL *prclSrc,
  2265. BLENDOBJ *pBlendObj
  2266. );
  2267. BOOL APIENTRY DrvGradientFill(
  2268. SURFOBJ *psoDest,
  2269. CLIPOBJ *pco,
  2270. XLATEOBJ *pxlo,
  2271. TRIVERTEX *pVertex,
  2272. ULONG nVertex,
  2273. PVOID pMesh,
  2274. ULONG nMesh,
  2275. RECTL *prclExtents,
  2276. POINTL *pptlDitherOrg,
  2277. ULONG ulMode
  2278. );
  2279. BOOL APIENTRY DrvTransparentBlt(
  2280. SURFOBJ *psoDst,
  2281. SURFOBJ *psoSrc,
  2282. CLIPOBJ *pco,
  2283. XLATEOBJ *pxlo,
  2284. RECTL *prclDst,
  2285. RECTL *prclSrc,
  2286. ULONG iTransColor,
  2287. ULONG ulReserved
  2288. );
  2289. BOOL APIENTRY DrvCopyBits(
  2290. SURFOBJ *psoDest,
  2291. SURFOBJ *psoSrc,
  2292. CLIPOBJ *pco,
  2293. XLATEOBJ *pxlo,
  2294. RECTL *prclDest,
  2295. POINTL *pptlSrc
  2296. );
  2297. /*
  2298. * Text Output
  2299. */
  2300. BOOL APIENTRY DrvTextOut(
  2301. SURFOBJ *pso,
  2302. STROBJ *pstro,
  2303. FONTOBJ *pfo,
  2304. CLIPOBJ *pco,
  2305. RECTL *prclExtra, // Obsolete, always NULL
  2306. RECTL *prclOpaque,
  2307. BRUSHOBJ *pboFore,
  2308. BRUSHOBJ *pboOpaque,
  2309. POINTL *pptlOrg,
  2310. MIX mix
  2311. );
  2312. /*
  2313. * Graphics Output
  2314. */
  2315. BOOL APIENTRY DrvLineTo(
  2316. SURFOBJ *pso,
  2317. CLIPOBJ *pco,
  2318. BRUSHOBJ *pbo,
  2319. LONG x1,
  2320. LONG y1,
  2321. LONG x2,
  2322. LONG y2,
  2323. RECTL *prclBounds,
  2324. MIX mix
  2325. );
  2326. BOOL APIENTRY DrvStrokePath(
  2327. SURFOBJ *pso,
  2328. PATHOBJ *ppo,
  2329. CLIPOBJ *pco,
  2330. XFORMOBJ *pxo,
  2331. BRUSHOBJ *pbo,
  2332. POINTL *pptlBrushOrg,
  2333. LINEATTRS *plineattrs,
  2334. MIX mix
  2335. );
  2336. #define FP_ALTERNATEMODE 1L
  2337. #define FP_WINDINGMODE 2L
  2338. BOOL APIENTRY DrvFillPath(
  2339. SURFOBJ *pso,
  2340. PATHOBJ *ppo,
  2341. CLIPOBJ *pco,
  2342. BRUSHOBJ *pbo,
  2343. POINTL *pptlBrushOrg,
  2344. MIX mix,
  2345. FLONG flOptions
  2346. );
  2347. BOOL APIENTRY DrvStrokeAndFillPath(
  2348. SURFOBJ *pso,
  2349. PATHOBJ *ppo,
  2350. CLIPOBJ *pco,
  2351. XFORMOBJ *pxo,
  2352. BRUSHOBJ *pboStroke,
  2353. LINEATTRS *plineattrs,
  2354. BRUSHOBJ *pboFill,
  2355. POINTL *pptlBrushOrg,
  2356. MIX mixFill,
  2357. FLONG flOptions
  2358. );
  2359. BOOL APIENTRY DrvPaint(
  2360. SURFOBJ *pso,
  2361. CLIPOBJ *pco,
  2362. BRUSHOBJ *pbo,
  2363. POINTL *pptlBrushOrg,
  2364. MIX mix
  2365. );
  2366. /*
  2367. * Pointers
  2368. */
  2369. #define SPS_ERROR 0
  2370. #define SPS_DECLINE 1
  2371. #define SPS_ACCEPT_NOEXCLUDE 2
  2372. #define SPS_ACCEPT_EXCLUDE 3 // Obsolete
  2373. #define SPS_ACCEPT_SYNCHRONOUS 4
  2374. #define SPS_CHANGE 0x00000001L
  2375. #define SPS_ASYNCCHANGE 0x00000002L // Obsolete
  2376. #define SPS_ANIMATESTART 0x00000004L
  2377. #define SPS_ANIMATEUPDATE 0x00000008L
  2378. #define SPS_ALPHA 0x00000010L
  2379. #define SPS_LENGTHMASK 0x00000F00L
  2380. #define SPS_FREQMASK 0x000FF000L
  2381. ULONG APIENTRY DrvSetPointerShape(
  2382. SURFOBJ *pso,
  2383. SURFOBJ *psoMask,
  2384. SURFOBJ *psoColor,
  2385. XLATEOBJ *pxlo,
  2386. LONG xHot,
  2387. LONG yHot,
  2388. LONG x,
  2389. LONG y,
  2390. RECTL *prcl,
  2391. FLONG fl
  2392. );
  2393. VOID APIENTRY DrvMovePointer(
  2394. SURFOBJ *pso,
  2395. LONG x,
  2396. LONG y,
  2397. RECTL *prcl
  2398. );
  2399. /*
  2400. * Printing
  2401. */
  2402. BOOL APIENTRY DrvSendPage(
  2403. SURFOBJ *pso
  2404. );
  2405. BOOL APIENTRY DrvStartPage(
  2406. SURFOBJ *pso
  2407. );
  2408. ULONG APIENTRY DrvEscape(
  2409. SURFOBJ *pso,
  2410. ULONG iEsc,
  2411. ULONG cjIn,
  2412. PVOID pvIn,
  2413. ULONG cjOut,
  2414. PVOID pvOut
  2415. );
  2416. BOOL APIENTRY DrvStartDoc(
  2417. SURFOBJ *pso,
  2418. LPWSTR pwszDocName,
  2419. DWORD dwJobId
  2420. );
  2421. #define ED_ABORTDOC 1
  2422. BOOL APIENTRY DrvEndDoc(
  2423. SURFOBJ *pso,
  2424. FLONG fl
  2425. );
  2426. BOOL APIENTRY DrvQuerySpoolType(
  2427. DHPDEV,
  2428. LPWSTR
  2429. );
  2430. ULONG APIENTRY DrvDrawEscape(
  2431. SURFOBJ *pso,
  2432. ULONG iEsc,
  2433. CLIPOBJ *pco,
  2434. RECTL *prcl,
  2435. ULONG cjIn,
  2436. PVOID pvIn
  2437. );
  2438. ULONG APIENTRY DrvGetGlyphMode(
  2439. DHPDEV,
  2440. FONTOBJ *
  2441. );
  2442. ULONG APIENTRY DrvFontManagement(
  2443. SURFOBJ *pso,
  2444. FONTOBJ *pfo,
  2445. ULONG iMode,
  2446. ULONG cjIn,
  2447. PVOID pvIn,
  2448. ULONG cjOut,
  2449. PVOID pvOut
  2450. );
  2451. BOOL APIENTRY DrvStartBanding(
  2452. SURFOBJ *pso,
  2453. POINTL *pptl
  2454. );
  2455. BOOL APIENTRY DrvNextBand(
  2456. SURFOBJ *pso,
  2457. POINTL *pptl
  2458. );
  2459. typedef struct _PERBANDINFO
  2460. {
  2461. BOOL bRepeatThisBand;
  2462. SIZEL szlBand;
  2463. ULONG ulHorzRes;
  2464. ULONG ulVertRes;
  2465. } PERBANDINFO, *PPERBANDINFO;
  2466. ULONG APIENTRY DrvQueryPerBandInfo(
  2467. SURFOBJ *pso,
  2468. PERBANDINFO *pbi
  2469. );
  2470. /*
  2471. * DirectDraw
  2472. */
  2473. BOOL APIENTRY DrvEnableDirectDraw(
  2474. DHPDEV dhpdev,
  2475. DD_CALLBACKS *pCallBacks,
  2476. DD_SURFACECALLBACKS *pSurfaceCallBacks,
  2477. DD_PALETTECALLBACKS *pPaletteCallBacks
  2478. );
  2479. VOID APIENTRY DrvDisableDirectDraw(
  2480. DHPDEV dhpdev
  2481. );
  2482. BOOL APIENTRY DrvGetDirectDrawInfo(
  2483. DHPDEV dhpdev,
  2484. DD_HALINFO *pHalInfo,
  2485. DWORD *pdwNumHeaps,
  2486. VIDEOMEMORY *pvmList,
  2487. DWORD *pdwNumFourCCCodes,
  2488. DWORD *pdwFourCC
  2489. );
  2490. HBITMAP APIENTRY DrvDeriveSurface(
  2491. DD_DIRECTDRAW_GLOBAL *pDirectDraw,
  2492. DD_SURFACE_LOCAL *pSurface
  2493. );
  2494. /*
  2495. * ICM (Image Color Matching)
  2496. */
  2497. HANDLE APIENTRY DrvIcmCreateColorTransform(
  2498. DHPDEV dhpdev,
  2499. LPLOGCOLORSPACEW pLogColorSpace,
  2500. PVOID pvSourceProfile,
  2501. ULONG cjSourceProfile,
  2502. PVOID pvDestProfile,
  2503. ULONG cjDestProfile,
  2504. PVOID pvTargetProfile,
  2505. ULONG cjTargetProfile,
  2506. DWORD dwReserved
  2507. );
  2508. BOOL APIENTRY DrvIcmDeleteColorTransform(
  2509. DHPDEV dhpdev,
  2510. HANDLE hcmXform
  2511. );
  2512. BOOL APIENTRY DrvIcmCheckBitmapBits(
  2513. DHPDEV dhpdev,
  2514. HANDLE hColorTransform,
  2515. SURFOBJ *pso,
  2516. PBYTE paResults
  2517. );
  2518. typedef struct _GAMMARAMP {
  2519. WORD Red[256];
  2520. WORD Green[256];
  2521. WORD Blue[256];
  2522. } GAMMARAMP, *PGAMMARAMP;
  2523. BOOL APIENTRY DrvIcmSetDeviceGammaRamp(
  2524. DHPDEV dhpdev,
  2525. ULONG iFormat,
  2526. LPVOID lpRamp
  2527. );
  2528. #define IGRF_RGB_256BYTES 0 /* Obsolate */
  2529. #define IGRF_RGB_256WORDS 1 /* Same GammaRampArray format as Win95/98 DDI */
  2530. /*
  2531. * Query miscellaneous driver support
  2532. */
  2533. BOOL APIENTRY DrvQueryDeviceSupport(
  2534. SURFOBJ *pso,
  2535. XLATEOBJ *pxlo,
  2536. XFORMOBJ *pxo,
  2537. ULONG iType,
  2538. ULONG cjIn,
  2539. PVOID pvIn,
  2540. ULONG cjOut,
  2541. PVOID pvOut);
  2542. #define QDS_CHECKJPEGFORMAT 0
  2543. #define QDS_CHECKPNGFORMAT 1
  2544. VOID APIENTRY DrvSynchronizeSurface(
  2545. SURFOBJ *pso,
  2546. RECTL *prcl,
  2547. FLONG fl
  2548. );
  2549. #define DSS_TIMER_EVENT 0x0001
  2550. #define DSS_FLUSH_EVENT 0x0002
  2551. VOID APIENTRY DrvNotify(
  2552. SURFOBJ *pso,
  2553. ULONG iType,
  2554. PVOID pvData);
  2555. #define DN_ACCELERATION_LEVEL 1
  2556. #define DN_DEVICE_ORIGIN 2
  2557. #define DN_SLEEP_MODE 3
  2558. #define DN_DRAWING_BEGIN 4
  2559. /*
  2560. * Engine callbacks - tracking clip region changes
  2561. */
  2562. #define WOC_RGN_CLIENT_DELTA 0x0001
  2563. #define WOC_RGN_CLIENT 0x0002
  2564. #define WOC_RGN_SURFACE_DELTA 0x0004
  2565. #define WOC_RGN_SURFACE 0x0008
  2566. #define WOC_CHANGED 0x0010
  2567. #define WOC_DELETE 0x0020
  2568. #define WOC_DRAWN 0x0040
  2569. #define WOC_SPRITE_OVERLAP 0x0080
  2570. #define WOC_SPRITE_NO_OVERLAP 0x0100
  2571. typedef VOID (CALLBACK * WNDOBJCHANGEPROC)(WNDOBJ *pwo, FLONG fl);
  2572. #define WO_RGN_CLIENT_DELTA 0x0001
  2573. #define WO_RGN_CLIENT 0x0002
  2574. #define WO_RGN_SURFACE_DELTA 0x0004
  2575. #define WO_RGN_SURFACE 0x0008
  2576. #define WO_RGN_UPDATE_ALL 0x0010
  2577. #define WO_RGN_WINDOW 0x0020
  2578. #define WO_DRAW_NOTIFY 0x0040
  2579. #define WO_SPRITE_NOTIFY 0x0080
  2580. #define WO_RGN_DESKTOP_COORD 0x0100
  2581. WNDOBJ * APIENTRY EngCreateWnd(
  2582. SURFOBJ *pso,
  2583. HWND hwnd,
  2584. WNDOBJCHANGEPROC pfn,
  2585. FLONG fl,
  2586. int iPixelFormat
  2587. );
  2588. VOID APIENTRY EngDeleteWnd(
  2589. WNDOBJ *pwo
  2590. );
  2591. ULONG APIENTRY WNDOBJ_cEnumStart(
  2592. WNDOBJ *pwo,
  2593. ULONG iType,
  2594. ULONG iDirection,
  2595. ULONG cLimit
  2596. );
  2597. BOOL APIENTRY WNDOBJ_bEnum(
  2598. WNDOBJ *pwo,
  2599. ULONG cj,
  2600. ULONG *pul
  2601. );
  2602. VOID APIENTRY WNDOBJ_vSetConsumer(
  2603. WNDOBJ *pwo,
  2604. PVOID pvConsumer
  2605. );
  2606. /*
  2607. * Engine callback - hung device notification
  2608. */
  2609. #define EHN_RESTORED 0
  2610. #define EHN_ERROR 1
  2611. ULONG APIENTRY EngHangNotification(
  2612. HDEV hdev,
  2613. PVOID Reserved
  2614. );
  2615. /*
  2616. * Engine callbacks - tracking driver managed resources
  2617. */
  2618. HDRVOBJ APIENTRY EngCreateDriverObj(
  2619. PVOID pvObj,
  2620. FREEOBJPROC pFreeObjProc,
  2621. HDEV hdev
  2622. );
  2623. BOOL APIENTRY EngDeleteDriverObj(
  2624. HDRVOBJ hdo,
  2625. BOOL bCallBack,
  2626. BOOL bLocked
  2627. );
  2628. DRIVEROBJ* APIENTRY EngLockDriverObj(
  2629. HDRVOBJ hdo
  2630. );
  2631. BOOL APIENTRY EngUnlockDriverObj(
  2632. HDRVOBJ hdo
  2633. );
  2634. /*
  2635. * Engine callback - return current process handle.
  2636. */
  2637. HANDLE APIENTRY EngGetProcessHandle();
  2638. /*
  2639. * Engine callback - return current thread id
  2640. */
  2641. HANDLE APIENTRY EngGetCurrentThreadId();
  2642. /*
  2643. * Engine callback - return current process id
  2644. */
  2645. HANDLE APIENTRY EngGetCurrentProcessId();
  2646. /*
  2647. * Pixel formats
  2648. */
  2649. BOOL APIENTRY DrvSetPixelFormat(
  2650. SURFOBJ *pso,
  2651. LONG iPixelFormat,
  2652. HWND hwnd
  2653. );
  2654. LONG APIENTRY DrvDescribePixelFormat(
  2655. DHPDEV dhpdev,
  2656. LONG iPixelFormat,
  2657. ULONG cjpfd,
  2658. PIXELFORMATDESCRIPTOR *ppfd
  2659. );
  2660. /*
  2661. * Swap buffers
  2662. */
  2663. BOOL APIENTRY DrvSwapBuffers(
  2664. SURFOBJ *pso,
  2665. WNDOBJ *pwo
  2666. );
  2667. /*
  2668. * Function prototypes - Engine Simulations
  2669. */
  2670. BOOL APIENTRY EngBitBlt(
  2671. SURFOBJ *psoTrg,
  2672. SURFOBJ *psoSrc,
  2673. SURFOBJ *psoMask,
  2674. CLIPOBJ *pco,
  2675. XLATEOBJ *pxlo,
  2676. RECTL *prclTrg,
  2677. POINTL *pptlSrc,
  2678. POINTL *pptlMask,
  2679. BRUSHOBJ *pbo,
  2680. POINTL *pptlBrush,
  2681. ROP4 rop4
  2682. );
  2683. BOOL APIENTRY EngLineTo(
  2684. SURFOBJ *pso,
  2685. CLIPOBJ *pco,
  2686. BRUSHOBJ *pbo,
  2687. LONG x1,
  2688. LONG y1,
  2689. LONG x2,
  2690. LONG y2,
  2691. RECTL *prclBounds,
  2692. MIX mix
  2693. );
  2694. BOOL APIENTRY EngStretchBlt(
  2695. SURFOBJ *psoDest,
  2696. SURFOBJ *psoSrc,
  2697. SURFOBJ *psoMask,
  2698. CLIPOBJ *pco,
  2699. XLATEOBJ *pxlo,
  2700. COLORADJUSTMENT *pca,
  2701. POINTL *pptlHTOrg,
  2702. RECTL *prclDest,
  2703. RECTL *prclSrc,
  2704. POINTL *pptlMask,
  2705. ULONG iMode
  2706. );
  2707. BOOL APIENTRY EngStretchBltROP(
  2708. SURFOBJ *psoDest,
  2709. SURFOBJ *psoSrc,
  2710. SURFOBJ *psoMask,
  2711. CLIPOBJ *pco,
  2712. XLATEOBJ *pxlo,
  2713. COLORADJUSTMENT *pca,
  2714. POINTL *pptlHTOrg,
  2715. RECTL *prclDest,
  2716. RECTL *prclSrc,
  2717. POINTL *pptlMask,
  2718. ULONG iMode,
  2719. BRUSHOBJ *pbo,
  2720. DWORD rop4
  2721. );
  2722. BOOL APIENTRY EngAlphaBlend(
  2723. SURFOBJ *psoDest,
  2724. SURFOBJ *psoSrc,
  2725. CLIPOBJ *pco,
  2726. XLATEOBJ *pxlo,
  2727. RECTL *prclDest,
  2728. RECTL *prclSrc,
  2729. BLENDOBJ *pBlendObj
  2730. );
  2731. BOOL APIENTRY EngGradientFill(
  2732. SURFOBJ *psoDest,
  2733. CLIPOBJ *pco,
  2734. XLATEOBJ *pxlo,
  2735. TRIVERTEX *pVertex,
  2736. ULONG nVertex,
  2737. PVOID pMesh,
  2738. ULONG nMesh,
  2739. RECTL *prclExtents,
  2740. POINTL *pptlDitherOrg,
  2741. ULONG ulMode
  2742. );
  2743. BOOL APIENTRY EngTransparentBlt(
  2744. SURFOBJ *psoDst,
  2745. SURFOBJ *psoSrc,
  2746. CLIPOBJ *pco,
  2747. XLATEOBJ *pxlo,
  2748. RECTL *prclDst,
  2749. RECTL *prclSrc,
  2750. ULONG iTransColor,
  2751. ULONG ulReserved
  2752. );
  2753. BOOL APIENTRY EngTextOut(
  2754. SURFOBJ *pso,
  2755. STROBJ *pstro,
  2756. FONTOBJ *pfo,
  2757. CLIPOBJ *pco,
  2758. RECTL *prclExtra,
  2759. RECTL *prclOpaque,
  2760. BRUSHOBJ *pboFore,
  2761. BRUSHOBJ *pboOpaque,
  2762. POINTL *pptlOrg,
  2763. MIX mix
  2764. );
  2765. BOOL APIENTRY EngStrokePath(
  2766. SURFOBJ *pso,
  2767. PATHOBJ *ppo,
  2768. CLIPOBJ *pco,
  2769. XFORMOBJ *pxo,
  2770. BRUSHOBJ *pbo,
  2771. POINTL *pptlBrushOrg,
  2772. LINEATTRS *plineattrs,
  2773. MIX mix
  2774. );
  2775. BOOL APIENTRY EngFillPath(
  2776. SURFOBJ *pso,
  2777. PATHOBJ *ppo,
  2778. CLIPOBJ *pco,
  2779. BRUSHOBJ *pbo,
  2780. POINTL *pptlBrushOrg,
  2781. MIX mix,
  2782. FLONG flOptions
  2783. );
  2784. BOOL APIENTRY EngStrokeAndFillPath(
  2785. SURFOBJ *pso,
  2786. PATHOBJ *ppo,
  2787. CLIPOBJ *pco,
  2788. XFORMOBJ *pxo,
  2789. BRUSHOBJ *pboStroke,
  2790. LINEATTRS *plineattrs,
  2791. BRUSHOBJ *pboFill,
  2792. POINTL *pptlBrushOrg,
  2793. MIX mixFill,
  2794. FLONG flOptions
  2795. );
  2796. BOOL APIENTRY EngPaint(
  2797. SURFOBJ *pso,
  2798. CLIPOBJ *pco,
  2799. BRUSHOBJ *pbo,
  2800. POINTL *pptlBrushOrg,
  2801. MIX mix
  2802. );
  2803. BOOL APIENTRY EngCopyBits(
  2804. SURFOBJ *psoDest,
  2805. SURFOBJ *psoSrc,
  2806. CLIPOBJ *pco,
  2807. XLATEOBJ *pxlo,
  2808. RECTL *prclDest,
  2809. POINTL *pptlSrc
  2810. );
  2811. ULONG APIENTRY EngSetPointerShape(
  2812. SURFOBJ *pso,
  2813. SURFOBJ *psoMask,
  2814. SURFOBJ *psoColor,
  2815. XLATEOBJ *pxlo,
  2816. LONG xHot,
  2817. LONG yHot,
  2818. LONG x,
  2819. LONG y,
  2820. RECTL *prcl,
  2821. FLONG fl
  2822. );
  2823. VOID APIENTRY EngMovePointer(
  2824. SURFOBJ *pso,
  2825. LONG x,
  2826. LONG y,
  2827. RECTL *prcl
  2828. );
  2829. BOOL APIENTRY EngPlgBlt(
  2830. SURFOBJ *psoTrg,
  2831. SURFOBJ *psoSrc,
  2832. SURFOBJ *psoMsk,
  2833. CLIPOBJ *pco,
  2834. XLATEOBJ *pxlo,
  2835. COLORADJUSTMENT *pca,
  2836. POINTL *pptlBrushOrg,
  2837. POINTFIX *pptfx,
  2838. RECTL *prcl,
  2839. POINTL *pptl,
  2840. ULONG iMode
  2841. );
  2842. ULONG APIENTRY EngDitherColor(
  2843. HDEV hdev,
  2844. ULONG iMode,
  2845. ULONG rgb,
  2846. ULONG *pul
  2847. );
  2848. //
  2849. // Sprite control
  2850. //
  2851. #define ECS_TEARDOWN 0x0001
  2852. #define ECS_REDRAW 0x0002
  2853. BOOL APIENTRY EngControlSprites(
  2854. WNDOBJ *pwo,
  2855. FLONG fl
  2856. );
  2857. //
  2858. // Halftone releated APIs
  2859. //
  2860. LONG APIENTRY HT_ComputeRGBGammaTable(
  2861. USHORT GammaTableEntries,
  2862. USHORT GammaTableType,
  2863. USHORT RedGamma,
  2864. USHORT GreenGamma,
  2865. USHORT BlueGamma,
  2866. LPBYTE pGammaTable
  2867. );
  2868. LONG APIENTRY HT_Get8BPPFormatPalette(
  2869. LPPALETTEENTRY pPaletteEntry,
  2870. USHORT RedGamma,
  2871. USHORT GreenGamma,
  2872. USHORT BlueGamma
  2873. );
  2874. LONG APIENTRY HT_Get8BPPMaskPalette(
  2875. LPPALETTEENTRY pPaletteEntry,
  2876. BOOL Use8BPPMaskPal,
  2877. BYTE CMYMask,
  2878. USHORT RedGamma,
  2879. USHORT GreenGamma,
  2880. USHORT BlueGamma
  2881. );
  2882. typedef struct _DEVHTINFO {
  2883. DWORD HTFlags;
  2884. DWORD HTPatternSize;
  2885. DWORD DevPelsDPI;
  2886. COLORINFO ColorInfo;
  2887. } DEVHTINFO, *PDEVHTINFO;
  2888. #define DEVHTADJF_COLOR_DEVICE 0x00000001
  2889. #define DEVHTADJF_ADDITIVE_DEVICE 0x00000002
  2890. typedef struct _DEVHTADJDATA {
  2891. DWORD DeviceFlags;
  2892. DWORD DeviceXDPI;
  2893. DWORD DeviceYDPI;
  2894. PDEVHTINFO pDefHTInfo;
  2895. PDEVHTINFO pAdjHTInfo;
  2896. } DEVHTADJDATA, *PDEVHTADJDATA;
  2897. LONG
  2898. APIENTRY
  2899. HTUI_DeviceColorAdjustment(
  2900. LPSTR pDeviceName,
  2901. PDEVHTADJDATA pDevHTAdjData
  2902. );
  2903. //
  2904. // General support APIS
  2905. //
  2906. VOID APIENTRY EngDebugBreak(
  2907. VOID
  2908. );
  2909. VOID APIENTRY EngDebugPrint(
  2910. PCHAR StandardPrefix,
  2911. PCHAR DebugMessage,
  2912. va_list ap
  2913. );
  2914. VOID APIENTRY EngQueryPerformanceCounter(
  2915. LONGLONG *pPerformanceCount
  2916. );
  2917. VOID APIENTRY EngQueryPerformanceFrequency(
  2918. LONGLONG *pFrequency
  2919. );
  2920. BOOL APIENTRY EngSetPointerTag(
  2921. HDEV hdev,
  2922. SURFOBJ *psoMask,
  2923. SURFOBJ *psoColor,
  2924. XLATEOBJ *pxlo,
  2925. FLONG fl
  2926. );
  2927. //
  2928. // Kernel mode memory operations
  2929. //
  2930. #define FL_ZERO_MEMORY 0x00000001
  2931. #define FL_NONPAGED_MEMORY 0x00000002
  2932. #ifdef USERMODE_DRIVER
  2933. #define EngAllocMem(flags, cj, tag) ((PVOID) GlobalAlloc(((flags) & FL_ZERO_MEMORY) ? GPTR : GMEM_FIXED, cj))
  2934. #define EngFreeMem(p) GlobalFree((HGLOBAL) (p))
  2935. #define EngAllocUserMem(cj, tag) ((PVOID) GlobalAlloc(GMEM_FIXED,cj))
  2936. #define EngFreeUserMem(p) GlobalFree((HGLOBAL) (p))
  2937. #define EngAllocPrivateUserMem( psl, cj, tag) ((PVOID) GlobalAlloc(GMEM_FIXED,cj))
  2938. #define EngFreePrivateUserMem( psl, p) GlobalFree((HGLOBAL) (p))
  2939. #define EngMulDiv MulDiv
  2940. #else // !USERMODE_DRIVER
  2941. PVOID APIENTRY EngAllocMem(
  2942. ULONG Flags,
  2943. ULONG MemSize,
  2944. ULONG Tag
  2945. );
  2946. VOID APIENTRY EngFreeMem(
  2947. PVOID Mem
  2948. );
  2949. PVOID APIENTRY EngAllocUserMem(
  2950. SIZE_T cj,
  2951. ULONG tag
  2952. );
  2953. VOID APIENTRY EngFreeUserMem(
  2954. PVOID pv
  2955. );
  2956. PVOID APIENTRY EngAllocPrivateUserMem(
  2957. PDD_SURFACE_LOCAL psl,
  2958. SIZE_T cj,
  2959. ULONG tag
  2960. );
  2961. VOID
  2962. EngFreePrivateUserMem(
  2963. PDD_SURFACE_LOCAL psl,
  2964. PVOID pv
  2965. );
  2966. HRESULT
  2967. EngDxIoctl(
  2968. ULONG ulIoctl,
  2969. PVOID pBuffer,
  2970. ULONG ulBufferSize
  2971. );
  2972. int APIENTRY EngMulDiv(
  2973. int a,
  2974. int b,
  2975. int c
  2976. );
  2977. #endif // !USERMODE_DRIVER
  2978. //
  2979. // User mode memory Operations
  2980. //
  2981. VOID APIENTRY EngProbeForRead(
  2982. PVOID Address,
  2983. ULONG Length,
  2984. ULONG Alignment
  2985. );
  2986. VOID APIENTRY EngProbeForReadAndWrite(
  2987. PVOID Address,
  2988. ULONG Length,
  2989. ULONG Alignment
  2990. );
  2991. HANDLE APIENTRY EngSecureMem(
  2992. PVOID Address,
  2993. ULONG Length
  2994. );
  2995. VOID APIENTRY EngUnsecureMem(
  2996. HANDLE hSecure
  2997. );
  2998. DWORD APIENTRY EngDeviceIoControl(
  2999. HANDLE hDevice,
  3000. DWORD dwIoControlCode,
  3001. LPVOID lpInBuffer,
  3002. DWORD nInBufferSize,
  3003. LPVOID lpOutBuffer,
  3004. DWORD nOutBufferSize,
  3005. LPDWORD lpBytesReturned
  3006. );
  3007. //
  3008. // Loading drivers and gettings entry points from them
  3009. //
  3010. #ifdef USERMODE_DRIVER
  3011. #define EngLoadImage(filename) ((HANDLE) LoadLibraryW(filename))
  3012. #define EngFindImageProcAddress(h, procname) ((PVOID) GetProcAddress(h, procname))
  3013. #define EngUnloadImage(h) FreeLibrary((HMODULE) (h))
  3014. #else // !USERMODE_DRIVER
  3015. HANDLE APIENTRY EngLoadImage(
  3016. LPWSTR pwszDriver
  3017. );
  3018. PVOID APIENTRY EngFindImageProcAddress(
  3019. HANDLE hModule,
  3020. LPSTR lpProcName
  3021. );
  3022. VOID APIENTRY EngUnloadImage(
  3023. HANDLE hModule
  3024. );
  3025. PVOID APIENTRY EngMapModule(
  3026. HANDLE h,
  3027. PULONG pSize
  3028. );
  3029. #endif // !USERMODE_DRIVER
  3030. //
  3031. // callback for extra PDEV information
  3032. //
  3033. LPWSTR APIENTRY EngGetPrinterDataFileName(
  3034. HDEV hdev
  3035. );
  3036. LPWSTR APIENTRY EngGetDriverName(
  3037. HDEV hdev
  3038. );
  3039. typedef struct _TYPE1_FONT
  3040. {
  3041. HANDLE hPFM;
  3042. HANDLE hPFB;
  3043. ULONG ulIdentifier;
  3044. } TYPE1_FONT;
  3045. BOOL APIENTRY EngGetType1FontList(
  3046. HDEV hdev,
  3047. TYPE1_FONT *pType1Buffer,
  3048. ULONG cjType1Buffer,
  3049. PULONG pulLocalFonts,
  3050. PULONG pulRemoteFonts,
  3051. LARGE_INTEGER *pLastModified
  3052. );
  3053. //
  3054. // Manipulating resource sections
  3055. //
  3056. HANDLE APIENTRY EngLoadModule(
  3057. LPWSTR pwsz
  3058. );
  3059. PVOID APIENTRY EngFindResource(
  3060. HANDLE h,
  3061. int iName,
  3062. int iType,
  3063. PULONG pulSize
  3064. );
  3065. VOID APIENTRY EngFreeModule(
  3066. HANDLE h
  3067. );
  3068. BOOL
  3069. APIENTRY
  3070. EngDeleteFile (
  3071. LPWSTR pwszFileName
  3072. );
  3073. PVOID
  3074. APIENTRY
  3075. EngMapFile(
  3076. LPWSTR pwsz,
  3077. ULONG cjSize,
  3078. ULONG_PTR *piFile
  3079. );
  3080. BOOL
  3081. APIENTRY
  3082. EngUnmapFile (
  3083. ULONG_PTR iFile
  3084. );
  3085. //
  3086. // FontFile Callbacks
  3087. //
  3088. VOID APIENTRY EngUnmapFontFile(
  3089. ULONG_PTR iFile
  3090. );
  3091. BOOL APIENTRY EngMapFontFile(
  3092. ULONG_PTR iFile,
  3093. PULONG *ppjBuf,
  3094. ULONG *pcjBuf
  3095. );
  3096. VOID APIENTRY EngUnmapFontFileFD(
  3097. ULONG_PTR iFile
  3098. );
  3099. BOOL APIENTRY EngMapFontFileFD(
  3100. ULONG_PTR iFile,
  3101. PULONG *ppjBuf,
  3102. ULONG *pcjBuf
  3103. );
  3104. BOOL APIENTRY EngLpkInstalled();
  3105. //
  3106. // Semaphores
  3107. //
  3108. DECLARE_HANDLE(HSEMAPHORE);
  3109. HSEMAPHORE APIENTRY EngCreateSemaphore(
  3110. VOID
  3111. );
  3112. VOID APIENTRY EngAcquireSemaphore(
  3113. HSEMAPHORE hsem
  3114. );
  3115. VOID APIENTRY EngReleaseSemaphore(
  3116. HSEMAPHORE hsem
  3117. );
  3118. VOID APIENTRY EngDeleteSemaphore(
  3119. HSEMAPHORE hsem
  3120. );
  3121. BOOL APIENTRY EngIsSemaphoreOwned(
  3122. HSEMAPHORE hsem
  3123. );
  3124. BOOL APIENTRY EngIsSemaphoreOwnedByCurrentThread(
  3125. HSEMAPHORE hsem
  3126. );
  3127. //
  3128. // Semaphore wrapper with a reference count for thread-safe creation and
  3129. // destruction. Data must be created zero-filled.
  3130. //
  3131. // Use EngAcquire/ReleaseSemaphore on hsem for access protection.
  3132. //
  3133. typedef struct _ENGSAFESEMAPHORE
  3134. {
  3135. HSEMAPHORE hsem;
  3136. LONG lCount;
  3137. } ENGSAFESEMAPHORE;
  3138. BOOL APIENTRY EngInitializeSafeSemaphore(
  3139. ENGSAFESEMAPHORE *pssem
  3140. );
  3141. VOID APIENTRY EngDeleteSafeSemaphore(
  3142. ENGSAFESEMAPHORE *pssem
  3143. );
  3144. VOID APIENTRY EngMultiByteToUnicodeN(
  3145. LPWSTR UnicodeString,
  3146. ULONG MaxBytesInUnicodeString,
  3147. PULONG BytesInUnicodeString,
  3148. PCHAR MultiByteString,
  3149. ULONG BytesInMultiByteString
  3150. );
  3151. VOID APIENTRY EngUnicodeToMultiByteN(
  3152. PCHAR MultiByteString,
  3153. ULONG MaxBytesInMultiByteString,
  3154. PULONG BytesInMultiByteString,
  3155. PWSTR UnicodeString,
  3156. ULONG BytesInUnicodeString
  3157. );
  3158. // for the spooler
  3159. #ifdef USERMODE_DRIVER
  3160. #define EngWritePrinter WritePrinter
  3161. #define EngGetPrinter GetPrinter
  3162. #define EngGetPrinterDriver GetPrinterDriver
  3163. #define EngGetPrinterData GetPrinterData
  3164. #define EngSetPrinterData SetPrinterData
  3165. #define EngEnumForms EnumForms
  3166. #define EngGetForm GetForm
  3167. #else // !USERMODE_DRIVER
  3168. BOOL APIENTRY EngGetPrinterDriver(
  3169. HANDLE hPrinter,
  3170. LPWSTR pEnvironment,
  3171. DWORD dwLevel,
  3172. BYTE *lpbDrvInfo,
  3173. DWORD cbBuf,
  3174. DWORD *pcbNeeded
  3175. );
  3176. DWORD APIENTRY EngGetPrinterData(
  3177. HANDLE hPrinter,
  3178. LPWSTR pValueName,
  3179. LPDWORD pType,
  3180. LPBYTE pData,
  3181. DWORD nSize,
  3182. LPDWORD pcbNeeded
  3183. );
  3184. DWORD APIENTRY EngSetPrinterData(
  3185. HANDLE hPrinter,
  3186. LPWSTR pType,
  3187. DWORD dwType,
  3188. LPBYTE lpbPrinterData,
  3189. DWORD cjPrinterData
  3190. );
  3191. BOOL APIENTRY EngGetForm(
  3192. HANDLE hPrinter,
  3193. LPWSTR pFormName,
  3194. DWORD Level,
  3195. LPBYTE pForm,
  3196. DWORD cbBuf,
  3197. LPDWORD pcbNeeded
  3198. );
  3199. BOOL APIENTRY EngWritePrinter(
  3200. HANDLE hPrinter,
  3201. LPVOID pBuf,
  3202. DWORD cbBuf,
  3203. LPDWORD pcWritten
  3204. );
  3205. BOOL APIENTRY EngGetPrinter(
  3206. HANDLE hPrinter,
  3207. DWORD dwLevel,
  3208. LPBYTE pPrinter,
  3209. DWORD cbBuf,
  3210. LPDWORD pcbNeeded
  3211. );
  3212. BOOL APIENTRY EngEnumForms(
  3213. HANDLE hPrinter,
  3214. DWORD Level,
  3215. LPBYTE pForm,
  3216. DWORD cbBuf,
  3217. LPDWORD pcbNeeded,
  3218. LPDWORD pcReturned
  3219. );
  3220. #endif // !USERMODE_DRIVER
  3221. #if defined(_X86_) && !defined(USERMODE_DRIVER)
  3222. typedef struct _FLOATOBJ
  3223. {
  3224. ULONG ul1;
  3225. ULONG ul2;
  3226. } FLOATOBJ, *PFLOATOBJ;
  3227. VOID APIENTRY FLOATOBJ_SetFloat(PFLOATOBJ,FLOATL);
  3228. VOID APIENTRY FLOATOBJ_SetLong(PFLOATOBJ,LONG);
  3229. LONG APIENTRY FLOATOBJ_GetFloat(PFLOATOBJ);
  3230. LONG APIENTRY FLOATOBJ_GetLong(PFLOATOBJ);
  3231. VOID APIENTRY FLOATOBJ_AddFloat(PFLOATOBJ,FLOATL);
  3232. VOID APIENTRY FLOATOBJ_AddLong(PFLOATOBJ,LONG);
  3233. VOID APIENTRY FLOATOBJ_Add(PFLOATOBJ,PFLOATOBJ);
  3234. VOID APIENTRY FLOATOBJ_SubFloat(PFLOATOBJ,FLOATL);
  3235. VOID APIENTRY FLOATOBJ_SubLong(PFLOATOBJ,LONG);
  3236. VOID APIENTRY FLOATOBJ_Sub(PFLOATOBJ,PFLOATOBJ);
  3237. VOID APIENTRY FLOATOBJ_MulFloat(PFLOATOBJ,FLOATL);
  3238. VOID APIENTRY FLOATOBJ_MulLong(PFLOATOBJ,LONG);
  3239. VOID APIENTRY FLOATOBJ_Mul(PFLOATOBJ,PFLOATOBJ);
  3240. VOID APIENTRY FLOATOBJ_DivFloat(PFLOATOBJ,FLOATL);
  3241. VOID APIENTRY FLOATOBJ_DivLong(PFLOATOBJ,LONG);
  3242. VOID APIENTRY FLOATOBJ_Div(PFLOATOBJ,PFLOATOBJ);
  3243. VOID APIENTRY FLOATOBJ_Neg(PFLOATOBJ);
  3244. BOOL APIENTRY FLOATOBJ_EqualLong(PFLOATOBJ,LONG);
  3245. BOOL APIENTRY FLOATOBJ_GreaterThanLong(PFLOATOBJ,LONG);
  3246. BOOL APIENTRY FLOATOBJ_LessThanLong(PFLOATOBJ,LONG);
  3247. BOOL APIENTRY FLOATOBJ_Equal(PFLOATOBJ,PFLOATOBJ);
  3248. BOOL APIENTRY FLOATOBJ_GreaterThan(PFLOATOBJ,PFLOATOBJ);
  3249. BOOL APIENTRY FLOATOBJ_LessThan(PFLOATOBJ,PFLOATOBJ);
  3250. #else
  3251. // any platform that has support for floats in the kernel
  3252. typedef FLOAT FLOATOBJ;
  3253. typedef FLOAT *PFLOATOBJ;
  3254. #define FLOATOBJ_SetFloat(pf,f) {*(pf) = (f); }
  3255. #define FLOATOBJ_SetLong(pf,l) {*(pf) = (FLOAT)(l); }
  3256. #define FLOATOBJ_GetFloat(pf) *((PULONG)pf)
  3257. #define FLOATOBJ_GetLong(pf) (LONG)*(pf)
  3258. #define FLOATOBJ_AddFloat(pf,f) {*(pf) += f; }
  3259. #define FLOATOBJ_AddLong(pf,l) {*(pf) += (LONG)(l); }
  3260. #define FLOATOBJ_Add(pf,pf1) {*(pf) += *(pf1); }
  3261. #define FLOATOBJ_SubFloat(pf,f) {*(pf) -= f; }
  3262. #define FLOATOBJ_SubLong(pf,l) {*(pf) -= (LONG)(l); }
  3263. #define FLOATOBJ_Sub(pf,pf1) {*(pf) -= *(pf1); }
  3264. #define FLOATOBJ_MulFloat(pf,f) {*(pf) *= f; }
  3265. #define FLOATOBJ_MulLong(pf,l) {*(pf) *= (LONG)(l); }
  3266. #define FLOATOBJ_Mul(pf,pf1) {*(pf) *= *(pf1); }
  3267. #define FLOATOBJ_DivFloat(pf,f) {*(pf) /= f; }
  3268. #define FLOATOBJ_DivLong(pf,l) {*(pf) /= (LONG)(l); }
  3269. #define FLOATOBJ_Div(pf,pf1) {*(pf) /= *(pf1); }
  3270. #define FLOATOBJ_Neg(pf) {*(pf) = -*(pf); }
  3271. #define FLOATOBJ_EqualLong(pf,l) (*(pf) == (FLOAT)(l))
  3272. #define FLOATOBJ_GreaterThanLong(pf,l) (*(pf) > (FLOAT)(l))
  3273. #define FLOATOBJ_LessThanLong(pf,l) (*(pf) < (FLOAT)(l))
  3274. #define FLOATOBJ_Equal(pf,pf1) (*(pf) == *(pf1))
  3275. #define FLOATOBJ_GreaterThan(pf,pf1) (*(pf) > *(pf1))
  3276. #define FLOATOBJ_LessThan(pf,pf1) (*(pf) < *(pf1))
  3277. #endif // _FLOATOBJ_
  3278. #if defined(USERMODE_DRIVER)
  3279. typedef XFORML FLOATOBJ_XFORM ;
  3280. typedef XFORML *PFLOATOBJ_XFORM;
  3281. typedef XFORML FAR *LPFLOATOBJ_XFORM;
  3282. #define XFORMOBJ_iGetFloatObjXform XFORMOBJ_iGetXform
  3283. #else
  3284. typedef struct tagFLOATOBJ_XFORM
  3285. {
  3286. FLOATOBJ eM11;
  3287. FLOATOBJ eM12;
  3288. FLOATOBJ eM21;
  3289. FLOATOBJ eM22;
  3290. FLOATOBJ eDx;
  3291. FLOATOBJ eDy;
  3292. } FLOATOBJ_XFORM, *PFLOATOBJ_XFORM, FAR *LPFLOATOBJ_XFORM;
  3293. ULONG APIENTRY XFORMOBJ_iGetFloatObjXform(
  3294. XFORMOBJ *pxo,
  3295. FLOATOBJ_XFORM * pfxo
  3296. );
  3297. #endif
  3298. // SORT specific defines
  3299. typedef int (__cdecl *SORTCOMP)(const void *pv1, const void *pv2);
  3300. VOID APIENTRY EngSort(
  3301. PBYTE pjBuf,
  3302. ULONG c,
  3303. ULONG cjElem,
  3304. SORTCOMP pfnComp
  3305. );
  3306. typedef struct _ENG_TIME_FIELDS {
  3307. USHORT usYear; // range [1601...]
  3308. USHORT usMonth; // range [1..12]
  3309. USHORT usDay; // range [1..31]
  3310. USHORT usHour; // range [0..23]
  3311. USHORT usMinute; // range [0..59]
  3312. USHORT usSecond; // range [0..59]
  3313. USHORT usMilliseconds;// range [0..999]
  3314. USHORT usWeekday; // range [0..6] == [Sunday..Saturday]
  3315. } ENG_TIME_FIELDS, *PENG_TIME_FIELDS;
  3316. VOID APIENTRY EngQueryLocalTime(
  3317. PENG_TIME_FIELDS
  3318. );
  3319. FD_GLYPHSET* APIENTRY EngComputeGlyphSet(
  3320. INT nCodePage,
  3321. INT nFirstChar,
  3322. INT cChars
  3323. );
  3324. INT APIENTRY EngMultiByteToWideChar(
  3325. UINT CodePage,
  3326. LPWSTR WideCharString,
  3327. INT BytesInWideCharString,
  3328. LPSTR MultiByteString,
  3329. INT BytesInMultiByteString
  3330. );
  3331. INT APIENTRY EngWideCharToMultiByte(
  3332. UINT CodePage,
  3333. LPWSTR WideCharString,
  3334. INT BytesInWideCharString,
  3335. LPSTR MultiByteString,
  3336. INT BytesInMultiByteString
  3337. );
  3338. VOID APIENTRY EngGetCurrentCodePage(
  3339. PUSHORT OemCodePage,
  3340. PUSHORT AnsiCodePage
  3341. );
  3342. HANDLE APIENTRY EngLoadModuleForWrite(
  3343. LPWSTR pwsz,
  3344. ULONG cjSizeOfModule
  3345. );
  3346. LARGE_INTEGER APIENTRY EngQueryFileTimeStamp (
  3347. LPWSTR pwsz
  3348. );
  3349. BOOL APIENTRY EngGetFileChangeTime(
  3350. HANDLE h,
  3351. LARGE_INTEGER *pChangeTime
  3352. );
  3353. BOOL APIENTRY EngGetFilePath(
  3354. IN HANDLE h ,
  3355. OUT WCHAR (*pDest)[MAX_PATH+1]
  3356. );
  3357. ULONG APIENTRY EngSaveFloatingPointState(
  3358. VOID *pBuffer,
  3359. ULONG cjBufferSize
  3360. );
  3361. BOOL APIENTRY EngRestoreFloatingPointState(
  3362. VOID *pBuffer
  3363. );
  3364. //
  3365. // DirectDraw surface locking
  3366. //
  3367. PDD_SURFACE_LOCAL APIENTRY EngLockDirectDrawSurface(
  3368. HANDLE hSurface
  3369. );
  3370. BOOL APIENTRY EngUnlockDirectDrawSurface(
  3371. PDD_SURFACE_LOCAL pSurface
  3372. );
  3373. //
  3374. // Engine Event support.
  3375. //
  3376. //
  3377. // Opaque type for event objects.
  3378. //
  3379. typedef struct _ENG_EVENT *PEVENT;
  3380. BOOL APIENTRY EngDeleteEvent(
  3381. IN PEVENT pEvent
  3382. );
  3383. BOOL APIENTRY EngCreateEvent(
  3384. OUT PEVENT *ppEvent
  3385. );
  3386. BOOL APIENTRY EngUnmapEvent(
  3387. IN PEVENT pEvent
  3388. );
  3389. PEVENT APIENTRY EngMapEvent(
  3390. IN HDEV hDev,
  3391. IN HANDLE hUserObject,
  3392. IN PVOID Reserved1,
  3393. IN PVOID Reserved2,
  3394. IN PVOID Reserved3
  3395. );
  3396. BOOL APIENTRY EngWaitForSingleObject(
  3397. IN PEVENT pEvent,
  3398. IN PLARGE_INTEGER pTimeOut
  3399. );
  3400. LONG APIENTRY EngSetEvent(
  3401. IN PEVENT pEvent
  3402. );
  3403. VOID APIENTRY
  3404. EngClearEvent (
  3405. IN PEVENT pEvent
  3406. );
  3407. LONG APIENTRY
  3408. EngReadStateEvent (
  3409. IN PEVENT pEvent
  3410. );
  3411. //
  3412. // Querying of system attributes.
  3413. //
  3414. typedef enum _ENG_SYSTEM_ATTRIBUTE {
  3415. EngProcessorFeature = 1,
  3416. EngNumberOfProcessors,
  3417. EngOptimumAvailableUserMemory,
  3418. EngOptimumAvailableSystemMemory,
  3419. } ENG_SYSTEM_ATTRIBUTE;
  3420. #define QSA_MMX 0x00000100 // MMX
  3421. #define QSA_SSE 0x00002000 // SIMD
  3422. #define QSA_3DNOW 0x00004000 // 3DNow
  3423. BOOL APIENTRY
  3424. EngQuerySystemAttribute(
  3425. ENG_SYSTEM_ATTRIBUTE CapNum,
  3426. PDWORD pCapability);
  3427. #define ENG_FNT_CACHE_READ_FAULT 0x1
  3428. #define ENG_FNT_CACHE_WRITE_FAULT 0x2
  3429. PVOID APIENTRY EngFntCacheLookUp(ULONG FastCheckSum, ULONG * pulSize);
  3430. PVOID APIENTRY EngFntCacheAlloc(ULONG FastCheckSum, ULONG ulSize);
  3431. VOID APIENTRY EngFntCacheFault(ULONG ulFastCheckSum, ULONG iFaultMode);
  3432. typedef enum _ENG_DEVICE_ATTRIBUTE {
  3433. QDA_RESERVED = 0,
  3434. QDA_ACCELERATION_LEVEL = 1
  3435. } ENG_DEVICE_ATTRIBUTE;
  3436. BOOL APIENTRY
  3437. EngQueryDeviceAttribute(
  3438. HDEV hdev,
  3439. ENG_DEVICE_ATTRIBUTE devAttr,
  3440. VOID * pvIn,
  3441. ULONG ulInSize,
  3442. VOID * pvOUt,
  3443. ULONG ulOutSize);
  3444. typedef struct
  3445. {
  3446. DWORD nSize;
  3447. HDC hdc;
  3448. PBYTE pvEMF;
  3449. PBYTE pvCurrentRecord;
  3450. } EMFINFO, *PEMFINFO;
  3451. BOOL APIENTRY
  3452. EngQueryEMFInfo(
  3453. HDEV hdev,
  3454. EMFINFO *pEMFInfo);
  3455. //
  3456. // EngProcessorFeature
  3457. //
  3458. //
  3459. // EngNumberOfProcessors
  3460. //
  3461. // Number of active processors in the machine.
  3462. //
  3463. //
  3464. // EngOptimumAvailableUserMemory
  3465. //
  3466. // Optimum amount of user-mode memory available to avoid paging.
  3467. // Returns the number of bytes for the optimum allocation size
  3468. // Memory is allocated via EngAllocUserMem.
  3469. //
  3470. //
  3471. // EngOptimumAvailableSystemMemory
  3472. //
  3473. // Optimum amount of system memory available to avoid paging.
  3474. // Returns the number of bytes for the optimum allocation size.
  3475. // Memory is allocated via EngAllocMem.
  3476. //
  3477. //
  3478. // DDI entrypoint function prototypes
  3479. //
  3480. typedef BOOL (APIENTRY *PFN_DrvEnableDriver)(ULONG,ULONG,PDRVENABLEDATA);
  3481. typedef DHPDEV (APIENTRY *PFN_DrvEnablePDEV) (PDEVMODEW,LPWSTR,ULONG,HSURF*,ULONG,GDIINFO*,ULONG,PDEVINFO,HDEV,LPWSTR,HANDLE);
  3482. typedef VOID (APIENTRY *PFN_DrvCompletePDEV)(DHPDEV,HDEV);
  3483. typedef ULONG (APIENTRY *PFN_DrvResetDevice)(DHPDEV,PVOID);
  3484. typedef VOID (APIENTRY *PFN_DrvDisablePDEV)(DHPDEV);
  3485. typedef VOID (APIENTRY *PFN_DrvSynchronize)(DHPDEV,RECTL *);
  3486. typedef HSURF (APIENTRY *PFN_DrvEnableSurface)(DHPDEV);
  3487. typedef VOID (APIENTRY *PFN_DrvDisableDriver)(VOID);
  3488. typedef VOID (APIENTRY *PFN_DrvDisableSurface)(DHPDEV);
  3489. typedef BOOL (APIENTRY *PFN_DrvAssertMode)(DHPDEV, BOOL);
  3490. typedef BOOL (APIENTRY *PFN_DrvTextOut)(SURFOBJ *,STROBJ *,FONTOBJ *,CLIPOBJ *,RECTL *,RECTL *,BRUSHOBJ *,BRUSHOBJ *,POINTL *,MIX);
  3491. typedef BOOL (APIENTRY *PFN_DrvStretchBlt)(SURFOBJ *,SURFOBJ *,SURFOBJ *,CLIPOBJ *,XLATEOBJ *,COLORADJUSTMENT *,POINTL *,RECTL *,RECTL *,POINTL *,ULONG);
  3492. typedef BOOL (APIENTRY *PFN_DrvStretchBltROP)(SURFOBJ *,SURFOBJ *,SURFOBJ *,CLIPOBJ *,XLATEOBJ *,COLORADJUSTMENT *,POINTL *,RECTL *,RECTL *,POINTL *,ULONG, BRUSHOBJ *,ROP4);
  3493. typedef BOOL (APIENTRY *PFN_DrvTransparentBlt)(SURFOBJ *, SURFOBJ *, CLIPOBJ *, XLATEOBJ *, RECTL *, RECTL *, ULONG, ULONG);
  3494. typedef BOOL (APIENTRY *PFN_DrvPlgBlt)(SURFOBJ *,SURFOBJ *,SURFOBJ *,CLIPOBJ *,XLATEOBJ *,COLORADJUSTMENT *,POINTL *,POINTFIX *,RECTL *,POINTL *,ULONG);
  3495. typedef BOOL (APIENTRY *PFN_DrvBitBlt)(SURFOBJ *,SURFOBJ *,SURFOBJ *,CLIPOBJ *,XLATEOBJ *,RECTL *,POINTL *,POINTL *,BRUSHOBJ *,POINTL *,ROP4);
  3496. typedef BOOL (APIENTRY *PFN_DrvRealizeBrush)(BRUSHOBJ *,SURFOBJ *,SURFOBJ *,SURFOBJ *,XLATEOBJ *,ULONG);
  3497. typedef BOOL (APIENTRY *PFN_DrvCopyBits)(SURFOBJ *,SURFOBJ *,CLIPOBJ *,XLATEOBJ *,RECTL *,POINTL *);
  3498. typedef ULONG (APIENTRY *PFN_DrvDitherColor)(DHPDEV, ULONG, ULONG, ULONG *);
  3499. typedef HBITMAP (APIENTRY *PFN_DrvCreateDeviceBitmap)(DHPDEV, SIZEL, ULONG);
  3500. typedef VOID (APIENTRY *PFN_DrvDeleteDeviceBitmap)(DHSURF);
  3501. typedef BOOL (APIENTRY *PFN_DrvSetPalette)(DHPDEV, PALOBJ *, FLONG, ULONG, ULONG);
  3502. typedef ULONG (APIENTRY *PFN_DrvEscape)(SURFOBJ *, ULONG, ULONG, PVOID, ULONG, PVOID);
  3503. typedef ULONG (APIENTRY *PFN_DrvDrawEscape)(SURFOBJ *, ULONG, CLIPOBJ *, RECTL *, ULONG, PVOID);
  3504. typedef PIFIMETRICS (APIENTRY *PFN_DrvQueryFont)(DHPDEV, ULONG_PTR, ULONG, ULONG_PTR *);
  3505. typedef PVOID (APIENTRY *PFN_DrvQueryFontTree)(DHPDEV, ULONG_PTR, ULONG, ULONG, ULONG_PTR *);
  3506. typedef LONG (APIENTRY *PFN_DrvQueryFontData)(DHPDEV, FONTOBJ *, ULONG, HGLYPH, GLYPHDATA *, PVOID, ULONG);
  3507. typedef VOID (APIENTRY *PFN_DrvFree)(PVOID, ULONG_PTR);
  3508. typedef VOID (APIENTRY *PFN_DrvDestroyFont)(FONTOBJ *);
  3509. typedef LONG (APIENTRY *PFN_DrvQueryFontCaps)(ULONG, ULONG *);
  3510. typedef HFF (APIENTRY *PFN_DrvLoadFontFile)(ULONG, ULONG_PTR *, PVOID *, ULONG *, DESIGNVECTOR *, ULONG, ULONG);
  3511. typedef BOOL (APIENTRY *PFN_DrvUnloadFontFile)(ULONG_PTR);
  3512. typedef ULONG (APIENTRY *PFN_DrvSetPointerShape)(SURFOBJ *, SURFOBJ *, SURFOBJ *,XLATEOBJ *,LONG,LONG,LONG,LONG,RECTL *,FLONG);
  3513. typedef VOID (APIENTRY *PFN_DrvMovePointer)(SURFOBJ *pso,LONG x,LONG y,RECTL *prcl);
  3514. typedef BOOL (APIENTRY *PFN_DrvSendPage)(SURFOBJ *);
  3515. typedef BOOL (APIENTRY *PFN_DrvStartPage)(SURFOBJ *pso);
  3516. typedef BOOL (APIENTRY *PFN_DrvStartDoc)(SURFOBJ *pso, LPWSTR pwszDocName, DWORD dwJobId);
  3517. typedef BOOL (APIENTRY *PFN_DrvEndDoc)(SURFOBJ *pso, FLONG fl);
  3518. typedef BOOL (APIENTRY *PFN_DrvQuerySpoolType)(DHPDEV dhpdev, LPWSTR pwchType);
  3519. typedef BOOL (APIENTRY *PFN_DrvLineTo)(SURFOBJ *,CLIPOBJ *,BRUSHOBJ *,LONG,LONG,LONG,LONG,RECTL *,MIX);
  3520. typedef BOOL (APIENTRY *PFN_DrvStrokePath)(SURFOBJ *,PATHOBJ *,CLIPOBJ *,XFORMOBJ *,BRUSHOBJ *,POINTL *,LINEATTRS *,MIX);
  3521. typedef BOOL (APIENTRY *PFN_DrvFillPath)(SURFOBJ *,PATHOBJ *,CLIPOBJ *,BRUSHOBJ *,POINTL *,MIX,FLONG);
  3522. typedef BOOL (APIENTRY *PFN_DrvStrokeAndFillPath)(SURFOBJ *,PATHOBJ *,CLIPOBJ *,XFORMOBJ *,BRUSHOBJ *,LINEATTRS *,BRUSHOBJ *,POINTL *,MIX,FLONG);
  3523. typedef BOOL (APIENTRY *PFN_DrvPaint)(SURFOBJ *,CLIPOBJ *,BRUSHOBJ *,POINTL *,MIX);
  3524. typedef ULONG (APIENTRY *PFN_DrvGetGlyphMode)(DHPDEV dhpdev,FONTOBJ *pfo);
  3525. typedef BOOL (APIENTRY *PFN_DrvResetPDEV)(DHPDEV dhpdevOld, DHPDEV dhpdevNew);
  3526. typedef ULONG_PTR (APIENTRY *PFN_DrvSaveScreenBits)(SURFOBJ *, ULONG, ULONG_PTR, RECTL *);
  3527. typedef ULONG (APIENTRY *PFN_DrvGetModes)(HANDLE, ULONG, DEVMODEW *);
  3528. typedef LONG (APIENTRY *PFN_DrvQueryTrueTypeTable)(ULONG_PTR, ULONG, ULONG, PTRDIFF, ULONG, BYTE *, PBYTE *, ULONG *);
  3529. typedef LONG (APIENTRY *PFN_DrvQueryTrueTypeSection)(ULONG, ULONG, ULONG, HANDLE *, PTRDIFF *);
  3530. typedef LONG (APIENTRY *PFN_DrvQueryTrueTypeOutline)(DHPDEV, FONTOBJ *, HGLYPH, BOOL, GLYPHDATA *, ULONG, TTPOLYGONHEADER *);
  3531. typedef PVOID (APIENTRY *PFN_DrvGetTrueTypeFile)(ULONG_PTR, ULONG *);
  3532. typedef LONG (APIENTRY *PFN_DrvQueryFontFile)(ULONG_PTR, ULONG, ULONG, ULONG *);
  3533. typedef PFD_GLYPHATTR (APIENTRY *PFN_DrvQueryGlyphAttrs)(FONTOBJ *, ULONG );
  3534. typedef BOOL (APIENTRY *PFN_DrvQueryAdvanceWidths)(DHPDEV,FONTOBJ *,ULONG,HGLYPH *,PVOID,ULONG);
  3535. typedef ULONG (APIENTRY *PFN_DrvFontManagement)(SURFOBJ *,FONTOBJ *,ULONG,ULONG,PVOID,ULONG,PVOID);
  3536. typedef BOOL (APIENTRY *PFN_DrvSetPixelFormat)(SURFOBJ *,LONG,HWND);
  3537. typedef LONG (APIENTRY *PFN_DrvDescribePixelFormat)(DHPDEV,LONG,ULONG,PIXELFORMATDESCRIPTOR *);
  3538. typedef BOOL (APIENTRY *PFN_DrvSwapBuffers)(SURFOBJ *, WNDOBJ *);
  3539. typedef BOOL (APIENTRY *PFN_DrvStartBanding)(SURFOBJ *, POINTL *ppointl);
  3540. typedef BOOL (APIENTRY *PFN_DrvNextBand)(SURFOBJ *, POINTL *ppointl);
  3541. typedef BOOL (APIENTRY *PFN_DrvQueryPerBandInfo)(SURFOBJ *,PERBANDINFO *);
  3542. typedef BOOL (APIENTRY *PFN_DrvEnableDirectDraw)(DHPDEV, DD_CALLBACKS *,DD_SURFACECALLBACKS *, DD_PALETTECALLBACKS *);
  3543. typedef VOID (APIENTRY *PFN_DrvDisableDirectDraw)(DHPDEV);
  3544. typedef BOOL (APIENTRY *PFN_DrvGetDirectDrawInfo)(DHPDEV, DD_HALINFO *, DWORD *, VIDEOMEMORY *, DWORD *, DWORD *);
  3545. typedef HANDLE (APIENTRY *PFN_DrvIcmCreateColorTransform)(DHPDEV,LPLOGCOLORSPACEW,LPVOID,ULONG,LPVOID,ULONG,LPVOID,ULONG,DWORD);
  3546. typedef BOOL (APIENTRY *PFN_DrvIcmDeleteColorTransform)(DHPDEV,HANDLE);
  3547. typedef BOOL (APIENTRY *PFN_DrvIcmCheckBitmapBits)(DHPDEV,HANDLE,SURFOBJ *,PBYTE);
  3548. typedef BOOL (APIENTRY *PFN_DrvIcmSetDeviceGammaRamp)(DHPDEV,ULONG,LPVOID);
  3549. typedef BOOL (APIENTRY *PFN_DrvAlphaBlend)(SURFOBJ*,SURFOBJ*,CLIPOBJ*,XLATEOBJ*,PRECTL,PRECTL,BLENDOBJ *);
  3550. typedef BOOL (APIENTRY *PFN_DrvGradientFill)(SURFOBJ*,CLIPOBJ*,XLATEOBJ*,TRIVERTEX*,ULONG,PVOID,ULONG,RECTL *,POINTL *,ULONG);
  3551. typedef BOOL (APIENTRY *PFN_DrvQueryDeviceSupport)(SURFOBJ*,XLATEOBJ*,XFORMOBJ*,ULONG,ULONG,PVOID,ULONG,PVOID);
  3552. typedef HBITMAP (APIENTRY *PFN_DrvDeriveSurface)(DD_DIRECTDRAW_GLOBAL*,DD_SURFACE_LOCAL*);
  3553. typedef VOID (APIENTRY *PFN_DrvSynchronizeSurface)(SURFOBJ*, RECTL*, FLONG);
  3554. typedef VOID (APIENTRY *PFN_DrvNotify)(SURFOBJ*, ULONG, PVOID);
  3555. #ifdef __cplusplus
  3556. } // extern "C"
  3557. #endif
  3558. #endif // _WINDDI_