1 
2 /***********************************************************************\
3 *                                wingdi.d                               *
4 *                                                                       *
5 *                       Windows API header module                       *
6 *                                                                       *
7 *                 Translated from MinGW Windows headers                 *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module win32.wingdi;
12 pragma(lib, "gdi32.lib");
13 
14 // FIXME: clean up Windows version support
15 
16 private import win32.w32api, win32.windef, win32.winver;
17 
18 // BITMAPINFOHEADER.biCompression
19 enum : DWORD {
20     BI_RGB = 0,
21     BI_RLE8,
22     BI_RLE4,
23     BI_BITFIELDS,
24     BI_JPEG,
25     BI_PNG
26 }
27 
28 // ---
29 // COLORADJUSTMENT -- only for NT 3.1+, Win2000+
30 const WORD
31 CA_NEGATIVE   = 1,
32 CA_LOG_FILTER = 2;
33 
34 // COLORADJUSTMENT
35 enum : WORD  {
36     ILLUMINANT_DEVICE_DEFAULT = 0,
37     ILLUMINANT_A,
38     ILLUMINANT_B,
39     ILLUMINANT_C,
40     ILLUMINANT_D50,
41     ILLUMINANT_D55,
42     ILLUMINANT_D65,
43     ILLUMINANT_D75,
44     ILLUMINANT_F2,
45     ILLUMINANT_MAX_INDEX   = ILLUMINANT_F2,
46     ILLUMINANT_TUNGSTEN    = ILLUMINANT_A,
47     ILLUMINANT_DAYLIGHT    = ILLUMINANT_C,
48     ILLUMINANT_FLUORESCENT = ILLUMINANT_F2,
49     ILLUMINANT_NTSC        = ILLUMINANT_C
50 }
51 
52 enum {
53     RGB_GAMMA_MIN       = 2500,
54     RGB_GAMMA_MAX       = 65000,
55     REFERENCE_WHITE_MIN = 6000,
56     REFERENCE_WHITE_MAX = 10000,
57     REFERENCE_BLACK_MIN = 0,
58     REFERENCE_BLACK_MAX = 4000,
59     COLOR_ADJ_MIN       = -100,
60     COLOR_ADJ_MAX       = 100,
61 }
62 
63 // ---
64 
65 /* FIXME: move to win32.winuser ? */
66 
67 // DrawIconEx()
68 enum : UINT {
69     DI_MASK        = 1,
70     DI_IMAGE       = 2,
71     DI_NORMAL      = 3,
72     DI_COMPAT      = 4,
73     DI_DEFAULTSIZE = 8
74 }
75 
76 // DOCINFO
77 enum : DWORD {
78     DI_APPBANDING = 1,
79     DI_ROPS_READ_DESTINATION = 2,
80 }
81 
82 // ENHMETAHEADER
83 enum : DWORD {
84     EMR_HEADER = 1,
85     EMR_POLYBEZIER,
86     EMR_POLYGON,
87     EMR_POLYLINE,
88     EMR_POLYBEZIERTO,
89     EMR_POLYLINETO,
90     EMR_POLYPOLYLINE,
91     EMR_POLYPOLYGON,
92     EMR_SETWINDOWEXTEX,
93     EMR_SETWINDOWORGEX,
94     EMR_SETVIEWPORTEXTEX,
95     EMR_SETVIEWPORTORGEX,
96     EMR_SETBRUSHORGEX,
97     EMR_EOF,
98     EMR_SETPIXELV,
99     EMR_SETMAPPERFLAGS,
100     EMR_SETMAPMODE,
101     EMR_SETBKMODE,
102     EMR_SETPOLYFILLMODE,
103     EMR_SETROP2,
104     EMR_SETSTRETCHBLTMODE,
105     EMR_SETTEXTALIGN,
106     EMR_SETCOLORADJUSTMENT,
107     EMR_SETTEXTCOLOR,
108     EMR_SETBKCOLOR,
109     EMR_OFFSETCLIPRGN,
110     EMR_MOVETOEX,
111     EMR_SETMETARGN,
112     EMR_EXCLUDECLIPRECT,
113     EMR_INTERSECTCLIPRECT,
114     EMR_SCALEVIEWPORTEXTEX,
115     EMR_SCALEWINDOWEXTEX,
116     EMR_SAVEDC,
117     EMR_RESTOREDC,
118     EMR_SETWORLDTRANSFORM,
119     EMR_MODIFYWORLDTRANSFORM,
120     EMR_SELECTOBJECT,
121     EMR_CREATEPEN,
122     EMR_CREATEBRUSHINDIRECT,
123     EMR_DELETEOBJECT,
124     EMR_ANGLEARC,
125     EMR_ELLIPSE,
126     EMR_RECTANGLE,
127     EMR_ROUNDRECT,
128     EMR_ARC,
129     EMR_CHORD,
130     EMR_PIE,
131     EMR_SELECTPALETTE,
132     EMR_CREATEPALETTE,
133     EMR_SETPALETTEENTRIES,
134     EMR_RESIZEPALETTE,
135     EMR_REALIZEPALETTE,
136     EMR_EXTFLOODFILL,
137     EMR_LINETO,
138     EMR_ARCTO,
139     EMR_POLYDRAW,
140     EMR_SETARCDIRECTION,
141     EMR_SETMITERLIMIT,
142     EMR_BEGINPATH,
143     EMR_ENDPATH,
144     EMR_CLOSEFIGURE,
145     EMR_FILLPATH,
146     EMR_STROKEANDFILLPATH,
147     EMR_STROKEPATH,
148     EMR_FLATTENPATH,
149     EMR_WIDENPATH,
150     EMR_SELECTCLIPPATH,
151     EMR_ABORTPATH,     // 68
152     // reserved 69
153     EMR_GDICOMMENT = 70,
154     EMR_FILLRGN,
155     EMR_FRAMERGN,
156     EMR_INVERTRGN,
157     EMR_PAINTRGN,
158     EMR_EXTSELECTCLIPRGN,
159     EMR_BITBLT,
160     EMR_STRETCHBLT,
161     EMR_MASKBLT,
162     EMR_PLGBLT,
163     EMR_SETDIBITSTODEVICE,
164     EMR_STRETCHDIBITS,
165     EMR_EXTCREATEFONTINDIRECTW,
166     EMR_EXTTEXTOUTA,
167     EMR_EXTTEXTOUTW,
168     EMR_POLYBEZIER16,
169     EMR_POLYGON16,
170     EMR_POLYLINE16,
171     EMR_POLYBEZIERTO16,
172     EMR_POLYLINETO16,
173     EMR_POLYPOLYLINE16,
174     EMR_POLYPOLYGON16,
175     EMR_POLYDRAW16,
176     EMR_CREATEMONOBRUSH,
177     EMR_CREATEDIBPATTERNBRUSHPT,
178     EMR_EXTCREATEPEN,
179     EMR_POLYTEXTOUTA,
180     EMR_POLYTEXTOUTW,     // 97
181     EMR_SETICMMODE,
182     EMR_CREATECOLORSPACE,
183     EMR_SETCOLORSPACE,
184     EMR_DELETECOLORSPACE,
185     EMR_GLSRECORD,
186     EMR_GLSBOUNDEDRECORD,
187     EMR_PIXELFORMAT,     // = 104
188     // reserved 105 - 110
189     EMR_COLORCORRECTPALETTE = 111,
190     EMR_SETICMPROFILEA,
191     EMR_SETICMPROFILEW,
192     EMR_ALPHABLEND,
193     EMR_SETLAYOUT,
194     EMR_TRANSPARENTBLT,     // 116
195     // reserved 117
196     EMR_GRADIENTFILL = 118,
197 
198     // reserved 119, 120
199     EMR_COLORMATCHTOTARGETW = 121,
200     EMR_CREATECOLORSPACEW     // 122
201 }
202 
203 const EMR_MIN = EMR_HEADER;
204 
205 static
206 
207 if (WINVER >= 0x0500)
208     const EMR_MAX = EMR_CREATECOLORSPACEW;
209 else static
210 
211     if (WINVER >= 0x0400)
212         const EMR_MAX = EMR_PIXELFORMAT;
213     else
214         const EMR_MAX = EMR_POLYTEXTOUTW;
215 
216 // ENHMETAHEADER.dSignature, ENHMETAHEADER3.dSignature,
217 // EMRFORMAT.dSignature
218 enum : DWORD {
219     ENHMETA_SIGNATURE = 1179469088,
220     EPS_SIGNATURE     = 0x46535045
221 }
222 
223 static
224 
225 if (_WIN32_WINNT >= 0x0500)
226 {
227     // AddFontResourceEx()
228     enum : DWORD {
229         FR_PRIVATE  = 0x10,
230         FR_NOT_ENUM = 0x20
231     }
232 }
233 
234 enum {
235     META_SAVEDC = 0x1E,
236     META_REALIZEPALETTE        = 0x35,
237     META_SETPALENTRIES         = 0x37,
238     META_CREATEPALETTE         = 0xf7,
239     META_SETBKMODE             = 0x102,
240     META_SETMAPMODE            = 0x103,
241     META_SETROP2               = 0x104,
242     META_SETRELABS             = 0x105,
243     META_SETPOLYFILLMODE       = 0x106,
244     META_SETSTRETCHBLTMODE     = 0x107,
245     META_SETTEXTCHAREXTRA      = 0x108,
246     META_RESTOREDC             = 0x127,
247     META_INVERTREGION          = 0x12A,
248     META_PAINTREGION           = 0x12B,
249     META_SELECTCLIPREGION      = 0x12C,
250     META_SELECTOBJECT          = 0x12D,
251     META_SETTEXTALIGN          = 0x12E,
252     META_RESIZEPALETTE         = 0x139,
253     META_DIBCREATEPATTERNBRUSH = 0x142,
254     META_SETLAYOUT             = 0x149,
255     META_DELETEOBJECT          = 0x1F0,
256     META_CREATEPATTERNBRUSH    = 0x1F9,
257     META_SETBKCOLOR            = 0x201,
258     META_SETTEXTCOLOR          = 0x209,
259     META_SETTEXTJUSTIFICATION  = 0x20A,
260     META_SETWINDOWORG          = 0x20B,
261     META_SETWINDOWEXT          = 0x20C,
262     META_SETVIEWPORTORG        = 0x20D,
263     META_SETVIEWPORTEXT        = 0x20E,
264     META_OFFSETWINDOWORG       = 0x20F,
265     META_OFFSETVIEWPORTORG     = 0x211,
266     META_LINETO                = 0x213,
267     META_MOVETO                = 0x214,
268     META_OFFSETCLIPRGN         = 0x220,
269     META_FILLREGION            = 0x228,
270     META_SETMAPPERFLAGS        = 0x231,
271     META_SELECTPALETTE         = 0x234,
272     META_CREATEPENINDIRECT     = 0x2FA,
273     META_CREATEFONTINDIRECT    = 0x2FB,
274     META_CREATEBRUSHINDIRECT   = 0x2FC,
275     META_POLYGON               = 0x324,
276     META_POLYLINE              = 0x325,
277     META_SCALEWINDOWEXT        = 0x410,
278     META_SCALEVIEWPORTEXT      = 0x412,
279     META_EXCLUDECLIPRECT       = 0x415,
280     META_INTERSECTCLIPRECT     = 0x416,
281     META_ELLIPSE               = 0x418,
282     META_FLOODFILL             = 0x419,
283     META_RECTANGLE             = 0x41B,
284     META_SETPIXEL              = 0x41F,
285     META_FRAMEREGION           = 0x429,
286     META_ANIMATEPALETTE        = 0x436,
287     META_TEXTOUT               = 0x521,
288     META_POLYPOLYGON           = 0x538,
289     META_EXTFLOODFILL          = 0x548,
290     META_ROUNDRECT             = 0x61C,
291     META_PATBLT                = 0x61D,
292     META_ESCAPE                = 0x626,
293     META_CREATEREGION          = 0x6FF,
294     META_ARC                   = 0x817,
295     META_PIE                   = 0x81A,
296     META_CHORD                 = 0x830,
297     META_BITBLT                = 0x922,
298     META_DIBBITBLT             = 0x940,
299     META_EXTTEXTOUT            = 0xA32,
300     META_STRETCHBLT            = 0xB23,
301     META_DIBSTRETCHBLT         = 0xB41,
302     META_SETDIBTODEV           = 0xD33,
303     META_STRETCHDIB            = 0xF43
304 }
305 
306 // EMRPOLYDRAW
307 enum : BYTE {
308     PT_CLOSEFIGURE = 1,
309     PT_LINETO      = 2,
310     PT_BEZIERTO    = 4,
311     PT_MOVETO      = 6
312 }
313 
314 // ----
315 // PIXELFORMATDESCRIPTOR.iPixelType
316 enum : BYTE {
317     PFD_TYPE_RGBA       = 0,
318     PFD_TYPE_COLORINDEX = 1
319 }
320 
321 deprecated {
322     // PIXELFORMATDESCRIPTOR.
323     const byte
324     PFD_MAIN_PLANE     = 0,
325     PFD_OVERLAY_PLANE  = 1,
326     PFD_UNDERLAY_PLANE = -1;
327 }
328 
329 // PIXELFORMATDESCRIPTOR.dwFlags
330 const DWORD
331 PFD_DOUBLEBUFFER = 0x00000001,
332 PFD_STEREO = 0x00000002,
333 PFD_DRAW_TO_WINDOW      = 0x00000004,
334 PFD_DRAW_TO_BITMAP      = 0x00000008,
335 PFD_SUPPORT_GDI         = 0x00000010,
336 PFD_SUPPORT_OPENGL      = 0x00000020,
337 PFD_GENERIC_FORMAT      = 0x00000040,
338 PFD_NEED_PALETTE        = 0x00000080,
339 PFD_NEED_SYSTEM_PALETTE = 0x00000100,
340 PFD_SWAP_EXCHANGE       = 0x00000200,
341 PFD_SWAP_COPY           = 0x00000400,
342 PFD_SWAP_LAYER_BUFFERS  = 0x00000800,
343 PFD_GENERIC_ACCELERATED = 0x00001000,
344 PFD_SUPPORT_DIRECTDRAW  = 0x00002000,
345 
346 /* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
347 PFD_DEPTH_DONTCARE        = 0x20000000,
348 PFD_DOUBLEBUFFER_DONTCARE = 0x40000000,
349 PFD_STEREO_DONTCARE       = 0x80000000;
350 
351 // ----
352 
353 const DWORD
354 BLACKNESS   = 0x000042,
355 NOTSRCERASE = 0x1100A6,
356 NOTSRCCOPY  = 0x330008,
357 SRCERASE    = 0x440328,
358 DSTINVERT   = 0x550009,
359 PATINVERT   = 0x5A0049,
360 SRCINVERT   = 0x660046,
361 SRCAND      = 0x8800C6,
362 MERGEPAINT  = 0xBB0226,
363 MERGECOPY   = 0xC000CA,
364 SRCCOPY     = 0xCC0020,
365 SRCPAINT    = 0xEE0086,
366 PATCOPY     = 0xF00021,
367 PATPAINT    = 0xFB0A09,
368 WHITENESS   = 0xFF0062;
369 static
370 
371 if (WINVER >= 0x0500)
372 {
373     const DWORD
374     NOMIRRORBITMAP = 0x80000000,
375     CAPTUREBLT     = 0x40000000;
376 }
377 
378 // GetROP2(), SetROP2()
379 enum : int {
380     R2_BLACK       = 1,
381     R2_NOTMERGEPEN = 2,
382     R2_MASKNOTPEN  = 3,
383     R2_NOTCOPYPEN  = 4,
384     R2_MASKPENNOT  = 5,
385     R2_NOT         = 6,
386     R2_XORPEN      = 7,
387     R2_NOTMASKPEN  = 8,
388     R2_MASKPEN     = 9,
389     R2_NOTXORPEN   = 10,
390     R2_NOP         = 11,
391     R2_MERGENOTPEN = 12,
392     R2_COPYPEN     = 13,
393     R2_MERGEPENNOT = 14,
394     R2_MERGEPEN    = 15,
395     R2_WHITE       = 16
396 }
397 
398 const R2_LAST = R2_WHITE;
399 
400 // CheckColorsInGamut()
401 const ubyte
402 CM_IN_GAMUT     = 0,
403 CM_OUT_OF_GAMUT = 255;
404 
405 /* UpdateICMRegKey Constants               */
406 const int
407 ICM_ADDPROFILE          = 1,
408 ICM_DELETEPROFILE       = 2,
409 ICM_QUERYPROFILE        = 3,
410 ICM_SETDEFAULTPROFILE   = 4,
411 ICM_REGISTERICMATCHER   = 5,
412 ICM_UNREGISTERICMATCHER = 6,
413 ICM_QUERYMATCH          = 7;
414 
415 enum : int {
416     RGN_AND  = 1,
417     RGN_OR   = 2,
418     RGN_XOR  = 3,
419     RGN_DIFF = 4,
420     RGN_COPY = 5
421 }
422 
423 const RGN_MIN = RGN_AND;
424 const RGN_MAX = RGN_COPY;
425 
426 // Return values for CombineRgn()
427 enum {
428     NULLREGION    = 1,
429     SIMPLEREGION  = 2,
430     COMPLEXREGION = 3
431 }
432 
433 const ERROR = 0;
434 alias ERROR RGN_ERROR;
435 
436 // CreateDIBitmap()
437 const DWORD CBM_INIT = 4;
438 
439 // CreateDIBitmap()
440 enum : UINT {
441     DIB_RGB_COLORS = 0,
442     DIB_PAL_COLORS = 1
443 }
444 
445 // ---
446 //  Values for LOGFONT and CreateFont()
447 
448 // FIXME: For D, replace with lfFaceName.length()
449 const LF_FACESIZE     = 32;
450 const LF_FULLFACESIZE = 64;
451 
452 // FIXME: Not needed for D, only EXTLOGFONT
453 const ELF_VENDOR_SIZE = 4;
454 
455 // ???
456 const ELF_VERSION       = 0;
457 const ELF_CULTURE_LATIN = 0;
458 
459 // LOGFONT.lfWeight
460 const LONG
461 FW_DONTCARE   = 0,
462 FW_THIN       = 100,
463 FW_EXTRALIGHT = 200,
464 FW_ULTRALIGHT = FW_EXTRALIGHT,
465 FW_LIGHT      = 300,
466 FW_NORMAL     = 400,
467 FW_REGULAR    = FW_NORMAL,
468 FW_MEDIUM     = 500,
469 FW_SEMIBOLD   = 600,
470 FW_DEMIBOLD   = FW_SEMIBOLD,
471 FW_BOLD       = 700,
472 FW_EXTRABOLD  = 800,
473 FW_ULTRABOLD  = FW_EXTRABOLD,
474 FW_HEAVY      = 900,
475 FW_BLACK      = FW_HEAVY;
476 
477 // LOGFONT.lfCharSet
478 enum : DWORD {
479     ANSI_CHARSET        = 0,
480     DEFAULT_CHARSET     = 1,
481     SYMBOL_CHARSET      = 2,
482     MAC_CHARSET         = 77,
483     SHIFTJIS_CHARSET    = 128,
484     HANGEUL_CHARSET     = 129,
485     HANGUL_CHARSET      = 129,
486     JOHAB_CHARSET       = 130,
487     GB2312_CHARSET      = 134,
488     CHINESEBIG5_CHARSET = 136,
489     GREEK_CHARSET       = 161,
490     TURKISH_CHARSET     = 162,
491     VIETNAMESE_CHARSET  = 163,
492     HEBREW_CHARSET      = 177,
493     ARABIC_CHARSET      = 178,
494     BALTIC_CHARSET      = 186,
495     RUSSIAN_CHARSET     = 204,
496     THAI_CHARSET        = 222,
497     EASTEUROPE_CHARSET  = 238,
498     OEM_CHARSET         = 255
499 }
500 
501 // LOGFONT.lfOutPrecision
502 enum : BYTE {
503     OUT_DEFAULT_PRECIS = 0,
504     OUT_STRING_PRECIS,
505     OUT_CHARACTER_PRECIS,
506     OUT_STROKE_PRECIS,
507     OUT_TT_PRECIS,
508     OUT_DEVICE_PRECIS,
509     OUT_RASTER_PRECIS,
510     OUT_TT_ONLY_PRECIS,
511     OUT_OUTLINE_PRECIS,
512     OUT_SCREEN_OUTLINE_PRECIS,
513     OUT_PS_ONLY_PRECIS,     // 10
514 }
515 
516 // LOGFONT.lfClipPrecision
517 enum : BYTE  {
518     CLIP_DEFAULT_PRECIS   = 0,
519     CLIP_CHARACTER_PRECIS = 1,
520     CLIP_STROKE_PRECIS    = 2,
521     CLIP_MASK             = 15,
522     CLIP_LH_ANGLES        = 16,
523     CLIP_TT_ALWAYS        = 32,
524     CLIP_DFA_DISABLE      = 64,
525     CLIP_EMBEDDED         = 128
526 }
527 
528 // LOGFONT.lfQuality
529 enum : BYTE {
530     DEFAULT_QUALITY = 0,
531     DRAFT_QUALITY,
532     PROOF_QUALITY,
533     NONANTIALIASED_QUALITY,
534     ANTIALIASED_QUALITY
535 }
536 
537 // LOGFONT.lfPitchAndFamily
538 
539 const BYTE
540 DEFAULT_PITCH  = 0,
541 FIXED_PITCH    = 1,
542 VARIABLE_PITCH = 2,
543 MONO_FONT      = 8,
544 FF_DONTCARE    = 0,
545 FF_ROMAN       = 16,
546 FF_SWISS       = 32,
547 FF_SCRIPT      = 64,
548 FF_MODERN      = 48,
549 FF_DECORATIVE  = 80;
550 
551 // ----
552 // Enums for the PANOSE struct
553 
554 const PANOSE_COUNT=10;
555 
556 enum {
557     PAN_FAMILYTYPE_INDEX = 0,
558     PAN_SERIFSTYLE_INDEX,
559     PAN_WEIGHT_INDEX,
560     PAN_PROPORTION_INDEX,
561     PAN_CONTRAST_INDEX,
562     PAN_STROKEVARIATION_INDEX,
563     PAN_ARMSTYLE_INDEX,
564     PAN_LETTERFORM_INDEX,
565     PAN_MIDLINE_INDEX,
566     PAN_XHEIGHT_INDEX
567 }
568 
569 const PAN_CULTURE_LATIN=0;
570 
571 // NOTE: the first two values (PAN_ANY and PAN_NO_FIT) apply to all these enums!
572 enum : BYTE {
573     PAN_ANY    = 0,
574     PAN_NO_FIT = 1,
575 }
576 
577 enum : BYTE {
578     PAN_FAMILY_TEXT_DISPLAY = 2,
579     PAN_FAMILY_SCRIPT,
580     PAN_FAMILY_DECORATIVE,
581     PAN_FAMILY_PICTORIAL
582 }
583 enum : BYTE {
584     PAN_SERIF_COVE = 2,
585     PAN_SERIF_OBTUSE_COVE,
586     PAN_SERIF_SQUARE_COVE,
587     PAN_SERIF_OBTUSE_SQUARE_COVE,
588     PAN_SERIF_SQUARE,
589     PAN_SERIF_THIN,
590     PAN_SERIF_BONE,
591     PAN_SERIF_EXAGGERATED,
592     PAN_SERIF_TRIANGLE,
593     PAN_SERIF_NORMAL_SANS,
594     PAN_SERIF_OBTUSE_SANS,
595     PAN_SERIF_PERP_SANS,
596     PAN_SERIF_FLARED,
597     PAN_SERIF_ROUNDED
598 }
599 
600 enum : BYTE {
601     PAN_WEIGHT_VERY_LIGHT = 2,
602     PAN_WEIGHT_LIGHT,
603     PAN_WEIGHT_THIN,
604     PAN_WEIGHT_BOOK,
605     PAN_WEIGHT_MEDIUM,
606     PAN_WEIGHT_DEMI,
607     PAN_WEIGHT_BOLD,
608     PAN_WEIGHT_HEAVY,
609     PAN_WEIGHT_BLACK,
610     PAN_WEIGHT_NORD
611 }
612 
613 enum : BYTE {
614     PAN_PROP_OLD_STYLE = 2,
615     PAN_PROP_MODERN,
616     PAN_PROP_EVEN_WIDTH,
617     PAN_PROP_EXPANDED,
618     PAN_PROP_CONDENSED,
619     PAN_PROP_VERY_EXPANDED,
620     PAN_PROP_VERY_CONDENSED,
621     PAN_PROP_MONOSPACED
622 }
623 
624 enum : BYTE {
625     PAN_CONTRAST_NONE = 2,
626     PAN_CONTRAST_VERY_LOW,
627     PAN_CONTRAST_LOW,
628     PAN_CONTRAST_MEDIUM_LOW,
629     PAN_CONTRAST_MEDIUM,
630     PAN_CONTRAST_MEDIUM_HIGH,
631     PAN_CONTRAST_HIGH,
632     PAN_CONTRAST_VERY_HIGH
633 }
634 
635 // PANOSE.bStrokeVariation
636 enum : BYTE {
637     PAN_STROKE_GRADUAL_DIAG = 2,
638     PAN_STROKE_GRADUAL_TRAN,
639     PAN_STROKE_GRADUAL_VERT,
640     PAN_STROKE_GRADUAL_HORZ,
641     PAN_STROKE_RAPID_VERT,
642     PAN_STROKE_RAPID_HORZ,
643     PAN_STROKE_INSTANT_VERT
644 }
645 
646 // PANOSE.bArmStyle
647 enum : BYTE {
648     PAN_STRAIGHT_ARMS_HORZ = 2,
649     PAN_STRAIGHT_ARMS_WEDGE,
650     PAN_STRAIGHT_ARMS_VERT,
651     PAN_STRAIGHT_ARMS_SINGLE_SERIF,
652     PAN_STRAIGHT_ARMS_DOUBLE_SERIF,
653     PAN_BENT_ARMS_HORZ,
654     PAN_BENT_ARMS_WEDGE,
655     PAN_BENT_ARMS_VERT,
656     PAN_BENT_ARMS_SINGLE_SERIF,
657     PAN_BENT_ARMS_DOUBLE_SERIF
658 }
659 
660 // PANOSE.bLetterForm
661 enum : BYTE {
662     PAN_LETT_NORMAL_CONTACT = 2,
663     PAN_LETT_NORMAL_WEIGHTED,
664     PAN_LETT_NORMAL_BOXED,
665     PAN_LETT_NORMAL_FLATTENED,
666     PAN_LETT_NORMAL_ROUNDED,
667     PAN_LETT_NORMAL_OFF_CENTER,
668     PAN_LETT_NORMAL_SQUARE,
669     PAN_LETT_OBLIQUE_CONTACT,
670     PAN_LETT_OBLIQUE_WEIGHTED,
671     PAN_LETT_OBLIQUE_BOXED,
672     PAN_LETT_OBLIQUE_FLATTENED,
673     PAN_LETT_OBLIQUE_ROUNDED,
674     PAN_LETT_OBLIQUE_OFF_CENTER,
675     PAN_LETT_OBLIQUE_SQUARE
676 }
677 
678 // PANOSE.bMidLine
679 enum : BYTE {
680     PAN_MIDLINE_STANDARD_TRIMMED = 2,
681     PAN_MIDLINE_STANDARD_POINTED,
682     PAN_MIDLINE_STANDARD_SERIFED,
683     PAN_MIDLINE_HIGH_TRIMMED,
684     PAN_MIDLINE_HIGH_POINTED,
685     PAN_MIDLINE_HIGH_SERIFED,
686     PAN_MIDLINE_CONSTANT_TRIMMED,
687     PAN_MIDLINE_CONSTANT_POINTED,
688     PAN_MIDLINE_CONSTANT_SERIFED,
689     PAN_MIDLINE_LOW_TRIMMED,
690     PAN_MIDLINE_LOW_POINTED,
691     PAN_MIDLINE_LOW_SERIFED
692 }
693 
694 // PANOSE.bXHeight
695 enum : BYTE {
696     PAN_XHEIGHT_CONSTANT_SMALL = 2,
697     PAN_XHEIGHT_CONSTANT_STD,
698     PAN_XHEIGHT_CONSTANT_LARGE,
699     PAN_XHEIGHT_DUCKING_SMALL,
700     PAN_XHEIGHT_DUCKING_STD,
701     PAN_XHEIGHT_DUCKING_LARGE
702 }
703 
704 // ----
705 // ???
706 const FS_LATIN1      = 0x00000001;
707 const FS_LATIN2      = 0x00000002;
708 const FS_CYRILLIC    = 0x00000004;
709 const FS_GREEK       = 0x00000008;
710 const FS_TURKISH     = 0x00000010;
711 const FS_HEBREW      = 0x00000020;
712 const FS_ARABIC      = 0x00000040;
713 const FS_BALTIC      = 0x00000080;
714 const FS_VIETNAMESE  = 0x00000100;
715 const FS_THAI        = 0x00010000;
716 const FS_JISJAPAN    = 0x00020000;
717 const FS_CHINESESIMP = 0x00040000;
718 const FS_WANSUNG     = 0x00080000;
719 const FS_CHINESETRAD = 0x00100000;
720 const FS_JOHAB       = 0x00200000;
721 const FS_SYMBOL      = 0x80000000;
722 
723 // ----
724 // Poly Fill Mode
725 enum : int {
726     ALTERNATE = 1,
727     WINDING   = 2
728 }
729 const int POLYFILL_LAST = WINDING;
730 
731 // ---
732 // LOGBRUSH
733 enum : LONG {
734     HS_HORIZONTAL = 0,
735     HS_VERTICAL,
736     HS_FDIAGONAL,
737     HS_BDIAGONAL,
738     HS_CROSS,
739     HS_DIAGCROSS
740 }
741 
742 // LOGBRUSH.lbStyle
743 enum : UINT {
744     BS_SOLID  = 0,
745     BS_NULL   = 1,
746     BS_HOLLOW = BS_NULL,
747     BS_HATCHED,
748     BS_PATTERN,
749     BS_INDEXED,
750     BS_DIBPATTERN,
751     BS_DIBPATTERNPT,
752     BS_PATTERN8X8,
753     BS_DIBPATTERN8X8,
754     BS_MONOPATTERN,
755 }
756 
757 // -----
758 // EXTLOGPEN, ExtCreatePen()
759 
760 // EXTLOGPEN.elpPenStyle
761 enum : DWORD {
762     PS_SOLID       = 0,
763     PS_DASH        = 1,
764     PS_DOT         = 2,
765     PS_DASHDOT     = 3,
766     PS_DASHDOTDOT  = 4,
767     PS_NULL        = 5,
768     PS_INSIDEFRAME = 6,
769     PS_USERSTYLE   = 7,
770     PS_ALTERNATE   = 8,
771     PS_STYLE_MASK  = 15,
772 }
773 
774 enum : DWORD {
775     PS_COSMETIC  = 0x00000000,
776     PS_GEOMETRIC = 0x00010000,
777     PS_TYPE_MASK = 0x000F0000,
778 }
779 enum : DWORD {
780     PS_ENDCAP_ROUND  = 0x00000000,
781     PS_ENDCAP_SQUARE = 0x00000100,
782     PS_ENDCAP_FLAT   = 0x00000200,
783     PS_ENDCAP_MASK   = 0x00000F00,
784 }
785 enum : DWORD {
786     PS_JOIN_ROUND = 0x00000000,
787     PS_JOIN_BEVEL = 0x00001000,
788     PS_JOIN_MITER = 0x00002000,
789     PS_JOIN_MASK  = 0x0000F000,
790 }
791 
792 // ---
793 // DeviceCapabilities()
794 
795 enum : WORD {
796     DC_FIELDS = 1,
797     DC_PAPERS,
798     DC_PAPERSIZE,
799     DC_MINEXTENT,
800     DC_MAXEXTENT,
801     DC_BINS,
802     DC_DUPLEX,
803     DC_SIZE,
804     DC_EXTRA,
805     DC_VERSION,
806     DC_DRIVER,
807     DC_BINNAMES,
808     DC_ENUMRESOLUTIONS,
809     DC_FILEDEPENDENCIES,
810     DC_TRUETYPE,
811     DC_PAPERNAMES,
812     DC_ORIENTATION,
813     DC_COPIES,
814     DC_BINADJUST,
815     DC_EMF_COMPLIANT,
816     DC_DATATYPE_PRODUCED,
817     DC_COLLATE,
818     DC_MANUFACTURER,
819     DC_MODEL,
820 }
821 
822 static
823 
824 if (WINVER >= 0x0500)
825 {
826     enum {
827         DC_PERSONALITY   = 25,
828         DC_PRINTRATE     = 26,
829         DC_PRINTRATEUNIT = 27,
830         DC_PRINTERMEM    = 28,
831         DC_MEDIAREADY    = 29,
832         DC_STAPLE        = 30,
833         DC_PRINTRATEPPM  = 31,
834         DC_COLORDEVICE   = 32,
835         DC_NUP = 33,
836         DC_MEDIATYPENAMES = 34,
837         DC_MEDIATYPES     = 35,
838     }
839     enum {
840         PRINTRATEUNIT_PPM = 1,
841         PRINTRATEUNIT_CPS = 2,
842         PRINTRATEUNIT_LPM = 3,
843         PRINTRATEUNIT_IPM = 4,
844     }
845 }
846 
847 // return from DC_TRUETYPE
848 const DWORD
849 DCTT_BITMAP = 1,
850 DCTT_DOWNLOAD         = 2,
851 DCTT_SUBDEV           = 4,
852 DCTT_DOWNLOAD_OUTLINE = 8;
853 
854 static
855 
856 if (WINVER >= 0x0400)
857 {
858     // return from DC_BINADJUST
859     enum : DWORD {
860         DCBA_FACEUPNONE     = 0x0000,
861         DCBA_FACEUPCENTER   = 0x0001,
862         DCBA_FACEUPLEFT     = 0x0002,
863         DCBA_FACEUPRIGHT    = 0x0003,
864         DCBA_FACEDOWNNONE   = 0x0100,
865         DCBA_FACEDOWNCENTER = 0x0101,
866         DCBA_FACEDOWNLEFT   = 0x0102,
867         DCBA_FACEDOWNRIGHT  = 0x0103,
868     }
869 }
870 
871 // ---
872 
873 const FLOODFILLBORDER  = 0;
874 const FLOODFILLSURFACE = 1;
875 
876 // ExtTextOut()
877 const UINT
878 ETO_OPAQUE         = 0x0002,
879 ETO_CLIPPED        = 0x0004,
880 ETO_GLYPH_INDEX    = 0x0010,
881 ETO_RTLREADING     = 0x0080,
882 ETO_NUMERICSLOCAL  = 0x0400,
883 ETO_NUMERICSLATIN  = 0x0800,
884 ETO_IGNORELANGUAGE = 0x1000;
885 static
886 
887 if (_WIN32_WINNT >= 0x0500)
888 {
889     const UINT
890     ETO_PDY = 0x2000;
891 }
892 
893 // GdiComment()
894 enum {
895     GDICOMMENT_BEGINGROUP       = 0x00000002,
896     GDICOMMENT_ENDGROUP         = 0x00000003,
897     GDICOMMENT_UNICODE_STRING   = 0x00000040,
898     GDICOMMENT_UNICODE_END      = 0x00000080,
899     GDICOMMENT_MULTIFORMATS     = 0x40000004,
900     GDICOMMENT_IDENTIFIER       = 0x43494447,
901     GDICOMMENT_WINDOWS_METAFILE = 0x80000001,
902 }
903 
904 // Get/SetArcDirection()
905 enum : int {
906     AD_COUNTERCLOCKWISE = 1,
907     AD_CLOCKWISE        = 2
908 }
909 
910 const RDH_RECTANGLES = 1;
911 
912 // GCPRESULTS.lpClass
913 enum {
914     GCPCLASS_LATIN  = 1,
915     GCPCLASS_HEBREW = 2,
916     GCPCLASS_ARABIC = 2,
917     GCPCLASS_NEUTRAL,
918     GCPCLASS_LOCALNUMBER,
919     GCPCLASS_LATINNUMBER,
920     GCPCLASS_LATINNUMERICTERMINATOR,
921     GCPCLASS_LATINNUMERICSEPARATOR,
922     GCPCLASS_NUMERICSEPARATOR,     // = 8,
923     GCPCLASS_POSTBOUNDRTL = 16,
924     GCPCLASS_POSTBOUNDLTR = 32,
925     GCPCLASS_PREBOUNDRTL  = 64,
926     GCPCLASS_PREBOUNDLTR  = 128,
927     GCPGLYPH_LINKAFTER    = 0x4000,
928     GCPGLYPH_LINKBEFORE   = 0x8000
929 }
930 
931 // GetBoundsRect(), SetBoundsRect()
932 const UINT
933 DCB_RESET      = 1,
934 DCB_ACCUMULATE = 2,
935 DCB_SET        = DCB_RESET | DCB_ACCUMULATE,
936 DCB_ENABLE     = 4,
937 DCB_DISABLE    = 8,
938 DCB_DIRTY      = DCB_ACCUMULATE;
939 
940 // ---
941 // GetObjectType()
942 enum : DWORD {
943     OBJ_PEN = 1,
944     OBJ_BRUSH,
945     OBJ_DC,
946     OBJ_METADC,
947     OBJ_PAL,
948     OBJ_FONT,
949     OBJ_BITMAP,
950     OBJ_REGION,
951     OBJ_METAFILE,
952     OBJ_MEMDC,
953     OBJ_EXTPEN,
954     OBJ_ENHMETADC,
955     OBJ_ENHMETAFILE,
956     OBJ_COLORSPACE,
957 }
958 
959 // ---------------------
960 // Capabilities for GetDeviceCaps(dc, xxx)
961 
962 enum : int {
963     DRIVERVERSION   = 0,
964     TECHNOLOGY      = 2,
965     HORZSIZE        = 4,
966     VERTSIZE        = 6,
967     HORZRES         = 8,
968     VERTRES         = 10,
969     BITSPIXEL       = 12,
970     PLANES          = 14,
971     NUMBRUSHES      = 16,
972     NUMPENS         = 18,
973     NUMMARKERS      = 20,
974     NUMFONTS        = 22,
975     NUMCOLORS       = 24,
976     PDEVICESIZE     = 26,
977     CURVECAPS       = 28,
978     LINECAPS        = 30,
979     POLYGONALCAPS   = 32,
980     TEXTCAPS        = 34,
981     CLIPCAPS        = 36,
982     RASTERCAPS      = 38,
983     ASPECTX         = 40,
984     ASPECTY         = 42,
985     ASPECTXY        = 44,
986     LOGPIXELSX      = 88,
987     LOGPIXELSY      = 90,
988     SIZEPALETTE     = 104,
989     NUMRESERVED     = 106,
990     COLORRES        = 108,
991     PHYSICALWIDTH   = 110,
992     PHYSICALHEIGHT  = 111,
993     PHYSICALOFFSETX = 112,
994     PHYSICALOFFSETY = 113,
995     SCALINGFACTORX  = 114,
996     SCALINGFACTORY  = 115,
997     VREFRESH        = 116,
998     DESKTOPVERTRES  = 117,
999     DESKTOPHORZRES  = 118,
1000     BLTALIGNMENT    = 119
1001 }
1002 static
1003 
1004 if (WINVER >= 0x0500)
1005 {
1006     int
1007     SHADEBLENDCAPS = 120,
1008     COLORMGMTCAPS  = 121;
1009 }
1010 
1011 // Return values for GetDeviceCaps(dc, TECHNOLOGY)
1012 enum : int {
1013     DT_PLOTTER = 0,
1014     DT_RASDISPLAY,
1015     DT_RASPRINTER,
1016     DT_RASCAMERA,
1017     DT_CHARSTREAM,
1018     DT_METAFILE,
1019     DT_DISPFILE     // = 6
1020 }
1021 
1022 // Return values for GetDeviceCaps(dc, RASTERCAPS)
1023 const int
1024 RC_NONE         = 0,
1025 RC_BITBLT       = 1,
1026 RC_BANDING      = 2,
1027 RC_SCALING      = 4,
1028 RC_BITMAP64     = 8,
1029 RC_GDI20_OUTPUT = 16,
1030 RC_GDI20_STATE  = 32,
1031 RC_SAVEBITMAP   = 64,
1032 RC_DI_BITMAP    = 128,
1033 RC_PALETTE      = 256,
1034 RC_DIBTODEV     = 512,
1035 RC_BIGFONT      = 1024,
1036 RC_STRETCHBLT   = 2048,
1037 RC_FLOODFILL    = 4096,
1038 RC_STRETCHDIB   = 8192,
1039 RC_OP_DX_OUTPUT = 0x4000,
1040 RC_DEVBITS      = 0x8000;
1041 
1042 static
1043 
1044 if (WINVER >= 0x0500)
1045 {
1046     /* Shading and blending caps */
1047     const SB_NONE          = 0x00000000;
1048     const SB_CONST_ALPHA   = 0x00000001;
1049     const SB_PIXEL_ALPHA   = 0x00000002;
1050     const SB_PREMULT_ALPHA = 0x00000004;
1051     const SB_GRAD_RECT     = 0x00000010;
1052     const SB_GRAD_TRI      = 0x00000020;
1053 
1054     /* Color Management caps */
1055     const CM_NONE       = 0x00000000;
1056     const CM_DEVICE_ICM = 0x00000001;
1057     const CM_GAMMA_RAMP = 0x00000002;
1058     const CM_CMYK_COLOR = 0x00000004;
1059 }
1060 
1061 // Return values for GetDeviceCaps(dc, CURVECAPS)
1062 const int
1063 CC_NONE       = 0,
1064 CC_CIRCLES    = 1,
1065 CC_PIE        = 2,
1066 CC_CHORD      = 4,
1067 CC_ELLIPSES   = 8,
1068 CC_WIDE       = 16,
1069 CC_STYLED     = 32,
1070 CC_WIDESTYLED = 64,
1071 CC_INTERIORS  = 128,
1072 CC_ROUNDRECT  = 256;
1073 
1074 // Return values for GetDeviceCaps(dc, LINECAPS)
1075 
1076 const int
1077 LC_NONE       = 0,
1078 LC_POLYLINE   = 2,
1079 LC_MARKER     = 4,
1080 LC_POLYMARKER = 8,
1081 LC_WIDE       = 16,
1082 LC_STYLED     = 32,
1083 LC_WIDESTYLED = 64,
1084 LC_INTERIORS  = 128;
1085 
1086 // Return values for GetDeviceCaps(dc, POLYGONALCAPS)
1087 
1088 const int
1089 PC_NONE        = 0,
1090 PC_POLYGON     = 1,
1091 PC_RECTANGLE   = 2,
1092 PC_WINDPOLYGON = 4,
1093 PC_TRAPEZOID   = 4,
1094 PC_SCANLINE    = 8,
1095 PC_WIDE        = 16,
1096 PC_STYLED      = 32,
1097 PC_WIDESTYLED  = 64,
1098 PC_INTERIORS   = 128,
1099 PC_POLYPOLYGON = 256,
1100 PC_PATHS       = 512;
1101 
1102 /* Clipping Capabilities */
1103 const int CP_NONE      = 0,
1104           CP_RECTANGLE = 1,
1105           CP_REGION    = 2;
1106 
1107 // Return values for GetDeviceCaps(dc, TEXTCAPS)
1108 
1109 const int
1110 TC_OP_CHARACTER = 1,
1111 TC_OP_STROKE    = 2,
1112 TC_CP_STROKE    = 4,
1113 TC_CR_90        = 8,
1114 TC_CR_ANY       = 16,
1115 TC_SF_X_YINDEP  = 32,
1116 TC_SA_DOUBLE    = 64,
1117 TC_SA_INTEGER   = 128,
1118 TC_SA_CONTIN    = 256,
1119 TC_EA_DOUBLE    = 512,
1120 TC_IA_ABLE      = 1024,
1121 TC_UA_ABLE      = 2048,
1122 TC_SO_ABLE      = 4096,
1123 TC_RA_ABLE      = 8192,
1124 TC_VA_ABLE      = 16384,
1125 TC_RESERVED     = 32768,
1126 TC_SCROLLBLT    = 65536;
1127 
1128 // End GetDeviceCaps
1129 // ---------------------
1130 // GetCharacterPlacement(), and GetFontLanguageInfo()
1131 const DWORD
1132 GCP_DBCS = 1,
1133 GCP_REORDER         = 2,
1134 GCP_USEKERNING      = 8,
1135 GCP_GLYPHSHAPE      = 16,
1136 GCP_LIGATE          = 32,
1137 GCP_DIACRITIC       = 256,
1138 GCP_KASHIDA         = 1024,
1139 GCP_ERROR           = 0x8000,
1140 GCP_JUSTIFY         = 0x10000,
1141 GCP_CLASSIN         = 0x80000,
1142 GCP_MAXEXTENT       = 0x100000,
1143 GCP_JUSTIFYIN       = 0x200000,
1144 GCP_DISPLAYZWG      = 0x400000,
1145 GCP_SYMSWAPOFF      = 0x800000,
1146 GCP_NUMERICOVERRIDE = 0x1000000,
1147 GCP_NEUTRALOVERRIDE = 0x2000000,
1148 GCP_NUMERICSLATIN   = 0x4000000,
1149 GCP_NUMERICSLOCAL   = 0x8000000,
1150 
1151 // Only for GetFontLanguageInfo()
1152 FLI_GLYPHS = 0x40000,
1153 FLI_MASK = 0x103b;
1154 
1155 // GetGlyphOutline()
1156 enum : UINT {
1157     GGO_METRICS      = 0,
1158     GGO_BITMAP       = 1,
1159     GGO_NATIVE       = 2,
1160     GGO_BEZIER       = 3,
1161     GGO_GRAY2_BITMAP = 4,
1162     GGO_GRAY4_BITMAP = 5,
1163     GGO_GRAY8_BITMAP = 6,
1164     GGO_GLYPH_INDEX  = 128,
1165     GGO_UNHINTED     = 256
1166 }
1167 
1168 enum : int {
1169     GM_COMPATIBLE = 1,
1170     GM_ADVANCED
1171 }
1172 const GM_LAST = GM_ADVANCED;
1173 
1174 enum : int {
1175     MM_TEXT = 1,
1176     MM_LOMETRIC,
1177     MM_HIMETRIC,
1178     MM_LOENGLISH,
1179     MM_HIENGLISH,
1180     MM_TWIPS,
1181     MM_ISOTROPIC,
1182     MM_ANISOTROPIC,
1183 }
1184 
1185 const int
1186 MM_MIN = MM_TEXT,
1187 MM_MAX = MM_ANISOTROPIC,
1188 MM_MAX_FIXEDSCALE = MM_TWIPS;
1189 
1190 const ABSOLUTE = 1;
1191 const RELATIVE = 2;
1192 
1193 enum : BYTE {
1194     PC_RESERVED   = 1,
1195     PC_EXPLICIT   = 2,
1196     PC_NOCOLLAPSE = 4
1197 }
1198 
1199 /* FIXME: move to win32.commctrl ? */
1200 
1201 // ImageList
1202 const COLORREF
1203 CLR_NONE    = 0xffffffff,
1204 CLR_INVALID = CLR_NONE,
1205 CLR_DEFAULT = 0xff000000;
1206 
1207 // RASTERIZER_STATUS.wFlags
1208 const short
1209 TT_AVAILABLE = 1,
1210 TT_ENABLED   = 2;
1211 
1212 // GetStockObject()
1213 enum : int {
1214     WHITE_BRUSH = 0,
1215     LTGRAY_BRUSH,
1216     GRAY_BRUSH,
1217     DKGRAY_BRUSH,
1218     BLACK_BRUSH,
1219     HOLLOW_BRUSH,     // = 5
1220     NULL_BRUSH = HOLLOW_BRUSH,
1221     WHITE_PEN  = 6,
1222     BLACK_PEN,
1223     NULL_PEN,     // = 8
1224     OEM_FIXED_FONT = 10,
1225     ANSI_FIXED_FONT,
1226     ANSI_VAR_FONT,
1227     SYSTEM_FONT,
1228     DEVICE_DEFAULT_FONT,
1229     DEFAULT_PALETTE,
1230     SYSTEM_FIXED_FONT,
1231 }
1232 static
1233 
1234 if (WINVER >= 0x0400)
1235 {
1236     enum : int {
1237         DEFAULT_GUI_FONT = SYSTEM_FIXED_FONT + 1,
1238     }
1239 }
1240 
1241 static
1242 
1243 if (_WIN32_WINNT >= 0x0500)
1244 {
1245     enum : int {
1246         DC_BRUSH = DEFAULT_GUI_FONT + 1,
1247         DC_PEN,
1248     }
1249 }
1250 
1251 static
1252 
1253 if (_WIN32_WINNT >= 0x0500)
1254 {
1255     const STOCK_LAST = DC_PEN;
1256 }
1257 else static
1258 
1259     if (WINVER >= 0x0400)
1260     {
1261         const STOCK_LAST = DEFAULT_GUI_FONT;
1262     }
1263     else
1264     {
1265         const STOCK_LAST = SYSTEM_FIXED_FONT;
1266     }
1267 
1268 // Get/SetSystemPaletteUse()
1269 enum : UINT {
1270     SYSPAL_ERROR       = 0,
1271     SYSPAL_STATIC      = 1,
1272     SYSPAL_NOSTATIC    = 2,
1273     SYSPAL_NOSTATIC256 = 3,
1274 }
1275 
1276 // SetTextAlign()
1277 const UINT
1278 TA_TOP        = 0,
1279 TA_CENTER     = 6,
1280 TA_BOTTOM     = 8,
1281 TA_BASELINE   = 24,
1282 TA_LEFT       = 0,
1283 TA_RIGHT      = 2,
1284 TA_RTLREADING = 256,
1285 TA_NOUPDATECP = 0,
1286 TA_UPDATECP   = 1,
1287 TA_MASK       = TA_BASELINE + TA_CENTER + TA_UPDATECP + TA_RTLREADING,
1288 VTA_BASELINE  = TA_BASELINE,
1289 VTA_CENTER    = TA_CENTER,
1290 VTA_LEFT      = TA_BOTTOM,
1291 VTA_RIGHT     = TA_TOP,
1292 VTA_BOTTOM    = TA_RIGHT,
1293 VTA_TOP       = TA_LEFT;
1294 
1295 // EMRMODIFYWORLDTRANSFORM.iMode
1296 enum : DWORD {
1297     MWT_IDENTITY = 1,
1298     MWT_LEFTMULTIPLY,
1299     MWT_RIGHTMULTIPLY
1300 }
1301 
1302 const DWORD
1303 MWT_MIN = MWT_IDENTITY,
1304 MWT_MAX = MWT_RIGHTMULTIPLY;
1305 
1306 enum {
1307     TRANSPARENT = 1,
1308     OPAQUE      = 2
1309 }
1310 
1311 // Get/SetStretchMode()
1312 enum : int {
1313     BLACKONWHITE = 1,
1314     WHITEONBLACK = 2,
1315     COLORONCOLOR = 3,
1316     HALFTONE     = 4,
1317 
1318     STRETCH_ANDSCANS    = 1,
1319     STRETCH_ORSCANS     = 2,
1320     STRETCH_DELETESCANS = 3,
1321     STRETCH_HALFTONE    = 4,
1322 
1323     MAXSTRETCHBLTMODE = 4
1324 }
1325 
1326 // TranslateCharsetInfo()
1327 enum : DWORD {
1328     TCI_SRCCHARSET  = 1,
1329     TCI_SRCCODEPAGE = 2,
1330     TCI_SRCFONTSIG  = 3,
1331     TCI_SRCLOCALE   = 0x1000,
1332 }
1333 
1334 // SetICMMode()
1335 enum : int {
1336     ICM_OFF   = 1,
1337     ICM_ON    = 2,
1338     ICM_QUERY = 3,
1339     ICM_DONE_OUTSIDEDC = 4,
1340 }
1341 
1342 // ----
1343 // Escape() Spooler Error Codes
1344 enum : int {
1345     SP_NOTREPORTED = 0x4000,
1346     SP_ERROR       = -1,
1347     SP_APPABORT    = -2,
1348     SP_USERABORT   = -3,
1349     SP_OUTOFDISK   = -4,
1350     SP_OUTOFMEMORY = -5
1351 }
1352 
1353 // Escape(), ExtEscape()
1354 // Most of the following are deprecated (Win16 only)
1355 enum : int {
1356     NEWFRAME                = 1,
1357     ABORTDOC                = 2,
1358     NEXTBAND                = 3,
1359     SETCOLORTABLE           = 4,
1360     GETCOLORTABLE           = 5,
1361     FLUSHOUTPUT             = 6,
1362     DRAFTMODE               = 7,
1363     QUERYESCSUPPORT         = 8,
1364     SETABORTPROC            = 9,
1365     STARTDOC                = 10,
1366     ENDDOC                  = 11,
1367     GETPHYSPAGESIZE         = 12,
1368     GETPRINTINGOFFSET       = 13,
1369     GETSCALINGFACTOR        = 14,
1370     MFCOMMENT               = 15,
1371     GETPENWIDTH             = 16,
1372     SETCOPYCOUNT            = 17,
1373     SELECTPAPERSOURCE       = 18,
1374     DEVICEDATA              = 19,
1375     PASSTHROUGH             = 19,
1376     GETTECHNOLOGY           = 20,
1377     SETLINECAP              = 21,
1378     SETLINEJOIN             = 22,
1379     SETMITERLIMIT           = 23,
1380     BANDINFO                = 24,
1381     DRAWPATTERNRECT         = 25,
1382     GETVECTORPENSIZE        = 26,
1383     GETVECTORBRUSHSIZE      = 27,
1384     ENABLEDUPLEX            = 28,
1385     GETSETPAPERBINS         = 29,
1386     GETSETPRINTORIENT       = 30,
1387     ENUMPAPERBINS           = 31,
1388     SETDIBSCALING           = 32,
1389     EPSPRINTING             = 33,
1390     ENUMPAPERMETRICS        = 34,
1391     GETSETPAPERMETRICS      = 35,
1392     POSTSCRIPT_DATA         = 37,
1393     POSTSCRIPT_IGNORE       = 38,
1394     MOUSETRAILS             = 39,
1395     GETDEVICEUNITS          = 42,
1396     GETEXTENDEDTEXTMETRICS  = 256,
1397     GETEXTENTTABLE          = 257,
1398     GETPAIRKERNTABLE        = 258,
1399     GETTRACKKERNTABLE       = 259,
1400     EXTTEXTOUT              = 512,
1401     GETFACENAME             = 513,
1402     DOWNLOADFACE            = 514,
1403     ENABLERELATIVEWIDTHS    = 768,
1404     ENABLEPAIRKERNING       = 769,
1405     SETKERNTRACK            = 770,
1406     SETALLJUSTVALUES        = 771,
1407     SETCHARSET              = 772,
1408     STRETCHBLT              = 2048,
1409     METAFILE_DRIVER         = 2049,
1410     GETSETSCREENPARAMS      = 3072,
1411     QUERYDIBSUPPORT         = 3073,
1412     BEGIN_PATH              = 4096,
1413     CLIP_TO_PATH            = 4097,
1414     END_PATH                = 4098,
1415     EXT_DEVICE_CAPS         = 4099,
1416     RESTORE_CTM             = 4100,
1417     SAVE_CTM                = 4101,
1418     SET_ARC_DIRECTION       = 4102,
1419     SET_BACKGROUND_COLOR    = 4103,
1420     SET_POLY_MODE           = 4104,
1421     SET_SCREEN_ANGLE        = 4105,
1422     SET_SPREAD              = 4106,
1423     TRANSFORM_CTM           = 4107,
1424     SET_CLIP_BOX            = 4108,
1425     SET_BOUNDS              = 4109,
1426     SET_MIRROR_MODE         = 4110,
1427     OPENCHANNEL             = 4110,
1428     DOWNLOADHEADER          = 4111,
1429     CLOSECHANNEL            = 4112,
1430     POSTSCRIPT_PASSTHROUGH  = 4115,
1431     ENCAPSULATED_POSTSCRIPT = 4116,
1432     POSTSCRIPT_IDENTIFY     = 4117,
1433     POSTSCRIPT_INJECTION    = 4118,
1434     CHECKJPEGFORMAT         = 4119,
1435     CHECKPNGFORMAT          = 4120,
1436     GET_PS_FEATURESETTING   = 4121,
1437     SPCLPASSTHROUGH2        = 4568,
1438 }
1439 
1440 enum : int {
1441     PSIDENT_GDICENTRIC = 0,
1442     PSIDENT_PSCENTRIC  = 1,
1443 }
1444 
1445 /*
1446  * Header structure for the input buffer to POSTSCRIPT_INJECTION escape
1447  */
1448 struct PSINJECTDATA
1449 {
1450     DWORD DataBytes;
1451     WORD InjectionPoint;
1452     WORD PageNumber;
1453 }
1454 alias PSINJECTDATA*PPSINJECTDATA;
1455 
1456 /* Constants for PSINJECTDATA.InjectionPoint field */
1457 enum {
1458     PSINJECT_BEGINSTREAM           = 1,
1459     PSINJECT_PSADOBE               = 2,
1460     PSINJECT_PAGESATEND            = 3,
1461     PSINJECT_PAGES                 = 4,
1462     PSINJECT_DOCNEEDEDRES          = 5,
1463     PSINJECT_DOCSUPPLIEDRES        = 6,
1464     PSINJECT_PAGEORDER             = 7,
1465     PSINJECT_ORIENTATION           = 8,
1466     PSINJECT_BOUNDINGBOX           = 9,
1467     PSINJECT_DOCUMENTPROCESSCOLORS = 10,
1468     PSINJECT_COMMENTS              = 11,
1469     PSINJECT_BEGINDEFAULTS         = 12,
1470     PSINJECT_ENDDEFAULTS           = 13,
1471     PSINJECT_BEGINPROLOG           = 14,
1472     PSINJECT_ENDPROLOG             = 15,
1473     PSINJECT_BEGINSETUP            = 16,
1474     PSINJECT_ENDSETUP              = 17,
1475     PSINJECT_TRAILER               = 18,
1476     PSINJECT_EOF       = 19,
1477     PSINJECT_ENDSTREAM = 20,
1478     PSINJECT_DOCUMENTPROCESSCOLORSATEND = 21,
1479 
1480     PSINJECT_PAGENUMBER      = 100,
1481     PSINJECT_BEGINPAGESETUP  = 101,
1482     PSINJECT_ENDPAGESETUP    = 102,
1483     PSINJECT_PAGETRAILER     = 103,
1484     PSINJECT_PLATECOLOR      = 104,
1485     PSINJECT_SHOWPAGE        = 105,
1486     PSINJECT_PAGEBBOX        = 106,
1487     PSINJECT_ENDPAGECOMMENTS = 107,
1488 
1489     PSINJECT_VMSAVE    = 200,
1490     PSINJECT_VMRESTORE = 201,
1491 }
1492 
1493 /* Parameter for GET_PS_FEATURESETTING escape */
1494 enum {
1495     FEATURESETTING_NUP       = 0,
1496     FEATURESETTING_OUTPUT    = 1,
1497     FEATURESETTING_PSLEVEL   = 2,
1498     FEATURESETTING_CUSTPAPER = 3,
1499     FEATURESETTING_MIRROR    = 4,
1500     FEATURESETTING_NEGATIVE  = 5,
1501     FEATURESETTING_PROTOCOL  = 6,
1502 }
1503 
1504 enum {
1505     FEATURESETTING_PRIVATE_BEGIN = 0x1000,
1506     FEATURESETTING_PRIVATE_END   = 0x1FFF,
1507 }
1508 
1509 /* Value returned for FEATURESETTING_PROTOCOL */
1510 const PSPROTOCOL_ASCII  = 0;
1511 const PSPROTOCOL_BCP    = 1;
1512 const PSPROTOCOL_TBCP   = 2;
1513 const PSPROTOCOL_BINARY = 3;
1514 
1515 // ----
1516 
1517 const WPARAM PR_JOBSTATUS = 0;
1518 
1519 // ???
1520 const QDI_SETDIBITS   = 1;
1521 const QDI_GETDIBITS   = 2;
1522 const QDI_DIBTOSCREEN = 4;
1523 const QDI_STRETCHDIB  = 8;
1524 
1525 const ASPECT_FILTERING = 1;
1526 
1527 // LOGCOLORSPACE.lcsCSType
1528 enum : LCSCSTYPE {
1529     LCS_CALIBRATED_RGB = 0,
1530     LCS_DEVICE_RGB,
1531     LCS_DEVICE_CMYK
1532 } /* What this for? */
1533 
1534 // LOGCOLORSPACE.lcsIntent
1535 enum : LCSGAMUTMATCH {
1536     LCS_GM_BUSINESS         = 1,
1537     LCS_GM_GRAPHICS         = 2,
1538     LCS_GM_IMAGES           = 4,
1539     LCS_GM_ABS_COLORIMETRIC = 8,
1540 }
1541 
1542 const DWORD
1543 RASTER_FONTTYPE   = 1,
1544 DEVICE_FONTTYPE   = 2,
1545 TRUETYPE_FONTTYPE = 4;
1546 
1547 // ---
1548 // DEVMODE struct
1549 
1550 // FIXME: Not needed for D (use .length instead)
1551 const CCHDEVICENAME = 32;
1552 const CCHFORMNAME   = 32;
1553 
1554 // DEVMODE.dmSpecVersion
1555 // current version of specification
1556 static
1557 
1558 if (WINVER >= 0x0500 || _WIN32_WINNT >= 0x0400)
1559 {
1560     const WORD DM_SPECVERSION = 0x0401;
1561 }
1562 else static
1563 
1564     if (WINVER >= 0x0400)
1565     {
1566         const WORD DM_SPECVERSION = 0x0400;
1567     }
1568     else
1569     {
1570         const WORD DM_SPECVERSION = 0x0320;
1571     }
1572 
1573 // DEVMODE.dmOrientation
1574 enum : short {
1575     DMORIENT_PORTRAIT  = 1,
1576     DMORIENT_LANDSCAPE = 2
1577 }
1578 
1579 // DEVMODE.dmPaperSize
1580 enum : short {
1581     DMPAPER_LETTER = 1,
1582     DMPAPER_LETTERSMALL,
1583     DMPAPER_TABLOID,
1584     DMPAPER_LEDGER,
1585     DMPAPER_LEGAL,
1586     DMPAPER_STATEMENT,
1587     DMPAPER_EXECUTIVE,
1588     DMPAPER_A3,
1589     DMPAPER_A4,
1590     DMPAPER_A4SMALL,
1591     DMPAPER_A5,
1592     DMPAPER_B4,
1593     DMPAPER_B5,
1594     DMPAPER_FOLIO,
1595     DMPAPER_QUARTO,
1596     DMPAPER_10X14,
1597     DMPAPER_11X17,
1598     DMPAPER_NOTE,
1599     DMPAPER_ENV_9,
1600     DMPAPER_ENV_10,
1601     DMPAPER_ENV_11,
1602     DMPAPER_ENV_12,
1603     DMPAPER_ENV_14,
1604     DMPAPER_CSHEET,
1605     DMPAPER_DSHEET,
1606     DMPAPER_ESHEET,
1607     DMPAPER_ENV_DL,
1608     DMPAPER_ENV_C5,
1609     DMPAPER_ENV_C3,
1610     DMPAPER_ENV_C4,
1611     DMPAPER_ENV_C6,
1612     DMPAPER_ENV_C65,
1613     DMPAPER_ENV_B4,
1614     DMPAPER_ENV_B5,
1615     DMPAPER_ENV_B6,
1616     DMPAPER_ENV_ITALY,
1617     DMPAPER_ENV_MONARCH,
1618     DMPAPER_ENV_PERSONAL,
1619     DMPAPER_FANFOLD_US,
1620     DMPAPER_FANFOLD_STD_GERMAN,
1621     DMPAPER_FANFOLD_LGL_GERMAN,
1622     DMPAPER_ISO_B4,
1623     DMPAPER_JAPANESE_POSTCARD,
1624     DMPAPER_9X11,
1625     DMPAPER_10X11,
1626     DMPAPER_15X11,
1627     DMPAPER_ENV_INVITE,
1628     DMPAPER_RESERVED_48,
1629     DMPAPER_RESERVED_49,
1630     DMPAPER_LETTER_EXTRA,
1631     DMPAPER_LEGAL_EXTRA,
1632     DMPAPER_TABLOID_EXTRA,
1633     DMPAPER_A4_EXTRA,
1634     DMPAPER_LETTER_TRANSVERSE,
1635     DMPAPER_A4_TRANSVERSE,
1636     DMPAPER_LETTER_EXTRA_TRANSVERSE,
1637     DMPAPER_A_PLUS,
1638     DMPAPER_B_PLUS,
1639     DMPAPER_LETTER_PLUS,
1640     DMPAPER_A4_PLUS,
1641     DMPAPER_A5_TRANSVERSE,
1642     DMPAPER_B5_TRANSVERSE,
1643     DMPAPER_A3_EXTRA,
1644     DMPAPER_A5_EXTRA,
1645     DMPAPER_B5_EXTRA,
1646     DMPAPER_A2,
1647     DMPAPER_A3_TRANSVERSE,
1648     DMPAPER_A3_EXTRA_TRANSVERSE     // = 68
1649 }
1650 static
1651 
1652 if (WINVER >= 0x0500)
1653 {
1654     enum : short {
1655         DMPAPER_DBL_JAPANESE_POSTCARD = 69,
1656         DMPAPER_A6,
1657         DMPAPER_JENV_KAKU2,
1658         DMPAPER_JENV_KAKU3,
1659         DMPAPER_JENV_CHOU3,
1660         DMPAPER_JENV_CHOU4,
1661         DMPAPER_LETTER_ROTATED,
1662         DMPAPER_A3_ROTATED,
1663         DMPAPER_A4_ROTATED,
1664         DMPAPER_A5_ROTATED,
1665         DMPAPER_B4_JIS_ROTATED,
1666         DMPAPER_B5_JIS_ROTATED,
1667         DMPAPER_JAPANESE_POSTCARD_ROTATED,
1668         DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED,
1669         DMPAPER_A6_ROTATED,
1670         DMPAPER_JENV_KAKU2_ROTATED,
1671         DMPAPER_JENV_KAKU3_ROTATED,
1672         DMPAPER_JENV_CHOU3_ROTATED,
1673         DMPAPER_JENV_CHOU4_ROTATED,
1674         DMPAPER_B6_JIS,
1675         DMPAPER_B6_JIS_ROTATED,
1676         DMPAPER_12X11,
1677         DMPAPER_JENV_YOU4,
1678         DMPAPER_JENV_YOU4_ROTATED,
1679         DMPAPER_P16K,
1680         DMPAPER_P32K,
1681         DMPAPER_P32KBIG,
1682         DMPAPER_PENV_1,
1683         DMPAPER_PENV_2,
1684         DMPAPER_PENV_3,
1685         DMPAPER_PENV_4,
1686         DMPAPER_PENV_5,
1687         DMPAPER_PENV_6,
1688         DMPAPER_PENV_7,
1689         DMPAPER_PENV_8,
1690         DMPAPER_PENV_9,
1691         DMPAPER_PENV_10,
1692         DMPAPER_P16K_ROTATED,
1693         DMPAPER_P32K_ROTATED,
1694         DMPAPER_P32KBIG_ROTATED,
1695         DMPAPER_PENV_1_ROTATED,
1696         DMPAPER_PENV_2_ROTATED,
1697         DMPAPER_PENV_3_ROTATED,
1698         DMPAPER_PENV_4_ROTATED,
1699         DMPAPER_PENV_5_ROTATED,
1700         DMPAPER_PENV_6_ROTATED,
1701         DMPAPER_PENV_7_ROTATED,
1702         DMPAPER_PENV_8_ROTATED,
1703         DMPAPER_PENV_9_ROTATED,
1704         DMPAPER_PENV_10_ROTATED         // 118
1705     }
1706 }
1707 
1708 const short DMPAPER_FIRST = DMPAPER_LETTER;
1709 
1710 static
1711 
1712 if (WINVER >= 0x0500)
1713     const short DMPAPER_LAST = DMPAPER_PENV_10_ROTATED;
1714 else
1715     const short DMPAPER_LAST = DMPAPER_A3_EXTRA_TRANSVERSE;
1716 
1717 const short DMPAPER_USER = 256;
1718 
1719 // DEVMODE.dmDefaultSource
1720 enum : short {
1721     DMBIN_ONLYONE = 1,
1722     DMBIN_UPPER   = 1,
1723     DMBIN_LOWER,
1724     DMBIN_MIDDLE,
1725     DMBIN_MANUAL,
1726     DMBIN_ENVELOPE,
1727     DMBIN_ENVMANUAL,
1728     DMBIN_AUTO,
1729     DMBIN_TRACTOR,
1730     DMBIN_SMALLFMT,
1731     DMBIN_LARGEFMT,
1732     DMBIN_LARGECAPACITY,     // = 11
1733     DMBIN_CASSETTE = 14,
1734     DMBIN_FORMSOURCE,
1735 }
1736 short
1737 DMBIN_FIRST = DMBIN_UPPER,
1738 DMBIN_LAST  = DMBIN_FORMSOURCE,
1739 DMBIN_USER  = 256;
1740 
1741 // DEVMODE.dmPrintQuality
1742 enum : short {
1743     DMRES_DRAFT  = -1,
1744     DMRES_LOW    = -2,
1745     DMRES_MEDIUM = -3,
1746     DMRES_HIGH   = -4
1747 }
1748 
1749 // DEVMODE.dmColor
1750 enum : short {
1751     DMCOLOR_MONOCHROME = 1,
1752     DMCOLOR_COLOR      = 2
1753 }
1754 
1755 // DEVMODE.dmDuplex
1756 enum : short {
1757     DMDUP_SIMPLEX    = 1,
1758     DMDUP_VERTICAL   = 2,
1759     DMDUP_HORIZONTAL = 3
1760 }
1761 
1762 // DEVMODE.dmTTOption
1763 enum : short {
1764     DMTT_BITMAP = 1,
1765     DMTT_DOWNLOAD,
1766     DMTT_SUBDEV,
1767     DMTT_DOWNLOAD_OUTLINE
1768 }
1769 
1770 // DEVMODE.dmCollate
1771 enum : short {
1772     DMCOLLATE_FALSE = 0,
1773     DMCOLLATE_TRUE
1774 }
1775 
1776 static
1777 
1778 if (WINVER >= 0x0501)
1779 {
1780     /* DEVMODE dmDisplayOrientation specifiations */
1781     enum : short {
1782         DMDO_DEFAULT = 0,
1783         DMDO_90      = 1,
1784         DMDO_180     = 2,
1785         DMDO_270     = 3,
1786     }
1787 
1788     /* DEVMODE dmDisplayFixedOutput specifiations */
1789     enum : short {
1790         DMDFO_DEFAULT = 0,
1791         DMDFO_STRETCH = 1,
1792         DMDFO_CENTER  = 2,
1793     }
1794 }
1795 
1796 /* FIXME: this flags are deprecated ? */
1797 
1798 // DEVMODE.dmDisplayFlags
1799 const DWORD
1800 DM_GRAYSCALE  = 1,
1801 DM_INTERLACED = 2;
1802 
1803 const DWORD
1804 DMDISPLAYFLAGS_TEXTMODE = 0x00000004;
1805 
1806 /* dmNup , multiple logical page per physical page options */
1807 const DWORD
1808 DMNUP_SYSTEM = 1,
1809 DMNUP_ONEUP  = 2;
1810 
1811 // DEVMODE.dmFields
1812 const DWORD
1813 DM_ORIENTATION = 0x00000001,
1814 DM_PAPERSIZE   = 0x00000002,
1815 DM_PAPERLENGTH = 0x00000004,
1816 DM_PAPERWIDTH  = 0x00000008,
1817 DM_SCALE       = 0x00000010;
1818 static
1819 
1820 if (WINVER >= 0x0500)
1821 {
1822     const DWORD
1823     DM_POSITION = 0x00000020,
1824     DM_NUP      = 0x00000040;
1825 }
1826 
1827 static
1828 
1829 if (WINVER >= 0x0501)
1830 {
1831     const DWORD
1832     DM_DISPLAYORIENTATION = 0x00000080;
1833 }
1834 
1835 const DWORD
1836 DM_COPIES = 0x00000100,
1837 DM_DEFAULTSOURCE    = 0x00000200,
1838 DM_PRINTQUALITY     = 0x00000400,
1839 DM_COLOR            = 0x00000800,
1840 DM_DUPLEX           = 0x00001000,
1841 DM_YRESOLUTION      = 0x00002000,
1842 DM_TTOPTION         = 0x00004000,
1843 DM_COLLATE          = 0x00008000,
1844 DM_FORMNAME         = 0x00010000,
1845 DM_LOGPIXELS        = 0x00020000,
1846 DM_BITSPERPEL       = 0x00040000,
1847 DM_PELSWIDTH        = 0x00080000,
1848 DM_PELSHEIGHT       = 0x00100000,
1849 DM_DISPLAYFLAGS     = 0x00200000,
1850 DM_DISPLAYFREQUENCY = 0x00400000;
1851 static
1852 
1853 if (WINVER >= 0x0400)
1854 {
1855     const DWORD
1856     DM_ICMMETHOD     = 0x00800000,
1857     DM_ICMINTENT     = 0x01000000,
1858     DM_MEDIATYPE     = 0x02000000,
1859     DM_DITHERTYPE    = 0x04000000,
1860     DM_PANNINGWIDTH  = 0x08000000,
1861     DM_PANNINGHEIGHT = 0x10000000;
1862 }
1863 
1864 static
1865 
1866 if (WINVER >= 0x0501)
1867 {
1868     const DWORD
1869     DM_DISPLAYFIXEDOUTPUT = 0x20000000;
1870 }
1871 
1872 // DEVMODE.dmICMMethod
1873 enum : DWORD {
1874     DMICMMETHOD_NONE   = 1,
1875     DMICMMETHOD_SYSTEM = 2,
1876     DMICMMETHOD_DRIVER = 3,
1877     DMICMMETHOD_DEVICE = 4,
1878     DMICMMETHOD_USER   = 256
1879 }
1880 
1881 // DEVMODE.dmICMIntent
1882 enum : DWORD {
1883     DMICM_SATURATE         = 1,
1884     DMICM_CONTRAST         = 2,
1885     DMICM_COLORIMETRIC     = 3,
1886     DMICM_ABS_COLORIMETRIC = 4,
1887     DMICM_USER             = 256
1888 }
1889 
1890 // DEVMODE.dmMediaType
1891 enum : DWORD {
1892     DMMEDIA_STANDARD     = 1,
1893     DMMEDIA_TRANSPARENCY = 2,
1894     DMMEDIA_GLOSSY       = 3,
1895     DMMEDIA_USER         = 256
1896 }
1897 
1898 // DEVMODE.dmDitherType
1899 enum : DWORD {
1900     DMDITHER_NONE = 1,
1901     DMDITHER_COARSE,
1902     DMDITHER_FINE,
1903     DMDITHER_LINEART,
1904     DMDITHER_ERRORDIFFUSION,
1905     DMDITHER_RESERVED6,
1906     DMDITHER_RESERVED7,
1907     DMDITHER_RESERVED8,
1908     DMDITHER_RESERVED9,
1909     DMDITHER_GRAYSCALE,
1910     DMDITHER_USER = 256
1911 }
1912 
1913 // ----
1914 // DocumentProperties()
1915 const DWORD
1916 DM_UPDATE      = 1,
1917 DM_COPY        = 2,
1918 DM_PROMPT      = 4,
1919 DM_MODIFY      = 8,
1920 DM_IN_BUFFER   = DM_MODIFY,
1921 DM_IN_PROMPT   = DM_PROMPT,
1922 DM_OUT_BUFFER  = DM_COPY,
1923 DM_OUT_DEFAULT = DM_UPDATE;
1924 
1925 // ---
1926 
1927 const GDI_ERROR = 0xFFFFFFFF;
1928 const HGDI_ERROR= cast(HANDLE) GDI_ERROR;
1929 
1930 // TEXTMETRIC.tmPitchAndFamily
1931 const BYTE
1932 TMPF_FIXED_PITCH = 1,
1933 TMPF_VECTOR      = 2,
1934 TMPF_TRUETYPE    = 4,
1935 TMPF_DEVICE      = 8;
1936 
1937 // NEWTEXTMETRIC.ntmFlags
1938 const DWORD
1939 NTM_ITALIC         = 0x00000001,
1940 NTM_BOLD           = 0x00000020,
1941 NTM_REGULAR        = 0x00000040,
1942 NTM_NONNEGATIVE_AC = 0x00010000,
1943 NTM_PS_OPENTYPE    = 0x00020000,
1944 NTM_TT_OPENTYPE    = 0x00040000,
1945 NTM_MULTIPLEMASTER = 0x00080000,
1946 NTM_TYPE1          = 0x00100000,
1947 NTM_DSIG           = 0x00200000;
1948 
1949 // ---
1950 const DWORD TT_POLYGON_TYPE = 24;
1951 
1952 // TTPOLYCURVE
1953 enum : WORD {
1954     TT_PRIM_LINE    = 1,
1955     TT_PRIM_QSPLINE = 2,
1956     TT_PRIM_CSPLINE = 3,
1957 }
1958 
1959 // ---
1960 const FONTMAPPER_MAX       = 10;
1961 const ENHMETA_STOCK_OBJECT = 0x80000000;
1962 const WGL_FONT_LINES       = 0;
1963 const WGL_FONT_POLYGONS    = 1;
1964 
1965 // ---
1966 // LAYERPLANEDESCRIPTOR.dwFlags
1967 const DWORD
1968 LPD_DOUBLEBUFFER   = 1,
1969 LPD_STEREO         = 2,
1970 LPD_SUPPORT_GDI    = 16,
1971 LPD_SUPPORT_OPENGL = 32,
1972 LPD_SHARE_DEPTH    = 64,
1973 LPD_SHARE_STENCIL  = 128,
1974 LPD_SHARE_ACCUM    = 256,
1975 LPD_SWAP_EXCHANGE  = 512,
1976 LPD_SWAP_COPY      = 1024,
1977 LPD_TRANSPARENT    = 4096;
1978 
1979 // LAYERPLANEDESCRIPTOR.iPixelType
1980 enum : BYTE {
1981     LPD_TYPE_RGBA       = 0,
1982     LPD_TYPE_COLORINDEX = 1
1983 }
1984 
1985 // ---
1986 
1987 // wglSwapLayerBuffers()
1988 const UINT
1989 WGL_SWAP_MAIN_PLANE = 1,
1990 WGL_SWAP_OVERLAY1   = 2,
1991 WGL_SWAP_OVERLAY2   = 4,
1992 WGL_SWAP_OVERLAY3   = 8,
1993 WGL_SWAP_OVERLAY4   = 16,
1994 WGL_SWAP_OVERLAY5   = 32,
1995 WGL_SWAP_OVERLAY6   = 64,
1996 WGL_SWAP_OVERLAY7   = 128,
1997 WGL_SWAP_OVERLAY8   = 256,
1998 WGL_SWAP_OVERLAY9   = 512,
1999 WGL_SWAP_OVERLAY10  = 1024,
2000 WGL_SWAP_OVERLAY11  = 2048,
2001 WGL_SWAP_OVERLAY12  = 4096,
2002 WGL_SWAP_OVERLAY13  = 8192,
2003 WGL_SWAP_OVERLAY14  = 16384,
2004 WGL_SWAP_OVERLAY15  = 32768,
2005 WGL_SWAP_UNDERLAY1  = 65536,
2006 WGL_SWAP_UNDERLAY2  = 0x20000,
2007 WGL_SWAP_UNDERLAY3  = 0x40000,
2008 WGL_SWAP_UNDERLAY4  = 0x80000,
2009 WGL_SWAP_UNDERLAY5  = 0x100000,
2010 WGL_SWAP_UNDERLAY6  = 0x200000,
2011 WGL_SWAP_UNDERLAY7  = 0x400000,
2012 WGL_SWAP_UNDERLAY8  = 0x800000,
2013 WGL_SWAP_UNDERLAY9  = 0x1000000,
2014 WGL_SWAP_UNDERLAY10 = 0x2000000,
2015 WGL_SWAP_UNDERLAY11 = 0x4000000,
2016 WGL_SWAP_UNDERLAY12 = 0x8000000,
2017 WGL_SWAP_UNDERLAY13 = 0x10000000,
2018 WGL_SWAP_UNDERLAY14 = 0x20000000,
2019 WGL_SWAP_UNDERLAY15 = 0x40000000;
2020 
2021 const AC_SRC_OVER  = 0x00;
2022 const AC_SRC_ALPHA = 0x01;
2023 
2024 // ???
2025 const AC_SRC_NO_PREMULT_ALPHA = 0x01;
2026 const AC_SRC_NO_ALPHA         = 0x02;
2027 const AC_DST_NO_PREMULT_ALPHA = 0x10;
2028 const AC_DST_NO_ALPHA         = 0x20;
2029 
2030 const LAYOUT_RTL = 1;
2031 const LAYOUT_BTT = 2;
2032 const LAYOUT_VBH = 4;
2033 const LAYOUT_BITMAPORIENTATIONPRESERVED = 8;
2034 
2035 static
2036 
2037 if (WINVER > 0x0400)
2038 {
2039     const CS_ENABLE  = 0x00000001;
2040     const CS_DISABLE = 0x00000002;
2041     const CS_DELETE_TRANSFORM = 0x00000003;
2042 }
2043 
2044 static
2045 
2046 if (WINVER > 0x0500)
2047 {
2048     const GRADIENT_FILL_RECT_H      =0x00;
2049     const GRADIENT_FILL_RECT_V      =0x01;
2050     const GRADIENT_FILL_TRIANGLE    =0x02;
2051     const GRADIENT_FILL_OP_FLAG     =0xff;
2052     const COLORMATCHTOTARGET_EMBEDED=0x00000001;
2053     const CREATECOLORSPACE_EMBEDED  =0x00000001;
2054     const SETICMPROFILE_EMBEDED     =0x00000001;
2055 }
2056 
2057 // DISPLAY_DEVICE.StateFlags
2058 const DWORD
2059 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 0x00000001,
2060 DISPLAY_DEVICE_MULTI_DRIVER        = 0x00000002,
2061 DISPLAY_DEVICE_PRIMARY_DEVICE      = 0x00000004,
2062 DISPLAY_DEVICE_MIRRORING_DRIVER    = 0x00000008,
2063 DISPLAY_DEVICE_VGA_COMPATIBLE      = 0x00000010,
2064 DISPLAY_DEVICE_REMOVABLE           = 0x00000020,
2065 DISPLAY_DEVICE_DISCONNECT          = 0x02000000,
2066 DISPLAY_DEVICE_REMOTE              = 0x04000000,
2067 DISPLAY_DEVICE_MODESPRUNED         = 0x08000000;
2068 
2069 /* Child device state */
2070 const DWORD
2071 DISPLAY_DEVICE_ACTIVE   = 0x00000001,
2072 DISPLAY_DEVICE_ATTACHED = 0x00000002;
2073 
2074 static
2075 
2076 if (_WIN32_WINNT >= 0x0500)
2077 {
2078     const GGI_MARK_NONEXISTING_GLYPHS = 1;
2079 }
2080 
2081 // ----------
2082 //   STRUCTS
2083 // ----------
2084 
2085 struct ABC
2086 {
2087     int abcA;
2088     UINT abcB;
2089     int abcC;
2090 }
2091 alias ABC*PABC, NPABC, LPABC;
2092 
2093 struct ABCFLOAT
2094 {
2095     FLOAT abcfA;
2096     FLOAT abcfB;
2097     FLOAT abcfC;
2098 }
2099 alias ABCFLOAT*PABCFLOAT, NPABCFLOAT, LPABCFLOAT;
2100 
2101 struct BITMAP
2102 {
2103     LONG bmType;
2104     LONG bmWidth;
2105     LONG bmHeight;
2106     LONG bmWidthBytes;
2107     WORD bmPlanes;
2108     WORD bmBitsPixel;
2109     LPVOID bmBits;
2110 }
2111 alias BITMAP*PBITMAP, NPBITMAP, LPBITMAP;
2112 
2113 struct BITMAPCOREHEADER
2114 {
2115     DWORD bcSize;
2116     WORD bcWidth;
2117     WORD bcHeight;
2118     WORD bcPlanes;
2119     WORD bcBitCount;
2120 }
2121 alias BITMAPCOREHEADER*PBITMAPCOREHEADER, LPBITMAPCOREHEADER;
2122 
2123 align (1) :
2124 struct RGBTRIPLE
2125 {
2126     BYTE rgbtBlue;
2127     BYTE rgbtGreen;
2128     BYTE rgbtRed;
2129 }
2130 alias RGBTRIPLE*LPRGBTRIPLE;
2131 
2132 align (2) :
2133 struct BITMAPFILEHEADER
2134 {
2135     WORD bfType;
2136     DWORD bfSize;
2137     WORD bfReserved1;
2138     WORD bfReserved2;
2139     DWORD bfOffBits;
2140 }
2141 alias BITMAPFILEHEADER*LPBITMAPFILEHEADER, PBITMAPFILEHEADER;
2142 
2143 align :
2144 
2145 struct BITMAPCOREINFO
2146 {
2147     BITMAPCOREHEADER bmciHeader;
2148     RGBTRIPLE[1]     bmciColors;
2149 }
2150 alias BITMAPCOREINFO*LPBITMAPCOREINFO, PBITMAPCOREINFO;
2151 
2152 struct BITMAPINFOHEADER
2153 {
2154     DWORD biSize;
2155     LONG biWidth;
2156     LONG biHeight;
2157     WORD biPlanes;
2158     WORD biBitCount;
2159     DWORD biCompression;
2160     DWORD biSizeImage;
2161     LONG biXPelsPerMeter;
2162     LONG biYPelsPerMeter;
2163     DWORD biClrUsed;
2164     DWORD biClrImportant;
2165 }
2166 
2167 alias BITMAPINFOHEADER*LPBITMAPINFOHEADER, PBITMAPINFOHEADER;
2168 
2169 struct RGBQUAD
2170 {
2171     BYTE rgbBlue;
2172     BYTE rgbGreen;
2173     BYTE rgbRed;
2174     BYTE rgbReserved;
2175 };
2176 alias RGBQUAD*LPRGBQUAD;
2177 
2178 struct BITMAPINFO
2179 {
2180     BITMAPINFOHEADER bmiHeader;
2181     RGBQUAD[1]       bmiColors;
2182 };
2183 alias BITMAPINFO*PBITMAPINFO, LPBITMAPINFO;
2184 
2185 alias int FXPT16DOT16;
2186 alias int*LPFXPT16DOT16;
2187 alias int FXPT2DOT30;
2188 alias int*LPFXPT2DOT30;
2189 
2190 struct CIEXYZ
2191 {
2192     FXPT2DOT30 ciexyzX;
2193     FXPT2DOT30 ciexyzY;
2194     FXPT2DOT30 ciexyzZ;
2195 }
2196 alias CIEXYZ*LPCIEXYZ;
2197 
2198 struct CIEXYZTRIPLE
2199 {
2200     CIEXYZ ciexyzRed;
2201     CIEXYZ ciexyzGreen;
2202     CIEXYZ ciexyzBlue;
2203 }
2204 alias CIEXYZTRIPLE*LPCIEXYZTRIPLE;
2205 
2206 struct BITMAPV4HEADER
2207 {
2208     DWORD bV4Size;
2209     LONG bV4Width;
2210     LONG bV4Height;
2211     WORD bV4Planes;
2212     WORD bV4BitCount;
2213     DWORD bV4V4Compression;
2214     DWORD bV4SizeImage;
2215     LONG bV4XPelsPerMeter;
2216     LONG bV4YPelsPerMeter;
2217     DWORD bV4ClrUsed;
2218     DWORD bV4ClrImportant;
2219     DWORD bV4RedMask;
2220     DWORD bV4GreenMask;
2221     DWORD bV4BlueMask;
2222     DWORD bV4AlphaMask;
2223     DWORD bV4CSType;
2224     CIEXYZTRIPLE bV4Endpoints;
2225     DWORD bV4GammaRed;
2226     DWORD bV4GammaGreen;
2227     DWORD bV4GammaBlue;
2228 }
2229 alias BITMAPV4HEADER*LPBITMAPV4HEADER, PBITMAPV4HEADER;
2230 
2231 struct BITMAPV5HEADER
2232 {
2233     DWORD bV5Size;
2234     LONG bV5Width;
2235     LONG bV5Height;
2236     WORD bV5Planes;
2237     WORD bV5BitCount;
2238     DWORD bV5Compression;
2239     DWORD bV5SizeImage;
2240     LONG bV5XPelsPerMeter;
2241     LONG bV5YPelsPerMeter;
2242     DWORD bV5ClrUsed;
2243     DWORD bV5ClrImportant;
2244     DWORD bV5RedMask;
2245     DWORD bV5GreenMask;
2246     DWORD bV5BlueMask;
2247     DWORD bV5AlphaMask;
2248     DWORD bV5CSType;
2249     CIEXYZTRIPLE bV5Endpoints;
2250     DWORD bV5GammaRed;
2251     DWORD bV5GammaGreen;
2252     DWORD bV5GammaBlue;
2253     DWORD bV5Intent;
2254     DWORD bV5ProfileData;
2255     DWORD bV5ProfileSize;
2256     DWORD bV5Reserved;
2257 }
2258 alias BITMAPV5HEADER*LPBITMAPV5HEADER, PBITMAPV5HEADER;
2259 
2260 struct FONTSIGNATURE
2261 {
2262     DWORD[4] fsUsb;
2263     DWORD[2] fsCsb;
2264 }
2265 alias FONTSIGNATURE*PFONTSIGNATURE, LPFONTSIGNATURE;
2266 
2267 struct CHARSETINFO
2268 {
2269     UINT ciCharset;
2270     UINT ciACP;
2271     FONTSIGNATURE fs;
2272 }
2273 alias CHARSETINFO*PCHARSETINFO, NPCHARSETINFO, LPCHARSETINFO;
2274 
2275 struct COLORADJUSTMENT
2276 {
2277     WORD caSize;
2278     WORD caFlags;
2279     WORD caIlluminantIndex;
2280     WORD caRedGamma;
2281     WORD caGreenGamma;
2282     WORD caBlueGamma;
2283     WORD caReferenceBlack;
2284     WORD caReferenceWhite;
2285     SHORT caContrast;
2286     SHORT caBrightness;
2287     SHORT caColorfulness;
2288     SHORT caRedGreenTint;
2289 }
2290 alias COLORADJUSTMENT*PCOLORADJUSTMENT, LPCOLORADJUSTMENT;
2291 
2292 struct DEVMODEA
2293 {
2294     BYTE[CCHDEVICENAME] dmDeviceName;
2295     WORD dmSpecVersion;
2296     WORD dmDriverVersion;
2297     WORD dmSize;
2298     WORD dmDriverExtra;
2299     DWORD dmFields;
2300     union {
2301         struct
2302         {
2303             short dmOrientation;
2304             short dmPaperSize;
2305             short dmPaperLength;
2306             short dmPaperWidth;
2307             short dmScale;
2308             short dmCopies;
2309             short dmDefaultSource;
2310             short dmPrintQuality;
2311         }
2312         POINTL dmPosition;
2313         DWORD dmDisplayOrientation;
2314         DWORD dmDisplayFixedOutput;
2315     }
2316     short dmColor;
2317     short dmDuplex;
2318     short dmYResolution;
2319     short dmTTOption;
2320     short dmCollate;
2321     BYTE[CCHFORMNAME]   dmFormName;
2322     WORD dmLogPixels;
2323     DWORD dmBitsPerPel;
2324     DWORD dmPelsWidth;
2325     DWORD dmPelsHeight;
2326     union {
2327         DWORD dmDisplayFlags;
2328         DWORD dmNup;
2329     }
2330     DWORD dmDisplayFrequency;
2331     static
2332 
2333     if (WINVER >= 0x0400)
2334     {
2335         DWORD dmICMMethod;
2336         DWORD dmICMIntent;
2337         DWORD dmMediaType;
2338         DWORD dmDitherType;
2339         DWORD dmReserved1;
2340         DWORD dmReserved2;
2341         static
2342 
2343         if ((WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400))
2344         {
2345             DWORD dmPanningWidth;
2346             DWORD dmPanningHeight;
2347         }
2348     }
2349 }
2350 alias DEVMODEA*PDEVMODEA, NPDEVMODEA, LPDEVMODEA;
2351 
2352 struct DEVMODEW
2353 {
2354     WCHAR[CCHDEVICENAME]   dmDeviceName;
2355     WORD dmSpecVersion;
2356     WORD dmDriverVersion;
2357     WORD dmSize;
2358     WORD dmDriverExtra;
2359     DWORD dmFields;
2360     union {
2361         struct
2362         {
2363             short dmOrientation;
2364             short dmPaperSize;
2365             short dmPaperLength;
2366             short dmPaperWidth;
2367             short dmScale;
2368             short dmCopies;
2369             short dmDefaultSource;
2370             short dmPrintQuality;
2371         }
2372         POINTL dmPosition;
2373         DWORD dmDisplayOrientation;
2374         DWORD dmDisplayFixedOutput;
2375     }
2376 
2377     short dmColor;
2378     short dmDuplex;
2379     short dmYResolution;
2380     short dmTTOption;
2381     short dmCollate;
2382     WCHAR[CCHFORMNAME]  dmFormName;
2383     WORD dmLogPixels;
2384     DWORD dmBitsPerPel;
2385     DWORD dmPelsWidth;
2386     DWORD dmPelsHeight;
2387     union {
2388         DWORD dmDisplayFlags;
2389         DWORD dmNup;
2390     }
2391     DWORD dmDisplayFrequency;
2392     static
2393 
2394     if (WINVER >= 0x0400)
2395     {
2396         DWORD dmICMMethod;
2397         DWORD dmICMIntent;
2398         DWORD dmMediaType;
2399         DWORD dmDitherType;
2400         DWORD dmReserved1;
2401         DWORD dmReserved2;
2402         static
2403 
2404         if ((WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400))
2405         {
2406             DWORD dmPanningWidth;
2407             DWORD dmPanningHeight;
2408         }
2409     }
2410 }
2411 alias DEVMODEW*PDEVMODEW, NPDEVMODEW, LPDEVMODEW;
2412 
2413 /*
2414  * Information about output options
2415  */
2416 struct PSFEATURE_OUTPUT
2417 {
2418     BOOL bPageIndependent;
2419     BOOL bSetPageDevice;
2420 }
2421 alias PSFEATURE_OUTPUT*PPSFEATURE_OUTPUT;
2422 
2423 /*
2424  * Information about custom paper size
2425  */
2426 struct PSFEATURE_CUSTPAPER
2427 {
2428     LONG lOrientation;
2429     LONG lWidth;
2430     LONG lHeight;
2431     LONG lWidthOffset;
2432     LONG lHeightOffset;
2433 }
2434 alias PSFEATURE_CUSTPAPER*PPSFEATURE_CUSTPAPER;
2435 
2436 struct DIBSECTION
2437 {
2438     BITMAP dsBm;
2439     BITMAPINFOHEADER dsBmih;
2440     DWORD[3]         dsBitfields;
2441     HANDLE dshSection;
2442     DWORD dsOffset;
2443 }
2444 alias DIBSECTION*PDIBSECTION;
2445 
2446 struct DOCINFOA
2447 {
2448     int cbSize = DOCINFOA.sizeof;
2449     LPCSTR lpszDocName;
2450     LPCSTR lpszOutput;
2451     LPCSTR lpszDatatype;
2452     DWORD fwType;
2453 }
2454 alias DOCINFOA*LPDOCINFOA;
2455 
2456 struct DOCINFOW
2457 {
2458     int cbSize = DOCINFOW.sizeof;
2459     LPCWSTR lpszDocName;
2460     LPCWSTR lpszOutput;
2461     LPCWSTR lpszDatatype;
2462     DWORD fwType;
2463 }
2464 alias DOCINFOW*LPDOCINFOW;
2465 
2466 struct PANOSE
2467 {
2468     BYTE bFamilyType;
2469     BYTE bSerifStyle;
2470     BYTE bWeight;
2471     BYTE bProportion;
2472     BYTE bContrast;
2473     BYTE bStrokeVariation;
2474     BYTE bArmStyle;
2475     BYTE bLetterform;
2476     BYTE bMidline;
2477     BYTE bXHeight;
2478 }
2479 alias PANOSE*LPPANOSE;
2480 
2481 struct LOGFONTA
2482 {
2483     LONG lfHeight;
2484     LONG lfWidth;
2485     LONG lfEscapement;
2486     LONG lfOrientation;
2487     LONG lfWeight;
2488     BYTE lfItalic;
2489     BYTE lfUnderline;
2490     BYTE lfStrikeOut;
2491     BYTE lfCharSet;
2492     BYTE lfOutPrecision;
2493     BYTE lfClipPrecision;
2494     BYTE lfQuality;
2495     BYTE lfPitchAndFamily;
2496     CHAR[LF_FACESIZE] lfFaceName;
2497 }
2498 alias LOGFONTA*PLOGFONTA, NPLOGFONTA, LPLOGFONTA;
2499 
2500 struct LOGFONTW
2501 {
2502     LONG lfHeight;
2503     LONG lfWidth;
2504     LONG lfEscapement;
2505     LONG lfOrientation;
2506     LONG lfWeight;
2507     BYTE lfItalic;
2508     BYTE lfUnderline;
2509     BYTE lfStrikeOut;
2510     BYTE lfCharSet;
2511     BYTE lfOutPrecision;
2512     BYTE lfClipPrecision;
2513     BYTE lfQuality;
2514     BYTE lfPitchAndFamily;
2515     WCHAR[LF_FACESIZE] lfFaceName;
2516 }
2517 alias LOGFONTW*PLOGFONTW, NPLOGFONTW, LPLOGFONTW;
2518 
2519 struct EXTLOGFONTA
2520 {
2521     LOGFONTA elfLogFont;
2522     BYTE[LF_FULLFACESIZE] elfFullName;
2523     BYTE[LF_FACESIZE]     elfStyle;
2524     DWORD elfVersion;
2525     DWORD elfStyleSize;
2526     DWORD elfMatch;
2527     DWORD elfReserved;
2528     BYTE[ELF_VENDOR_SIZE] elfVendorId;
2529     DWORD elfCulture;
2530     PANOSE elfPanose;
2531 }
2532 alias EXTLOGFONTA*PEXTLOGFONTA, NPEXTLOGFONTA, LPEXTLOGFONTA;
2533 
2534 struct EXTLOGFONTW
2535 {
2536     LOGFONTW elfLogFont;
2537     WCHAR[LF_FULLFACESIZE] elfFullName;
2538     WCHAR[LF_FACESIZE]     elfStyle;
2539     DWORD elfVersion;
2540     DWORD elfStyleSize;
2541     DWORD elfMatch;
2542     DWORD elfReserved;
2543     BYTE[ELF_VENDOR_SIZE]  elfVendorId;
2544     DWORD elfCulture;
2545     PANOSE elfPanose;
2546 }
2547 alias EXTLOGFONTW*PEXTLOGFONTW, NPEXTLOGFONTW, LPEXTLOGFONTW;
2548 
2549 struct LOGPEN
2550 {
2551     UINT lopnStyle;
2552     POINT lopnWidth;
2553     COLORREF lopnColor;
2554 }
2555 alias LOGPEN*PLOGPEN, NPLOGPEN, LPLOGPEN;
2556 
2557 // ---------------------- EMR ------------
2558 
2559 struct EMR
2560 {
2561     DWORD iType;
2562     DWORD nSize;
2563 }
2564 alias EMR*PEMR;
2565 
2566 struct EMRANGLEARC
2567 {
2568     EMR emr;
2569     POINTL ptlCenter;
2570     DWORD nRadius;
2571     FLOAT eStartAngle;
2572     FLOAT eSweepAngle;
2573 }
2574 alias EMRANGLEARC*PEMRANGLEARC;
2575 
2576 struct EMRARC
2577 {
2578     EMR emr;
2579     RECTL rclBox;
2580     POINTL ptlStart;
2581     POINTL ptlEnd;
2582 }
2583 alias EMRARC*PEMRARC;
2584 alias EMRARC EMRARCTO;
2585 alias EMRARCTO*PEMRARCTO;
2586 alias EMRARC EMRCHORD;
2587 alias EMRCHORD*PEMRCHORD;
2588 alias EMRARC EMRPIE;
2589 alias EMRPIE*PEMRPIE;
2590 
2591 struct XFORM
2592 {
2593     FLOAT eM11;
2594     FLOAT eM12;
2595     FLOAT eM21;
2596     FLOAT eM22;
2597     FLOAT eDx;
2598     FLOAT eDy;
2599 }
2600 alias XFORM*PXFORM, LPXFORM;
2601 
2602 struct EMRBITBLT
2603 {
2604     EMR emr;
2605     RECTL rclBounds;
2606     LONG xDest;
2607     LONG yDest;
2608     LONG cxDest;
2609     LONG cyDest;
2610     DWORD dwRop;
2611     LONG xSrc;
2612     LONG ySrc;
2613     XFORM xformSrc;
2614     COLORREF crBkColorSrc;
2615     DWORD iUsageSrc;
2616     DWORD offBmiSrc;
2617     DWORD cbBmiSrc;
2618     DWORD offBitsSrc;
2619     DWORD cbBitsSrc;
2620 }
2621 alias EMRBITBLT*PEMRBITBLT;
2622 
2623 struct LOGBRUSH
2624 {
2625     UINT lbStyle;
2626     COLORREF lbColor;
2627     LONG lbHatch;
2628 }
2629 alias LOGBRUSH PATTERN;
2630 alias LOGBRUSH*PLOGBRUSH, NPLOGBRUSH, LPLOGBRUSH;
2631 alias PATTERN *PPATTERN, NPPATTERN, LPPATTERN;
2632 
2633 struct LOGBRUSH32
2634 {
2635     UINT lbStyle;
2636     COLORREF lbColor;
2637     ULONG lbHatch;
2638 }
2639 alias LOGBRUSH32*PLOGBRUSH32, NPLOGBRUSH32, LPLOGBRUSH32;
2640 
2641 struct EMRCREATEBRUSHINDIRECT
2642 {
2643     EMR emr;
2644     DWORD ihBrush;
2645     LOGBRUSH32 lb;
2646 }
2647 alias EMRCREATEBRUSHINDIRECT*PEMRCREATEBRUSHINDIRECT;
2648 
2649 alias LONG LCSCSTYPE, LCSGAMUTMATCH;
2650 
2651 struct LOGCOLORSPACEA
2652 {
2653     DWORD lcsSignature;
2654     DWORD lcsVersion;
2655     DWORD lcsSize;
2656     LCSCSTYPE lcsCSType;
2657     LCSGAMUTMATCH lcsIntent;
2658     CIEXYZTRIPLE lcsEndpoints;
2659     DWORD lcsGammaRed;
2660     DWORD lcsGammaGreen;
2661     DWORD lcsGammaBlue;
2662     CHAR[MAX_PATH] lcsFilename;
2663 }
2664 alias LOGCOLORSPACEA*LPLOGCOLORSPACEA;
2665 
2666 struct LOGCOLORSPACEW
2667 {
2668     DWORD lcsSignature;
2669     DWORD lcsVersion;
2670     DWORD lcsSize;
2671     LCSCSTYPE lcsCSType;
2672     LCSGAMUTMATCH lcsIntent;
2673     CIEXYZTRIPLE lcsEndpoints;
2674     DWORD lcsGammaRed;
2675     DWORD lcsGammaGreen;
2676     DWORD lcsGammaBlue;
2677     WCHAR[MAX_PATH] lcsFilename;
2678 }
2679 alias LOGCOLORSPACEW*LPLOGCOLORSPACEW;
2680 
2681 alias USHORT COLOR16;
2682 struct TRIVERTEX
2683 {
2684     LONG x;
2685     LONG y;
2686     COLOR16 Red;
2687     COLOR16 Green;
2688     COLOR16 Blue;
2689     COLOR16 Alpha;
2690 }
2691 alias TRIVERTEX*PTRIVERTEX, LPTRIVERTEX;
2692 
2693 static
2694 
2695 if (WINVER >= 0x0400)
2696 {
2697     struct EMRGLSRECORD
2698     {
2699         EMR emr;
2700         DWORD cbData;
2701         BYTE[1] Data;
2702     }
2703     alias EMRGLSRECORD*PEMRGLSRECORD;
2704 
2705     struct EMRGLSBOUNDEDRECORD
2706     {
2707         EMR emr;
2708         RECTL rclBounds;
2709         DWORD cbData;
2710         BYTE[1] Data;
2711     }
2712     alias EMRGLSBOUNDEDRECORD*PEMRGLSBOUNDEDRECORD;
2713 
2714     struct EMRPIXELFORMAT
2715     {
2716         EMR emr;
2717         PIXELFORMATDESCRIPTOR pfd;
2718     }
2719     alias EMRPIXELFORMAT*PEMRPIXELFORMAT;
2720 
2721     struct EMRCREATECOLORSPACE
2722     {
2723         EMR emr;
2724         DWORD ihCS;
2725         LOGCOLORSPACE lcs;
2726     }
2727     alias EMRCREATECOLORSPACE*PEMRCREATECOLORSPACE;
2728 
2729     struct EMRSETCOLORSPACE
2730     {
2731         EMR emr;
2732         DWORD ihCS;
2733     }
2734     alias EMRSETCOLORSPACE*PEMRSETCOLORSPACE;
2735     alias EMRSETCOLORSPACE EMRSELECTCOLORSPACE;
2736     alias EMRSELECTCOLORSPACE*PEMRSELECTCOLORSPACE;
2737     alias EMRSETCOLORSPACE EMRDELETECOLORSPACE;
2738     alias EMRDELETECOLORSPACE*PEMRDELETECOLORSPACE;
2739 }
2740 
2741 static
2742 
2743 if (WINVER >= 0x0500)
2744 {
2745     struct EMREXTESCAPE
2746     {
2747         EMR emr;
2748         INT iEscape;
2749         INT cbEscData;
2750         BYTE[1] EscData;
2751     }
2752     alias EMREXTESCAPE*PEMREXTESCAPE;
2753     alias EMREXTESCAPE EMRDRAWESCAPE;
2754     alias EMRDRAWESCAPE*PEMRDRAWESCAPE;
2755 
2756     struct EMRNAMEDESCAPE
2757     {
2758         EMR emr;
2759         INT iEscape;
2760         INT cbDriver;
2761         INT cbEscData;
2762         BYTE[1] EscData;
2763     }
2764     alias EMRNAMEDESCAPE*PEMRNAMEDESCAPE;
2765 
2766     struct EMRSETICMPROFILE
2767     {
2768         EMR emr;
2769         DWORD dwFlags;
2770         DWORD cbName;
2771         DWORD cbData;
2772         BYTE[1] Data;
2773     }
2774     alias EMRSETICMPROFILE*PEMRSETICMPROFILE;
2775     alias EMRSETICMPROFILE EMRSETICMPROFILEA;
2776     alias EMRSETICMPROFILEA*PEMRSETICMPROFILEA;
2777     alias EMRSETICMPROFILE EMRSETICMPROFILEW;
2778     alias EMRSETICMPROFILEW*PEMRSETICMPROFILEW;
2779 
2780     struct EMRCREATECOLORSPACEW
2781     {
2782         EMR emr;
2783         DWORD ihCS;
2784         LOGCOLORSPACEW lcs;
2785         DWORD dwFlags;
2786         DWORD cbData;
2787         BYTE[1] Data;
2788     }
2789     alias EMRCREATECOLORSPACEW*PEMRCREATECOLORSPACEW;
2790 
2791     struct EMRCOLORMATCHTOTARGET
2792     {
2793         EMR emr;
2794         DWORD dwAction;
2795         DWORD dwFlags;
2796         DWORD cbName;
2797         DWORD cbData;
2798         BYTE[1] Data;
2799     }
2800     alias EMRCOLORMATCHTOTARGET*PEMRCOLORMATCHTOTARGET;
2801 
2802     struct EMRCOLORCORRECTPALETTE
2803     {
2804         EMR emr;
2805         DWORD ihPalette;
2806         DWORD nFirstEntry;
2807         DWORD nPalEntries;
2808         DWORD nReserved;
2809     }
2810     alias EMRCOLORCORRECTPALETTE*PEMRCOLORCORRECTPALETTE;
2811 
2812     struct EMRALPHABLEND
2813     {
2814         EMR emr;
2815         RECTL rclBounds;
2816         LONG xDest;
2817         LONG yDest;
2818         LONG cxDest;
2819         LONG cyDest;
2820         DWORD dwRop;
2821         LONG xSrc;
2822         LONG ySrc;
2823         XFORM xformSrc;
2824         COLORREF crBkColorSrc;
2825         DWORD iUsageSrc;
2826         DWORD offBmiSrc;
2827         DWORD cbBmiSrc;
2828         DWORD offBitsSrc;
2829         DWORD cbBitsSrc;
2830         LONG cxSrc;
2831         LONG cySrc;
2832     }
2833     alias EMRALPHABLEND*PEMRALPHABLEND;
2834 
2835     struct EMRGRADIENTFILL
2836     {
2837         EMR emr;
2838         RECTL rclBounds;
2839         DWORD nVer;
2840         DWORD nTri;
2841         ULONG ulMode;
2842         TRIVERTEX[1] Ver;
2843     }
2844     alias EMRGRADIENTFILL*PEMRGRADIENTFILL;
2845 
2846     struct EMRTRANSPARENTBLT
2847     {
2848         EMR emr;
2849         RECTL rclBounds;
2850         LONG xDest;
2851         LONG yDest;
2852         LONG cxDest;
2853         LONG cyDest;
2854         DWORD dwRop;
2855         LONG xSrc;
2856         LONG ySrc;
2857         XFORM xformSrc;
2858         COLORREF crBkColorSrc;
2859         DWORD iUsageSrc;
2860         DWORD offBmiSrc;
2861         DWORD cbBmiSrc;
2862         DWORD offBitsSrc;
2863         DWORD cbBitsSrc;
2864         LONG cxSrc;
2865         LONG cySrc;
2866     }
2867     alias EMRTRANSPARENTBLT*PEMRTRANSPARENTBLT;
2868 }
2869 
2870 struct EMRCREATEDIBPATTERNBRUSHPT
2871 {
2872     EMR emr;
2873     DWORD ihBrush;
2874     DWORD iUsage;
2875     DWORD offBmi;
2876     DWORD cbBmi;
2877     DWORD offBits;
2878     DWORD cbBits;
2879 }
2880 alias EMRCREATEDIBPATTERNBRUSHPT*PEMRCREATEDIBPATTERNBRUSHPT;
2881 
2882 struct EMRCREATEMONOBRUSH
2883 {
2884     EMR emr;
2885     DWORD ihBrush;
2886     DWORD iUsage;
2887     DWORD offBmi;
2888     DWORD cbBmi;
2889     DWORD offBits;
2890     DWORD cbBits;
2891 }
2892 alias EMRCREATEMONOBRUSH*PEMRCREATEMONOBRUSH;
2893 
2894 struct PALETTEENTRY
2895 {
2896     BYTE peRed;
2897     BYTE peGreen;
2898     BYTE peBlue;
2899     BYTE peFlags;
2900 }
2901 alias PALETTEENTRY*PPALETTEENTRY, LPPALETTEENTRY;
2902 
2903 struct LOGPALETTE
2904 {
2905     WORD palVersion;
2906     WORD palNumEntries;
2907     PALETTEENTRY[1] palPalEntry;
2908 }
2909 alias LOGPALETTE*PLOGPALETTE, NPLOGPALETTE, LPLOGPALETTE;
2910 
2911 struct EMRCREATEPALETTE
2912 {
2913     EMR emr;
2914     DWORD ihPal;
2915     LOGPALETTE lgpl;
2916 }
2917 alias EMRCREATEPALETTE*PEMRCREATEPALETTE;
2918 
2919 struct EMRCREATEPEN
2920 {
2921     EMR emr;
2922     DWORD ihPen;
2923     LOGPEN lopn;
2924 }
2925 alias EMRCREATEPEN*PEMRCREATEPEN;
2926 
2927 struct EMRELLIPSE
2928 {
2929     EMR emr;
2930     RECTL rclBox;
2931 }
2932 alias EMRELLIPSE*PEMRELLIPSE;
2933 
2934 alias EMRELLIPSE EMRRECTANGLE;
2935 alias EMRRECTANGLE*PEMRRECTANGLE;
2936 
2937 struct EMREOF
2938 {
2939     EMR emr;
2940     DWORD nPalEntries;
2941     DWORD offPalEntries;
2942     DWORD nSizeLast;
2943 }
2944 alias EMREOF*PEMREOF;
2945 
2946 struct EMREXCLUDECLIPRECT
2947 {
2948     EMR emr;
2949     RECTL rclClip;
2950 }
2951 alias EMREXCLUDECLIPRECT*PEMREXCLUDECLIPRECT;
2952 alias EMREXCLUDECLIPRECT EMRINTERSECTCLIPRECT;
2953 alias EMRINTERSECTCLIPRECT*PEMRINTERSECTCLIPRECT;
2954 
2955 struct EMREXTCREATEFONTINDIRECTW
2956 {
2957     EMR emr;
2958     DWORD ihFont;
2959     EXTLOGFONTW elfw;
2960 }
2961 alias EMREXTCREATEFONTINDIRECTW*PEMREXTCREATEFONTINDIRECTW;
2962 
2963 struct EXTLOGPEN
2964 {
2965     UINT elpPenStyle;
2966     UINT elpWidth;
2967     UINT elpBrushStyle;
2968     COLORREF elpColor;
2969     LONG elpHatch;
2970     DWORD elpNumEntries;
2971     DWORD[1] elpStyleEntry;
2972 }
2973 alias EXTLOGPEN*PEXTLOGPEN, NPEXTLOGPEN, LPEXTLOGPEN;
2974 
2975 struct EMREXTCREATEPEN
2976 {
2977     EMR emr;
2978     DWORD ihPen;
2979     DWORD offBmi;
2980     DWORD cbBmi;
2981     DWORD offBits;
2982     DWORD cbBits;
2983     EXTLOGPEN elp;
2984 }
2985 alias EMREXTCREATEPEN*PEMREXTCREATEPEN;
2986 
2987 struct EMREXTFLOODFILL
2988 {
2989     EMR emr;
2990     POINTL ptlStart;
2991     COLORREF crColor;
2992     DWORD iMode;
2993 }
2994 alias EMREXTFLOODFILL*PEMREXTFLOODFILL;
2995 
2996 struct EMREXTSELECTCLIPRGN
2997 {
2998     EMR emr;
2999     DWORD cbRgnData;
3000     DWORD iMode;
3001     BYTE [1] RgnData;
3002 }
3003 alias EMREXTSELECTCLIPRGN*PEMREXTSELECTCLIPRGN;
3004 
3005 struct EMRTEXT
3006 {
3007     POINTL ptlReference;
3008     DWORD nChars;
3009     DWORD offString;
3010     DWORD fOptions;
3011     RECTL rcl;
3012     DWORD offDx;
3013 }
3014 alias EMRTEXT*PEMRTEXT;
3015 
3016 struct EMREXTTEXTOUTA
3017 {
3018     EMR emr;
3019     RECTL rclBounds;
3020     DWORD iGraphicsMode;
3021     FLOAT exScale;
3022     FLOAT eyScale;
3023     EMRTEXT emrtext;
3024 }
3025 alias EMREXTTEXTOUTA*PEMREXTTEXTOUTA;
3026 alias EMREXTTEXTOUTA EMREXTTEXTOUTW;
3027 alias EMREXTTEXTOUTW*PEMREXTTEXTOUTW;
3028 
3029 struct EMRFILLPATH
3030 {
3031     EMR emr;
3032     RECTL rclBounds;
3033 }
3034 alias EMRFILLPATH*PEMRFILLPATH;
3035 
3036 alias EMRFILLPATH EMRSTROKEANDFILLPATH;
3037 alias EMRSTROKEANDFILLPATH*PEMRSTROKEANDFILLPATH;
3038 
3039 alias EMRFILLPATH EMRSTROKEPATH;
3040 alias EMRSTROKEPATH*PEMRSTROKEPATH;
3041 
3042 struct EMRFILLRGN
3043 {
3044     EMR emr;
3045     RECTL rclBounds;
3046     DWORD cbRgnData;
3047     DWORD ihBrush;
3048     BYTE[1] RgnData;
3049 }
3050 alias EMRFILLRGN*PEMRFILLRGN;
3051 
3052 struct EMRFORMAT
3053 {
3054     DWORD dSignature;
3055     DWORD nVersion;
3056     DWORD cbData;
3057     DWORD offData;
3058 }
3059 alias EMRFORMAT*PEMRFORMAT;
3060 
3061 struct EMRFRAMERGN
3062 {
3063     EMR emr;
3064     RECTL rclBounds;
3065     DWORD cbRgnData;
3066     DWORD ihBrush;
3067     SIZEL szlStroke;
3068     BYTE[1] RgnData;
3069 }
3070 alias EMRFRAMERGN*PEMRFRAMERGN;
3071 
3072 struct EMRGDICOMMENT
3073 {
3074     EMR emr;
3075     DWORD cbData;
3076     BYTE[1] Data;
3077 }
3078 alias EMRGDICOMMENT*PEMRGDICOMMENT;
3079 
3080 struct EMRINVERTRGN
3081 {
3082     EMR emr;
3083     RECTL rclBounds;
3084     DWORD cbRgnData;
3085     BYTE[1] RgnData;
3086 }
3087 alias EMRINVERTRGN*PEMRINVERTRGN;
3088 alias EMRINVERTRGN EMRPAINTRGN;
3089 alias EMRPAINTRGN*PEMRPAINTRGN;
3090 
3091 struct EMRLINETO
3092 {
3093     EMR emr;
3094     POINTL ptl;
3095 }
3096 alias EMRLINETO*PEMRLINETO;
3097 alias EMRLINETO EMRMOVETOEX;
3098 alias EMRMOVETOEX*PEMRMOVETOEX;
3099 
3100 struct EMRMASKBLT
3101 {
3102     EMR emr;
3103     RECTL rclBounds;
3104     LONG xDest;
3105     LONG yDest;
3106     LONG cxDest;
3107     LONG cyDest;
3108     DWORD dwRop;
3109     LONG xSrc;
3110     LONG ySrc;
3111     XFORM xformSrc;
3112     COLORREF crBkColorSrc;
3113     DWORD iUsageSrc;
3114     DWORD offBmiSrc;
3115     DWORD cbBmiSrc;
3116     DWORD offBitsSrc;
3117     DWORD cbBitsSrc;
3118     LONG xMask;
3119     LONG yMask;
3120     DWORD iUsageMask;
3121     DWORD offBmiMask;
3122     DWORD cbBmiMask;
3123     DWORD offBitsMask;
3124     DWORD cbBitsMask;
3125 }
3126 alias EMRMASKBLT*PEMRMASKBLT;
3127 
3128 struct EMRMODIFYWORLDTRANSFORM
3129 {
3130     EMR emr;
3131     XFORM xform;
3132     DWORD iMode;
3133 }
3134 alias EMRMODIFYWORLDTRANSFORM*PEMRMODIFYWORLDTRANSFORM;
3135 
3136 struct EMROFFSETCLIPRGN
3137 {
3138     EMR emr;
3139     POINTL ptlOffset;
3140 }
3141 alias EMROFFSETCLIPRGN*PEMROFFSETCLIPRGN;
3142 
3143 struct EMRPLGBLT
3144 {
3145     EMR emr;
3146     RECTL rclBounds;
3147     POINTL[3] aptlDest;
3148     LONG xSrc;
3149     LONG ySrc;
3150     LONG cxSrc;
3151     LONG cySrc;
3152     XFORM xformSrc;
3153     COLORREF crBkColorSrc;
3154     DWORD iUsageSrc;
3155     DWORD offBmiSrc;
3156     DWORD cbBmiSrc;
3157     DWORD offBitsSrc;
3158     DWORD cbBitsSrc;
3159     LONG xMask;
3160     LONG yMask;
3161     DWORD iUsageMask;
3162     DWORD offBmiMask;
3163     DWORD cbBmiMask;
3164     DWORD offBitsMask;
3165     DWORD cbBitsMask;
3166 }
3167 alias EMRPLGBLT*PEMRPLGBLT;
3168 
3169 struct EMRPOLYDRAW
3170 {
3171     EMR emr;
3172     RECTL rclBounds;
3173     DWORD cptl;
3174     POINTL[1] aptl;
3175     BYTE[1] abTypes;
3176 }
3177 alias EMRPOLYDRAW*PEMRPOLYDRAW;
3178 
3179 struct EMRPOLYDRAW16
3180 {
3181     EMR emr;
3182     RECTL rclBounds;
3183     DWORD cpts;
3184     POINTS[1] apts;
3185     BYTE[1] abTypes;
3186 }
3187 alias EMRPOLYDRAW16*PEMRPOLYDRAW16;
3188 
3189 struct EMRPOLYLINE
3190 {
3191     EMR emr;
3192     RECTL rclBounds;
3193     DWORD cptl;
3194     POINTL[1] aptl;
3195 }
3196 alias EMRPOLYLINE*PEMRPOLYLINE;
3197 alias EMRPOLYLINE EMRPOLYBEZIER;
3198 alias EMRPOLYBEZIER*PEMRPOLYBEZIER;
3199 alias EMRPOLYLINE EMRPOLYGON;
3200 alias EMRPOLYGON*PEMRPOLYGON;
3201 alias EMRPOLYLINE EMRPOLYBEZIERTO;
3202 alias EMRPOLYBEZIERTO*PEMRPOLYBEZIERTO;
3203 alias EMRPOLYLINE EMRPOLYLINETO;
3204 alias EMRPOLYLINETO*PEMRPOLYLINETO;
3205 
3206 struct EMRPOLYLINE16
3207 {
3208     EMR emr;
3209     RECTL rclBounds;
3210     DWORD cpts;
3211     POINTS[1] apts;
3212 }
3213 alias EMRPOLYLINE16*PEMRPOLYLINE16;
3214 alias EMRPOLYLINE16 EMRPOLYBEZIER16;
3215 alias EMRPOLYBEZIER16*PEMRPOLYBEZIER16;
3216 alias EMRPOLYLINE16 EMRPOLYGON16;
3217 alias EMRPOLYGON16*PEMRPOLYGON16;
3218 alias EMRPOLYLINE16 EMRPOLYBEZIERTO16;
3219 alias EMRPOLYBEZIERTO16*PEMRPOLYBEZIERTO16;
3220 alias EMRPOLYLINE16 EMRPOLYLINETO16;
3221 alias EMRPOLYLINETO16*PEMRPOLYLINETO16;
3222 
3223 struct EMRPOLYPOLYLINE
3224 {
3225     EMR emr;
3226     RECTL rclBounds;
3227     DWORD nPolys;
3228     DWORD cptl;
3229     DWORD[1] aPolyCounts;
3230     POINTL[1] aptl;
3231 }
3232 alias EMRPOLYPOLYLINE*PEMRPOLYPOLYLINE;
3233 alias EMRPOLYPOLYLINE EMRPOLYPOLYGON;
3234 alias EMRPOLYPOLYGON*PEMRPOLYPOLYGON;
3235 
3236 struct EMRPOLYPOLYLINE16
3237 {
3238     EMR emr;
3239     RECTL rclBounds;
3240     DWORD nPolys;
3241     DWORD cpts;
3242     DWORD[1] aPolyCounts;
3243     POINTS[1] apts;
3244 }
3245 alias EMRPOLYPOLYLINE16*PEMRPOLYPOLYLINE16;
3246 alias EMRPOLYPOLYLINE16 EMRPOLYPOLYGON16;
3247 alias EMRPOLYPOLYGON16*PEMRPOLYPOLYGON16;
3248 
3249 struct EMRPOLYTEXTOUTA
3250 {
3251     EMR emr;
3252     RECTL rclBounds;
3253     DWORD iGraphicsMode;
3254     FLOAT exScale;
3255     FLOAT eyScale;
3256     LONG cStrings;
3257     EMRTEXT[1] aemrtext;
3258 }
3259 alias EMRPOLYTEXTOUTA*PEMRPOLYTEXTOUTA;
3260 alias EMRPOLYTEXTOUTA EMRPOLYTEXTOUTW;
3261 alias EMRPOLYTEXTOUTW*PEMRPOLYTEXTOUTW;
3262 
3263 struct EMRRESIZEPALETTE
3264 {
3265     EMR emr;
3266     DWORD ihPal;
3267     DWORD cEntries;
3268 }
3269 alias EMRRESIZEPALETTE*PEMRRESIZEPALETTE;
3270 
3271 struct EMRRESTOREDC
3272 {
3273     EMR emr;
3274     LONG iRelative;
3275 }
3276 alias EMRRESTOREDC*PEMRRESTOREDC;
3277 
3278 struct EMRROUNDRECT
3279 {
3280     EMR emr;
3281     RECTL rclBox;
3282     SIZEL szlCorner;
3283 }
3284 alias EMRROUNDRECT*PEMRROUNDRECT;
3285 
3286 struct EMRSCALEVIEWPORTEXTEX
3287 {
3288     EMR emr;
3289     LONG xNum;
3290     LONG xDenom;
3291     LONG yNum;
3292     LONG yDenom;
3293 }
3294 alias EMRSCALEVIEWPORTEXTEX*PEMRSCALEVIEWPORTEXTEX;
3295 alias EMRSCALEVIEWPORTEXTEX EMRSCALEWINDOWEXTEX;
3296 alias EMRSCALEWINDOWEXTEX*PEMRSCALEWINDOWEXTEX;
3297 
3298 struct EMRSELECTOBJECT
3299 {
3300     EMR emr;
3301     DWORD ihObject;
3302 }
3303 alias EMRSELECTOBJECT*PEMRSELECTOBJECT;
3304 alias EMRSELECTOBJECT EMRDELETEOBJECT;
3305 alias EMRDELETEOBJECT*PEMRDELETEOBJECT;
3306 
3307 struct EMRSELECTPALETTE
3308 {
3309     EMR emr;
3310     DWORD ihPal;
3311 }
3312 alias EMRSELECTPALETTE*PEMRSELECTPALETTE;
3313 
3314 struct EMRSETARCDIRECTION
3315 {
3316     EMR emr;
3317     DWORD iArcDirection;
3318 }
3319 alias EMRSETARCDIRECTION*PEMRSETARCDIRECTION;
3320 
3321 struct EMRSETTEXTCOLOR
3322 {
3323     EMR emr;
3324     COLORREF crColor;
3325 }
3326 alias EMRSETTEXTCOLOR*PEMRSETTEXTCOLOR;
3327 alias EMRSETTEXTCOLOR EMRSETBKCOLOR;
3328 alias EMRSETBKCOLOR*PEMRSETBKCOLOR;
3329 
3330 struct EMRSETCOLORADJUSTMENT
3331 {
3332     EMR emr;
3333     COLORADJUSTMENT ColorAdjustment;
3334 }
3335 alias EMRSETCOLORADJUSTMENT*PEMRSETCOLORADJUSTMENT;
3336 
3337 struct EMRSETDIBITSTODEVICE
3338 {
3339     EMR emr;
3340     RECTL rclBounds;
3341     LONG xDest;
3342     LONG yDest;
3343     LONG xSrc;
3344     LONG ySrc;
3345     LONG cxSrc;
3346     LONG cySrc;
3347     DWORD offBmiSrc;
3348     DWORD cbBmiSrc;
3349     DWORD offBitsSrc;
3350     DWORD cbBitsSrc;
3351     DWORD iUsageSrc;
3352     DWORD iStartScan;
3353     DWORD cScans;
3354 }
3355 alias EMRSETDIBITSTODEVICE*PEMRSETDIBITSTODEVICE;
3356 
3357 struct EMRSETMAPPERFLAGS
3358 {
3359     EMR emr;
3360     DWORD dwFlags;
3361 }
3362 alias EMRSETMAPPERFLAGS*PEMRSETMAPPERFLAGS;
3363 
3364 struct EMRSETMITERLIMIT
3365 {
3366     EMR emr;
3367     FLOAT eMiterLimit;
3368 }
3369 alias EMRSETMITERLIMIT*PEMRSETMITERLIMIT;
3370 
3371 struct EMRSETPALETTEENTRIES
3372 {
3373     EMR emr;
3374     DWORD ihPal;
3375     DWORD iStart;
3376     DWORD cEntries;
3377     PALETTEENTRY[1] aPalEntries;
3378 }
3379 alias EMRSETPALETTEENTRIES*PEMRSETPALETTEENTRIES;
3380 
3381 struct EMRSETPIXELV
3382 {
3383     EMR emr;
3384     POINTL ptlPixel;
3385     COLORREF crColor;
3386 }
3387 alias EMRSETPIXELV*PEMRSETPIXELV;
3388 
3389 struct EMRSETVIEWPORTEXTEX
3390 {
3391     EMR emr;
3392     SIZEL szlExtent;
3393 }
3394 alias EMRSETVIEWPORTEXTEX*PEMRSETVIEWPORTEXTEX;
3395 alias EMRSETVIEWPORTEXTEX EMRSETWINDOWEXTEX;
3396 alias EMRSETWINDOWEXTEX*PEMRSETWINDOWEXTEX;
3397 
3398 struct EMRSETVIEWPORTORGEX
3399 {
3400     EMR emr;
3401     POINTL ptlOrigin;
3402 }
3403 alias EMRSETVIEWPORTORGEX*PEMRSETVIEWPORTORGEX;
3404 alias EMRSETVIEWPORTORGEX EMRSETWINDOWORGEX;
3405 alias EMRSETWINDOWORGEX*PEMRSETWINDOWORGEX;
3406 alias EMRSETVIEWPORTORGEX EMRSETBRUSHORGEX;
3407 alias EMRSETBRUSHORGEX*PEMRSETBRUSHORGEX;
3408 
3409 struct EMRSETWORLDTRANSFORM
3410 {
3411     EMR emr;
3412     XFORM xform;
3413 }
3414 alias EMRSETWORLDTRANSFORM*PEMRSETWORLDTRANSFORM;
3415 
3416 struct EMRSTRETCHBLT
3417 {
3418     EMR emr;
3419     RECTL rclBounds;
3420     LONG xDest;
3421     LONG yDest;
3422     LONG cxDest;
3423     LONG cyDest;
3424     DWORD dwRop;
3425     LONG xSrc;
3426     LONG ySrc;
3427     XFORM xformSrc;
3428     COLORREF crBkColorSrc;
3429     DWORD iUsageSrc;
3430     DWORD offBmiSrc;
3431     DWORD cbBmiSrc;
3432     DWORD offBitsSrc;
3433     DWORD cbBitsSrc;
3434     LONG cxSrc;
3435     LONG cySrc;
3436 }
3437 alias EMRSTRETCHBLT*PEMRSTRETCHBLT;
3438 
3439 struct EMRSTRETCHDIBITS
3440 {
3441     EMR emr;
3442     RECTL rclBounds;
3443     LONG xDest;
3444     LONG yDest;
3445     LONG xSrc;
3446     LONG ySrc;
3447     LONG cxSrc;
3448     LONG cySrc;
3449     DWORD offBmiSrc;
3450     DWORD cbBmiSrc;
3451     DWORD offBitsSrc;
3452     DWORD cbBitsSrc;
3453     DWORD iUsageSrc;
3454     DWORD dwRop;
3455     LONG cxDest;
3456     LONG cyDest;
3457 }
3458 alias EMRSTRETCHDIBITS*PEMRSTRETCHDIBITS;
3459 
3460 struct EMRABORTPATH
3461 {
3462     EMR emr;
3463 }
3464 alias EMRABORTPATH*PEMRABORTPATH;
3465 alias EMRABORTPATH EMRBEGINPATH;
3466 alias EMRBEGINPATH*PEMRBEGINPATH;
3467 alias EMRABORTPATH EMRENDPATH;
3468 alias EMRENDPATH*PEMRENDPATH;
3469 alias EMRABORTPATH EMRCLOSEFIGURE;
3470 alias EMRCLOSEFIGURE*PEMRCLOSEFIGURE;
3471 alias EMRABORTPATH EMRFLATTENPATH;
3472 alias EMRFLATTENPATH*PEMRFLATTENPATH;
3473 alias EMRABORTPATH EMRWIDENPATH;
3474 alias EMRWIDENPATH*PEMRWIDENPATH;
3475 alias EMRABORTPATH EMRSETMETARGN;
3476 alias EMRSETMETARGN*PEMRSETMETARGN;
3477 alias EMRABORTPATH EMRSAVEDC;
3478 alias EMRSAVEDC*PEMRSAVEDC;
3479 alias EMRABORTPATH EMRREALIZEPALETTE;
3480 alias EMRREALIZEPALETTE*PEMRREALIZEPALETTE;
3481 
3482 struct EMRSELECTCLIPPATH
3483 {
3484     EMR emr;
3485     DWORD iMode;
3486 }
3487 alias EMRSELECTCLIPPATH*PEMRSELECTCLIPPATH;
3488 alias EMRSELECTCLIPPATH EMRSETBKMODE;
3489 alias EMRSETBKMODE*PEMRSETBKMODE;
3490 alias EMRSELECTCLIPPATH EMRSETMAPMODE;
3491 alias EMRSETMAPMODE*PEMRSETMAPMODE;
3492 alias EMRSELECTCLIPPATH EMRSETPOLYFILLMODE;
3493 alias EMRSETPOLYFILLMODE*PEMRSETPOLYFILLMODE;
3494 alias EMRSELECTCLIPPATH EMRSETROP2;
3495 alias EMRSETROP2*PEMRSETROP2;
3496 alias EMRSELECTCLIPPATH EMRSETSTRETCHBLTMODE;
3497 alias EMRSETSTRETCHBLTMODE*PEMRSETSTRETCHBLTMODE;
3498 alias EMRSELECTCLIPPATH EMRSETICMMODE;
3499 alias EMRSETICMMODE*PEMRSETICMMODE;
3500 alias EMRSELECTCLIPPATH EMRSETTEXTALIGN;
3501 alias EMRSETTEXTALIGN*PEMRSETTEXTALIGN;
3502 alias EMRSELECTCLIPPATH EMRENABLEICM;
3503 alias EMRENABLEICM*PEMRENABLEICM;
3504 static
3505 
3506 if (WINVER >= 0x0500)
3507 {
3508     alias EMRSELECTCLIPPATH EMRSETLAYOUT;
3509     alias EMRSETLAYOUT*PEMRSETLAYOUT;
3510 }
3511 
3512 align (2) :
3513 struct METAHEADER
3514 {
3515     WORD mtType;
3516     WORD mtHeaderSize;
3517     WORD mtVersion;
3518     DWORD mtSize;
3519     WORD mtNoObjects;
3520     DWORD mtMaxRecord;
3521     WORD mtNoParameters;
3522 }
3523 alias METAHEADER*PMETAHEADER;
3524 alias METAHEADER*LPMETAHEADER;
3525 
3526 align :
3527 
3528 struct ENHMETAHEADER
3529 {
3530     DWORD iType;
3531     DWORD nSize;
3532     RECTL rclBounds;
3533     RECTL rclFrame;
3534     DWORD dSignature = ENHMETA_SIGNATURE;
3535     DWORD nVersion;
3536     DWORD nBytes;
3537     DWORD nRecords;
3538     WORD nHandles;
3539     WORD sReserved;
3540     DWORD nDescription;
3541     DWORD offDescription;
3542     DWORD nPalEntries;
3543     SIZEL szlDevice;
3544     SIZEL szlMillimeters;
3545     static
3546 
3547     if (WINVER >= 0x0400)
3548     {
3549         DWORD cbPixelFormat;
3550         DWORD offPixelFormat;
3551         DWORD bOpenGL;
3552     }
3553 
3554     static
3555 
3556     if (WINVER >= 0x0500)
3557     {
3558         SIZEL szlMicrometers;
3559     }
3560 }
3561 alias ENHMETAHEADER*PENHMETAHEADER, LPENHMETAHEADER;
3562 
3563 struct METARECORD
3564 {
3565     DWORD rdSize;
3566     WORD rdFunction;
3567     WORD[1] rdParm;
3568 }
3569 alias METARECORD*PMETARECORD;
3570 alias METARECORD*LPMETARECORD;
3571 
3572 struct ENHMETARECORD
3573 {
3574     DWORD iType;
3575     DWORD nSize;
3576     DWORD[1] dParm;
3577 }
3578 alias ENHMETARECORD*PENHMETARECORD, LPENHMETARECORD;
3579 
3580 // ---
3581 
3582 struct HANDLETABLE
3583 {
3584     HGDIOBJ[1] objectHandle;
3585 }
3586 alias HANDLETABLE*PHANDLETABLE, LPHANDLETABLE;
3587 
3588 struct TEXTMETRICA
3589 {
3590     LONG tmHeight;
3591     LONG tmAscent;
3592     LONG tmDescent;
3593     LONG tmInternalLeading;
3594     LONG tmExternalLeading;
3595     LONG tmAveCharWidth;
3596     LONG tmMaxCharWidth;
3597     LONG tmWeight;
3598     LONG tmOverhang;
3599     LONG tmDigitizedAspectX;
3600     LONG tmDigitizedAspectY;
3601     BYTE tmFirstChar;
3602     BYTE tmLastChar;
3603     BYTE tmDefaultChar;
3604     BYTE tmBreakChar;
3605     BYTE tmItalic;
3606     BYTE tmUnderlined;
3607     BYTE tmStruckOut;
3608     BYTE tmPitchAndFamily;
3609     BYTE tmCharSet;
3610 }
3611 alias TEXTMETRICA*PTEXTMETRICA, NPTEXTMETRICA, LPTEXTMETRICA;
3612 
3613 struct TEXTMETRICW
3614 {
3615     LONG tmHeight;
3616     LONG tmAscent;
3617     LONG tmDescent;
3618     LONG tmInternalLeading;
3619     LONG tmExternalLeading;
3620     LONG tmAveCharWidth;
3621     LONG tmMaxCharWidth;
3622     LONG tmWeight;
3623     LONG tmOverhang;
3624     LONG tmDigitizedAspectX;
3625     LONG tmDigitizedAspectY;
3626     WCHAR tmFirstChar;
3627     WCHAR tmLastChar;
3628     WCHAR tmDefaultChar;
3629     WCHAR tmBreakChar;
3630     BYTE tmItalic;
3631     BYTE tmUnderlined;
3632     BYTE tmStruckOut;
3633     BYTE tmPitchAndFamily;
3634     BYTE tmCharSet;
3635 }
3636 alias TEXTMETRICW*PTEXTMETRICW, NPTEXTMETRICW, LPTEXTMETRICW;
3637 
3638 struct RGNDATAHEADER
3639 {
3640     DWORD dwSize;
3641     DWORD iType;
3642     DWORD nCount;
3643     DWORD nRgnSize;
3644     RECT rcBound;
3645 }
3646 alias RGNDATAHEADER*PRGNDATAHEADER;
3647 
3648 struct RGNDATA
3649 {
3650     RGNDATAHEADER rdh;
3651     char[1] Buffer;
3652 }
3653 alias RGNDATA*PRGNDATA, NPRGNDATA, LPRGNDATA;
3654 
3655 /* for GetRandomRgn */
3656 const SYSRGN=4;
3657 struct GCP_RESULTSA
3658 {
3659     DWORD lStructSize;
3660     LPSTR lpOutString;
3661     UINT*lpOrder;
3662     INT*lpDx;
3663     INT*lpCaretPos;
3664     LPSTR lpClass;
3665     LPWSTR lpGlyphs;
3666     UINT nGlyphs;
3667     UINT nMaxFit;
3668 }
3669 alias GCP_RESULTSA*LPGCP_RESULTSA;
3670 
3671 struct GCP_RESULTSW
3672 {
3673     DWORD lStructSize;
3674     LPWSTR lpOutString;
3675     UINT*lpOrder;
3676     INT*lpDx;
3677     INT*lpCaretPos;
3678     LPWSTR lpClass;
3679     LPWSTR lpGlyphs;
3680     UINT nGlyphs;
3681     UINT nMaxFit;
3682 }
3683 alias GCP_RESULTSW*LPGCP_RESULTSW;
3684 
3685 struct GLYPHMETRICS
3686 {
3687     UINT gmBlackBoxX;
3688     UINT gmBlackBoxY;
3689     POINT gmptGlyphOrigin;
3690     short gmCellIncX;
3691     short gmCellIncY;
3692 }
3693 alias GLYPHMETRICS*LPGLYPHMETRICS;
3694 
3695 static
3696 
3697 if (_WIN32_WINNT >= 0x0500)
3698 {
3699     struct WCRANGE
3700     {
3701         WCHAR wcLow;
3702         USHORT cGlyphs;
3703     }
3704     alias WCRANGE*PWCRANGE, LPWCRANGE;
3705 
3706     struct GLYPHSET
3707     {
3708         DWORD cbThis;
3709         DWORD flAccel;
3710         DWORD cGlyphsSupported;
3711         DWORD cRanges;
3712         WCRANGE[1] ranges;
3713     }
3714     alias GLYPHSET*PGLYPHSET, LPGLYPHSET;
3715 
3716     const DWORD GS_8BIT_INDICES = 0x00000001;
3717 }
3718 
3719 struct KERNINGPAIR
3720 {
3721     WORD wFirst;
3722     WORD wSecond;
3723     int iKernAmount;
3724 }
3725 alias KERNINGPAIR*LPKERNINGPAIR;
3726 
3727 struct FIXED
3728 {
3729     WORD fract;
3730     short value;
3731 }
3732 
3733 struct MAT2
3734 {
3735     FIXED eM11;
3736     FIXED eM12;
3737     FIXED eM21;
3738     FIXED eM22;
3739 }
3740 alias MAT2*LPMAT2;
3741 
3742 struct OUTLINETEXTMETRICA
3743 {
3744     UINT otmSize;
3745     TEXTMETRICA otmTextMetrics;
3746     BYTE otmFiller;
3747     PANOSE otmPanoseNumber;
3748     UINT otmfsSelection;
3749     UINT otmfsType;
3750     int otmsCharSlopeRise;
3751     int otmsCharSlopeRun;
3752     int otmItalicAngle;
3753     UINT otmEMSquare;
3754     int otmAscent;
3755     int otmDescent;
3756     UINT otmLineGap;
3757     UINT otmsCapEmHeight;
3758     UINT otmsXHeight;
3759     RECT otmrcFontBox;
3760     int otmMacAscent;
3761     int otmMacDescent;
3762     UINT otmMacLineGap;
3763     UINT otmusMinimumPPEM;
3764     POINT otmptSubscriptSize;
3765     POINT otmptSubscriptOffset;
3766     POINT otmptSuperscriptSize;
3767     POINT otmptSuperscriptOffset;
3768     UINT otmsStrikeoutSize;
3769     int otmsStrikeoutPosition;
3770     int otmsUnderscoreSize;
3771     int otmsUnderscorePosition;
3772     PSTR otmpFamilyName;
3773     PSTR otmpFaceName;
3774     PSTR otmpStyleName;
3775     PSTR otmpFullName;
3776 }
3777 alias OUTLINETEXTMETRICA*POUTLINETEXTMETRICA, NPOUTLINETEXTMETRICA, LPOUTLINETEXTMETRICA;
3778 
3779 struct OUTLINETEXTMETRICW
3780 {
3781     UINT otmSize;
3782     TEXTMETRICW otmTextMetrics;
3783     BYTE otmFiller;
3784     PANOSE otmPanoseNumber;
3785     UINT otmfsSelection;
3786     UINT otmfsType;
3787     int otmsCharSlopeRise;
3788     int otmsCharSlopeRun;
3789     int otmItalicAngle;
3790     UINT otmEMSquare;
3791     int otmAscent;
3792     int otmDescent;
3793     UINT otmLineGap;
3794     UINT otmsCapEmHeight;
3795     UINT otmsXHeight;
3796     RECT otmrcFontBox;
3797     int otmMacAscent;
3798     int otmMacDescent;
3799     UINT otmMacLineGap;
3800     UINT otmusMinimumPPEM;
3801     POINT otmptSubscriptSize;
3802     POINT otmptSubscriptOffset;
3803     POINT otmptSuperscriptSize;
3804     POINT otmptSuperscriptOffset;
3805     UINT otmsStrikeoutSize;
3806     int otmsStrikeoutPosition;
3807     int otmsUnderscoreSize;
3808     int otmsUnderscorePosition;
3809     PSTR otmpFamilyName;
3810     PSTR otmpFaceName;
3811     PSTR otmpStyleName;
3812     PSTR otmpFullName;
3813 }
3814 alias OUTLINETEXTMETRICW*POUTLINETEXTMETRICW, NPOUTLINETEXTMETRICW, LPOUTLINETEXTMETRICW;
3815 
3816 struct RASTERIZER_STATUS
3817 {
3818     short nSize;
3819     short wFlags;
3820     short nLanguageID;
3821 }
3822 alias RASTERIZER_STATUS*LPRASTERIZER_STATUS;
3823 
3824 struct POLYTEXTA
3825 {
3826     int x;
3827     int y;
3828     UINT n;
3829     LPCSTR lpstr;
3830     UINT uiFlags;
3831     RECT rcl;
3832     int*pdx;
3833 }
3834 alias POLYTEXTA*PPOLYTEXTA, NPPOLYTEXTA, LPPOLYTEXTA;
3835 
3836 struct POLYTEXTW
3837 {
3838     int x;
3839     int y;
3840     UINT n;
3841     LPCWSTR lpstr;
3842     UINT uiFlags;
3843     RECT rcl;
3844     int*pdx;
3845 }
3846 alias POLYTEXTW*PPOLYTEXTW, NPPOLYTEXTW, LPPOLYTEXTW;
3847 
3848 struct PIXELFORMATDESCRIPTOR
3849 {
3850     WORD nSize;
3851     WORD nVersion;
3852     DWORD dwFlags;
3853     BYTE iPixelType;
3854     BYTE cColorBits;
3855     BYTE cRedBits;
3856     BYTE cRedShift;
3857     BYTE cGreenBits;
3858     BYTE cGreenShift;
3859     BYTE cBlueBits;
3860     BYTE cBlueShift;
3861     BYTE cAlphaBits;
3862     BYTE cAlphaShift;
3863     BYTE cAccumBits;
3864     BYTE cAccumRedBits;
3865     BYTE cAccumGreenBits;
3866     BYTE cAccumBlueBits;
3867     BYTE cAccumAlphaBits;
3868     BYTE cDepthBits;
3869     BYTE cStencilBits;
3870     BYTE cAuxBuffers;
3871     BYTE iLayerType;
3872     BYTE bReserved;
3873     DWORD dwLayerMask;
3874     DWORD dwVisibleMask;
3875     DWORD dwDamageMask;
3876 }
3877 alias PIXELFORMATDESCRIPTOR*PPIXELFORMATDESCRIPTOR, LPPIXELFORMATDESCRIPTOR;
3878 
3879 struct METAFILEPICT
3880 {
3881     LONG mm;
3882     LONG xExt;
3883     LONG yExt;
3884     HMETAFILE hMF;
3885 }
3886 alias METAFILEPICT*LPMETAFILEPICT;
3887 
3888 struct LOCALESIGNATURE
3889 {
3890     DWORD[4] lsUsb;
3891     DWORD[2] lsCsbDefault;
3892     DWORD[2] lsCsbSupported;
3893 }
3894 alias LOCALESIGNATURE*PLOCALESIGNATURE, LPLOCALESIGNATURE;
3895 
3896 alias LONG LCSTYPE; /* What this for? */
3897 
3898 align (4) :
3899 struct NEWTEXTMETRICA
3900 {
3901     LONG tmHeight;
3902     LONG tmAscent;
3903     LONG tmDescent;
3904     LONG tmInternalLeading;
3905     LONG tmExternalLeading;
3906     LONG tmAveCharWidth;
3907     LONG tmMaxCharWidth;
3908     LONG tmWeight;
3909     LONG tmOverhang;
3910     LONG tmDigitizedAspectX;
3911     LONG tmDigitizedAspectY;
3912     BYTE tmFirstChar;
3913     BYTE tmLastChar;
3914     BYTE tmDefaultChar;
3915     BYTE tmBreakChar;
3916     BYTE tmItalic;
3917     BYTE tmUnderlined;
3918     BYTE tmStruckOut;
3919     BYTE tmPitchAndFamily;
3920     BYTE tmCharSet;
3921     DWORD ntmFlags;
3922     UINT ntmSizeEM;
3923     UINT ntmCellHeight;
3924     UINT ntmAvgWidth;
3925 }
3926 alias NEWTEXTMETRICA*PNEWTEXTMETRICA, NPNEWTEXTMETRICA, LPNEWTEXTMETRICA;
3927 
3928 struct NEWTEXTMETRICW
3929 {
3930     LONG tmHeight;
3931     LONG tmAscent;
3932     LONG tmDescent;
3933     LONG tmInternalLeading;
3934     LONG tmExternalLeading;
3935     LONG tmAveCharWidth;
3936     LONG tmMaxCharWidth;
3937     LONG tmWeight;
3938     LONG tmOverhang;
3939     LONG tmDigitizedAspectX;
3940     LONG tmDigitizedAspectY;
3941     WCHAR tmFirstChar;
3942     WCHAR tmLastChar;
3943     WCHAR tmDefaultChar;
3944     WCHAR tmBreakChar;
3945     BYTE tmItalic;
3946     BYTE tmUnderlined;
3947     BYTE tmStruckOut;
3948     BYTE tmPitchAndFamily;
3949     BYTE tmCharSet;
3950     DWORD ntmFlags;
3951     UINT ntmSizeEM;
3952     UINT ntmCellHeight;
3953     UINT ntmAvgWidth;
3954 }
3955 alias NEWTEXTMETRICW*PNEWTEXTMETRICW, NPNEWTEXTMETRICW, LPNEWTEXTMETRICW;
3956 
3957 align :
3958 struct NEWTEXTMETRICEXA
3959 {
3960     NEWTEXTMETRICA ntmTm;
3961     FONTSIGNATURE ntmFontSig;
3962 }
3963 
3964 struct NEWTEXTMETRICEXW
3965 {
3966     NEWTEXTMETRICW ntmTm;
3967     FONTSIGNATURE ntmFontSig;
3968 }
3969 
3970 struct PELARRAY
3971 {
3972     LONG paXCount;
3973     LONG paYCount;
3974     LONG paXExt;
3975     LONG paYExt;
3976     BYTE paRGBs;
3977 }
3978 alias PELARRAY*PPELARRAY, NPPELARRAY, LPPELARRAY;
3979 
3980 struct ENUMLOGFONTA
3981 {
3982     LOGFONTA elfLogFont;
3983     BYTE[LF_FULLFACESIZE] elfFullName;
3984     BYTE[LF_FACESIZE] elfStyle;
3985 }
3986 alias ENUMLOGFONTA*LPENUMLOGFONTA;
3987 
3988 struct ENUMLOGFONTW
3989 {
3990     LOGFONTW elfLogFont;
3991     WCHAR[LF_FULLFACESIZE] elfFullName;
3992     WCHAR[LF_FACESIZE] elfStyle;
3993 }
3994 alias ENUMLOGFONTW*LPENUMLOGFONTW;
3995 
3996 struct ENUMLOGFONTEXA
3997 {
3998     LOGFONTA elfLogFont;
3999     BYTE[LF_FULLFACESIZE] elfFullName;
4000     BYTE[LF_FACESIZE] elfStyle;
4001     BYTE[LF_FACESIZE] elfScript;
4002 }
4003 alias ENUMLOGFONTEXA*LPENUMLOGFONTEXA;
4004 
4005 struct ENUMLOGFONTEXW
4006 {
4007     LOGFONTW elfLogFont;
4008     WCHAR[LF_FULLFACESIZE] elfFullName;
4009     WCHAR[LF_FACESIZE] elfStyle;
4010     WCHAR[LF_FACESIZE] elfScript;
4011 }
4012 alias ENUMLOGFONTEXW*LPENUMLOGFONTEXW;
4013 
4014 struct POINTFX
4015 {
4016     FIXED x;
4017     FIXED y;
4018 }
4019 alias POINTFX*LPPOINTFX;
4020 
4021 struct TTPOLYCURVE
4022 {
4023     WORD wType;
4024     WORD cpfx;
4025     POINTFX[1] apfx;
4026 }
4027 alias TTPOLYCURVE*LPTTPOLYCURVE;
4028 
4029 struct TTPOLYGONHEADER
4030 {
4031     DWORD cb;
4032     DWORD dwType;
4033     POINTFX pfxStart;
4034 }
4035 alias TTPOLYGONHEADER*LPTTPOLYGONHEADER;
4036 
4037 struct POINTFLOAT
4038 {
4039     FLOAT x;
4040     FLOAT y;
4041 }
4042 alias POINTFLOAT*PPOINTFLOAT;
4043 
4044 struct GLYPHMETRICSFLOAT
4045 {
4046     FLOAT gmfBlackBoxX;
4047     FLOAT gmfBlackBoxY;
4048     POINTFLOAT gmfptGlyphOrigin;
4049     FLOAT gmfCellIncX;
4050     FLOAT gmfCellIncY;
4051 }
4052 alias GLYPHMETRICSFLOAT*PGLYPHMETRICSFLOAT, LPGLYPHMETRICSFLOAT;
4053 
4054 struct LAYERPLANEDESCRIPTOR
4055 {
4056     WORD nSize;
4057     WORD nVersion;
4058     DWORD dwFlags;
4059     BYTE iPixelType;
4060     BYTE cColorBits;
4061     BYTE cRedBits;
4062     BYTE cRedShift;
4063     BYTE cGreenBits;
4064     BYTE cGreenShift;
4065     BYTE cBlueBits;
4066     BYTE cBlueShift;
4067     BYTE cAlphaBits;
4068     BYTE cAlphaShift;
4069     BYTE cAccumBits;
4070     BYTE cAccumRedBits;
4071     BYTE cAccumGreenBits;
4072     BYTE cAccumBlueBits;
4073     BYTE cAccumAlphaBits;
4074     BYTE cDepthBits;
4075     BYTE cStencilBits;
4076     BYTE cAuxBuffers;
4077     BYTE iLayerPlane;
4078     BYTE bReserved;
4079     COLORREF crTransparent;
4080 }
4081 alias LAYERPLANEDESCRIPTOR*PLAYERPLANEDESCRIPTOR, LPLAYERPLANEDESCRIPTOR;
4082 
4083 struct BLENDFUNCTION
4084 {
4085     BYTE BlendOp;
4086     BYTE BlendFlags;
4087     BYTE SourceConstantAlpha;
4088     BYTE AlphaFormat;
4089 }
4090 alias BLENDFUNCTION*PBLENDFUNCTION, LPBLENDFUNCTION;
4091 
4092 const MM_MAX_NUMAXES = 16;
4093 
4094 struct DESIGNVECTOR
4095 {
4096     DWORD dvReserved;
4097     DWORD dvNumAxes;
4098     LONG[MM_MAX_NUMAXES] dvValues;
4099 }
4100 alias DESIGNVECTOR*PDESIGNVECTOR, LPDESIGNVECTOR;
4101 const STAMP_DESIGNVECTOR = 0x8000000 + 'd' + ('v' << 8);
4102 const STAMP_AXESLIST     = 0x8000000 + 'a' + ('l' << 8);
4103 
4104 static
4105 
4106 if (_WIN32_WINNT >= 0x0500)
4107 {
4108     const MM_MAX_AXES_NAMELEN = 16;
4109 
4110     struct AXISINFOA
4111     {
4112         LONG axMinValue;
4113         LONG axMaxValue;
4114         BYTE[MM_MAX_AXES_NAMELEN] axAxisName;
4115     }
4116     alias AXISINFOA*PAXISINFOA, LPAXISINFOA;
4117 
4118     struct AXISINFOW
4119     {
4120         LONG axMinValue;
4121         LONG axMaxValue;
4122         WCHAR[MM_MAX_AXES_NAMELEN] axAxisName;
4123     }
4124     alias AXISINFOW*PAXISINFOW, LPAXISINFOW;
4125 
4126     version (Unicode)
4127     {
4128         alias AXISINFOW   AXISINFO;
4129         alias PAXISINFOW  PAXISINFO;
4130         alias LPAXISINFOW LPAXISINFO;
4131     }
4132     else
4133     {
4134         alias AXISINFOA   AXISINFO;
4135         alias PAXISINFOA  PAXISINFO;
4136         alias LPAXISINFOA LPAXISINFO;
4137     }
4138 
4139     struct AXESLISTA
4140     {
4141         DWORD axlReserved;
4142         DWORD axlNumAxes;
4143         AXISINFOA[MM_MAX_NUMAXES] axlAxisInfo;
4144     }
4145     alias AXESLISTA*PAXESLISTA, LPAXESLISTA;
4146 
4147     struct AXESLISTW
4148     {
4149         DWORD axlReserved;
4150         DWORD axlNumAxes;
4151         AXISINFOW[MM_MAX_NUMAXES] axlAxisInfo;
4152     }
4153     alias AXESLISTW*PAXESLISTW, LPAXESLISTW;
4154 
4155     version (Unicode)
4156     {
4157         alias AXESLISTW   AXESLIST;
4158         alias PAXESLISTW  PAXESLIST;
4159         alias LPAXESLISTW LPAXESLIST;
4160     }
4161     else
4162     {
4163         alias AXESLISTA   AXESLIST;
4164         alias PAXESLISTA  PAXESLIST;
4165         alias LPAXESLISTA LPAXESLIST;
4166     }
4167 
4168     struct ENUMLOGFONTEXDVA
4169     {
4170         ENUMLOGFONTEXA elfEnumLogfontEx;
4171         DESIGNVECTOR elfDesignVector;
4172     }
4173     alias ENUMLOGFONTEXDVA*PENUMLOGFONTEXDVA, LPENUMLOGFONTEXDVA;
4174 
4175     struct ENUMLOGFONTEXDVW
4176     {
4177         ENUMLOGFONTEXW elfEnumLogfontEx;
4178         DESIGNVECTOR elfDesignVector;
4179     }
4180     alias ENUMLOGFONTEXDVW*PENUMLOGFONTEXDVW, LPENUMLOGFONTEXDVW;
4181 
4182     HFONT CreateFontIndirectExA(ENUMLOGFONTEXDVA*);
4183 
4184     HFONT CreateFontIndirectExW(ENUMLOGFONTEXDVW*);
4185 
4186     version (Unicode)
4187         alias CreateFontIndirectExW CreateFontIndirectEx;
4188     else
4189         alias CreateFontIndirectExA CreateFontIndirectEx;
4190 
4191     struct ENUMTEXTMETRICA
4192     {
4193         NEWTEXTMETRICEXA etmNewTextMetricEx;
4194         AXESLISTA etmAxesList;
4195     }
4196     alias ENUMTEXTMETRICA*PENUMTEXTMETRICA, LPENUMTEXTMETRICA;
4197 
4198     struct ENUMTEXTMETRICW
4199     {
4200         NEWTEXTMETRICEXW etmNewTextMetricEx;
4201         AXESLISTW etmAxesList;
4202     }
4203     alias ENUMTEXTMETRICW*PENUMTEXTMETRICW, LPENUMTEXTMETRICW;
4204 
4205     version (Unicode)
4206     {
4207         alias ENUMTEXTMETRICW   ENUMTEXTMETRIC;
4208         alias PENUMTEXTMETRICW  PENUMTEXTMETRIC;
4209         alias LPENUMTEXTMETRICW LPENUMTEXTMETRIC;
4210     }
4211     else
4212     {
4213         alias ENUMTEXTMETRICA   ENUMTEXTMETRIC;
4214         alias PENUMTEXTMETRICA  PENUMTEXTMETRIC;
4215         alias LPENUMTEXTMETRICA LPENUMTEXTMETRIC;
4216     }
4217 } /* _WIN32_WINNT >= 0x0500 */
4218 
4219 struct GRADIENT_TRIANGLE
4220 {
4221     ULONG Vertex1;
4222     ULONG Vertex2;
4223     ULONG Vertex3;
4224 }
4225 alias GRADIENT_TRIANGLE*PGRADIENT_TRIANGLE, LPGRADIENT_TRIANGLE;
4226 
4227 struct GRADIENT_RECT
4228 {
4229     ULONG UpperLeft;
4230     ULONG LowerRight;
4231 }
4232 alias GRADIENT_RECT*PGRADIENT_RECT, LPGRADIENT_RECT;
4233 
4234 struct DISPLAY_DEVICEA
4235 {
4236     DWORD cb;
4237     CHAR[32] DeviceName;
4238     CHAR[128] DeviceString;
4239     DWORD StateFlags;
4240     CHAR[128] DeviceID;
4241     CHAR[128] DeviceKey;
4242 }
4243 alias DISPLAY_DEVICEA*PDISPLAY_DEVICEA, LPDISPLAY_DEVICEA;
4244 
4245 struct DISPLAY_DEVICEW
4246 {
4247     DWORD cb;
4248     WCHAR[32] DeviceName;
4249     WCHAR[128] DeviceString;
4250     DWORD StateFlags;
4251     WCHAR[128] DeviceID;
4252     WCHAR[128] DeviceKey;
4253 }
4254 alias DISPLAY_DEVICEW*PDISPLAY_DEVICEW, LPDISPLAY_DEVICEW;
4255 
4256 static
4257 
4258 if (WINVER >= 0x0400)
4259 {
4260     struct DRAWPATRECT
4261     {
4262         POINT ptPosition;
4263         POINT ptSize;
4264         WORD wStyle;
4265         WORD wPattern;
4266     }
4267     alias DRAWPATRECT*PDRAWPATRECT;
4268 }
4269 
4270 // ---------
4271 // Callbacks
4272 
4273 alias BOOL function(HDC, int) ABORTPROC;
4274 
4275 alias int function(HDC, HANDLETABLE*, METARECORD*, int, LPARAM) MFENUMPROC;
4276 
4277 alias int function(HDC, HANDLETABLE*, CPtr!(ENHMETARECORD), int, LPARAM) ENHMFENUMPROC;
4278 
4279 alias int function(CPtr!(LOGFONTA), CPtr!(TEXTMETRICA), DWORD, LPARAM) FONTENUMPROCA, OLDFONTENUMPROCA;
4280 
4281 alias int function(CPtr!(LOGFONTW), CPtr!(TEXTMETRICW), DWORD, LPARAM) FONTENUMPROCW, OLDFONTENUMPROCW;
4282 
4283 alias int function(LPSTR, LPARAM) ICMENUMPROCA;
4284 
4285 alias int function(LPWSTR, LPARAM) ICMENUMPROCW;
4286 
4287 alias void function(LPVOID, LPARAM) GOBJENUMPROC;
4288 
4289 alias void function(int, int, LPARAM) LINEDDAPROC;
4290 
4291 alias UINT function(HWND, HMODULE, LPDEVMODEA, LPSTR, LPSTR, LPDEVMODEA, LPSTR, UINT) LPFNDEVMODE;
4292 
4293 alias DWORD function(LPSTR, LPSTR, UINT, LPSTR, LPDEVMODEA) LPFNDEVCAPS;
4294 
4295 // ---------
4296 // C Macros.
4297 // FIXME:
4298 // POINTS MAKEPOINTS(DWORD dwValue) #define MAKEPOINTS(l) (*((POINTS*)&(l)))
4299 DWORD MAKEROP4(DWORD fore, DWORD back)
4300 {
4301     return ((back << 8) & 0xFF000000) | (fore);
4302 }
4303 
4304 
4305 COLORREF CMYK(BYTE c, BYTE m, BYTE y, BYTE k)
4306 {
4307     return cast(COLORREF) (k | (y << 8) | (m << 16) | (c << 24));
4308 }
4309 
4310 
4311 BYTE GetCValue(COLORREF cmyk)
4312 {
4313     return cast(BYTE) (cmyk >> 24);
4314 }
4315 
4316 
4317 BYTE GetMValue(COLORREF cmyk)
4318 {
4319     return cast(BYTE) (cmyk >> 16);
4320 }
4321 
4322 
4323 BYTE GetYValue(COLORREF cmyk)
4324 {
4325     return cast(BYTE) (cmyk >> 8);
4326 }
4327 
4328 
4329 BYTE GetKValue(COLORREF cmyk)
4330 {
4331     return cast(BYTE) cmyk;
4332 }
4333 
4334 
4335 COLORREF RGB(BYTE r, BYTE g, BYTE b)
4336 {
4337     return cast(COLORREF) (r | (g << 8) | (b << 16));
4338 }
4339 
4340 
4341 BYTE GetRValue(COLORREF c)
4342 {
4343     return cast(BYTE) c;
4344 }
4345 
4346 
4347 BYTE GetGValue(COLORREF c)
4348 {
4349     return cast(BYTE) (c >> 8);
4350 }
4351 
4352 
4353 BYTE GetBValue(COLORREF c)
4354 {
4355     return cast(BYTE) (c >> 16);
4356 }
4357 
4358 
4359 COLORREF PALETTEINDEX(WORD i)
4360 {
4361     return 0x01000000 | cast(COLORREF) i;
4362 }
4363 
4364 
4365 COLORREF PALETTERGB(BYTE r, BYTE g, BYTE b)
4366 {
4367     return 0x02000000 | RGB(r, g, b);
4368 }
4369 
4370 
4371 extern (Windows) {
4372 int AbortDoc(HDC);
4373 
4374 BOOL AbortPath(HDC);
4375 
4376 int AddFontResourceA(LPCSTR);
4377 
4378 int AddFontResourceW(LPCWSTR);
4379 
4380 BOOL AngleArc(HDC, int, int, DWORD, FLOAT, FLOAT);
4381 
4382 BOOL AnimatePalette(HPALETTE, UINT, UINT, CPtr!(PALETTEENTRY));
4383 
4384 BOOL Arc(HDC, int, int, int, int, int, int, int, int);
4385 
4386 BOOL ArcTo(HDC, int, int, int, int, int, int, int, int);
4387 
4388 BOOL BeginPath(HDC);
4389 
4390 BOOL BitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
4391 
4392 BOOL CancelDC(HDC);
4393 
4394 BOOL CheckColorsInGamut(HDC, PVOID, PVOID, DWORD);
4395 
4396 BOOL Chord(HDC, int, int, int, int, int, int, int, int);
4397 
4398 int ChoosePixelFormat(HDC, CPtr!(PIXELFORMATDESCRIPTOR));
4399 
4400 HENHMETAFILE CloseEnhMetaFile(HDC);
4401 
4402 BOOL CloseFigure(HDC);
4403 
4404 HMETAFILE CloseMetaFile(HDC);
4405 
4406 BOOL ColorMatchToTarget(HDC, HDC, DWORD);
4407 
4408 BOOL ColorCorrectPalette(HDC, HPALETTE, DWORD, DWORD);
4409 
4410 int CombineRgn(HRGN, HRGN, HRGN, int);
4411 
4412 BOOL CombineTransform(LPXFORM, CPtr!(XFORM), CPtr!(XFORM));
4413 
4414 HENHMETAFILE CopyEnhMetaFileA(HENHMETAFILE, LPCSTR);
4415 
4416 HENHMETAFILE CopyEnhMetaFileW(HENHMETAFILE, LPCWSTR);
4417 
4418 HMETAFILE CopyMetaFileA(HMETAFILE, LPCSTR);
4419 
4420 HMETAFILE CopyMetaFileW(HMETAFILE, LPCWSTR);
4421 
4422 HBITMAP CreateBitmap(int, int, UINT, UINT, PCVOID);
4423 
4424 HBITMAP CreateBitmapIndirect(CPtr!(BITMAP));
4425 
4426 HBRUSH CreateBrushIndirect(CPtr!(LOGBRUSH));
4427 
4428 HCOLORSPACE CreateColorSpaceA(LPLOGCOLORSPACEA);
4429 
4430 HCOLORSPACE CreateColorSpaceW(LPLOGCOLORSPACEW);
4431 
4432 HBITMAP CreateCompatibleBitmap(HDC, int, int);
4433 
4434 HDC CreateCompatibleDC(HDC);
4435 
4436 HDC CreateDCA(LPCSTR, LPCSTR, LPCSTR, CPtr!(DEVMODEA));
4437 
4438 HDC CreateDCW(LPCWSTR, LPCWSTR, LPCWSTR, CPtr!(DEVMODEW));
4439 
4440 HBITMAP CreateDIBitmap(HDC, CPtr!(BITMAPINFOHEADER), DWORD, PCVOID, CPtr!(BITMAPINFO), UINT);
4441 
4442 HBRUSH CreateDIBPatternBrush(HGLOBAL, UINT);
4443 
4444 HBRUSH CreateDIBPatternBrushPt(PCVOID, UINT);
4445 
4446 HBITMAP CreateDIBSection(HDC, CPtr!(BITMAPINFO), UINT, void**, HANDLE, DWORD);
4447 
4448 HBITMAP CreateDiscardableBitmap(HDC, int, int);
4449 
4450 HRGN CreateEllipticRgn(int, int, int, int);
4451 
4452 HRGN CreateEllipticRgnIndirect(LPCRECT);
4453 
4454 HDC CreateEnhMetaFileA(HDC, LPCSTR, LPCRECT, LPCSTR);
4455 
4456 HDC CreateEnhMetaFileW(HDC, LPCWSTR, LPCRECT, LPCWSTR);
4457 
4458 HFONT CreateFontA(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCSTR);
4459 
4460 HFONT CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR);
4461 
4462 HFONT CreateFontIndirectA(CPtr!(LOGFONTA));
4463 
4464 HFONT CreateFontIndirectW(CPtr!(LOGFONTW));
4465 
4466 HPALETTE CreateHalftonePalette(HDC);
4467 
4468 HBRUSH CreateHatchBrush(int, COLORREF);
4469 
4470 HDC CreateICA(LPCSTR, LPCSTR, LPCSTR, CPtr!(DEVMODEA));
4471 
4472 HDC CreateICW(LPCWSTR, LPCWSTR, LPCWSTR, CPtr!(DEVMODEW));
4473 
4474 HDC CreateMetaFileA(LPCSTR);
4475 
4476 HDC CreateMetaFileW(LPCWSTR);
4477 
4478 HPALETTE CreatePalette(CPtr!(LOGPALETTE));
4479 
4480 HBRUSH CreatePatternBrush(HBITMAP);
4481 
4482 HPEN CreatePen(int, int, COLORREF);
4483 
4484 HPEN CreatePenIndirect(CPtr!(LOGPEN));
4485 
4486 HRGN CreatePolygonRgn(CPtr!(POINT), int, int);
4487 
4488 HRGN CreatePolyPolygonRgn(CPtr!(POINT), CPtr!(INT), int, int);
4489 
4490 HRGN CreateRectRgn(int, int, int, int);
4491 
4492 HRGN CreateRectRgnIndirect(LPCRECT);
4493 
4494 HRGN CreateRoundRectRgn(int, int, int, int, int, int);
4495 
4496 BOOL CreateScalableFontResourceA(DWORD, LPCSTR, LPCSTR, LPCSTR);
4497 
4498 BOOL CreateScalableFontResourceW(DWORD, LPCWSTR, LPCWSTR, LPCWSTR);
4499 
4500 HBRUSH CreateSolidBrush(COLORREF);
4501 
4502 BOOL DeleteColorSpace(HCOLORSPACE);
4503 
4504 BOOL DeleteDC(HDC);
4505 
4506 BOOL DeleteEnhMetaFile(HENHMETAFILE);
4507 
4508 BOOL DeleteMetaFile(HMETAFILE);
4509 
4510 BOOL DeleteObject(HGDIOBJ);
4511 
4512 int DescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
4513 
4514 DWORD DeviceCapabilitiesA(LPCSTR, LPCSTR, WORD, LPSTR, CPtr!(DEVMODEA));
4515 
4516 DWORD DeviceCapabilitiesW(LPCWSTR, LPCWSTR, WORD, LPWSTR, CPtr!(DEVMODEW));
4517 
4518 BOOL DPtoLP(HDC, LPPOINT, int);
4519 
4520 int DrawEscape(HDC, int, int, LPCSTR);
4521 
4522 BOOL Ellipse(HDC, int, int, int, int);
4523 
4524 int EndDoc(HDC);
4525 
4526 int EndPage(HDC);
4527 
4528 BOOL EndPath(HDC);
4529 
4530 BOOL EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMFENUMPROC, PVOID, LPCRECT);
4531 
4532 int EnumFontFamiliesA(HDC, LPCSTR, FONTENUMPROCA, LPARAM);
4533 
4534 int EnumFontFamiliesW(HDC, LPCWSTR, FONTENUMPROCW, LPARAM);
4535 
4536 int EnumFontFamiliesExA(HDC, PLOGFONTA, FONTENUMPROCA, LPARAM, DWORD);
4537 
4538 int EnumFontFamiliesExW(HDC, PLOGFONTW, FONTENUMPROCW, LPARAM, DWORD);
4539 
4540 int EnumFontsA(HDC, LPCSTR, FONTENUMPROCA, LPARAM);
4541 
4542 int EnumFontsW(HDC, LPCWSTR, FONTENUMPROCW, LPARAM);
4543 
4544 int EnumICMProfilesA(HDC, ICMENUMPROCA, LPARAM);
4545 
4546 int EnumICMProfilesW(HDC, ICMENUMPROCW, LPARAM);
4547 
4548 BOOL EnumMetaFile(HDC, HMETAFILE, MFENUMPROC, LPARAM);
4549 
4550 int EnumObjects(HDC, int, GOBJENUMPROC, LPARAM);
4551 
4552 BOOL EqualRgn(HRGN, HRGN);
4553 
4554 int Escape(HDC, int, int, LPCSTR, PVOID);
4555 
4556 int ExcludeClipRect(HDC, int, int, int, int);
4557 
4558 int ExcludeUpdateRgn(HDC, HWND);
4559 
4560 HPEN ExtCreatePen(DWORD, DWORD, CPtr!(LOGBRUSH), DWORD, CPtr!(DWORD));
4561 
4562 HRGN ExtCreateRegion(CPtr!(XFORM), DWORD, CPtr!(RGNDATA));
4563 
4564 int ExtEscape(HDC, int, int, LPCSTR, int, LPSTR);
4565 
4566 BOOL ExtFloodFill(HDC, int, int, COLORREF, UINT);
4567 
4568 int ExtSelectClipRgn(HDC, HRGN, int);
4569 
4570 BOOL ExtTextOutA(HDC, int, int, UINT, LPCRECT, LPCSTR, UINT, CPtr!(INT));
4571 
4572 BOOL ExtTextOutW(HDC, int, int, UINT, LPCRECT, LPCWSTR, UINT, CPtr!(INT));
4573 
4574 BOOL FillPath(HDC);
4575 
4576 int FillRect(HDC, LPCRECT, HBRUSH);
4577 
4578 int FillRgn(HDC, HRGN, HBRUSH);
4579 
4580 BOOL FixBrushOrgEx(HDC, int, int, LPPOINT);
4581 
4582 BOOL FlattenPath(HDC);
4583 
4584 BOOL FloodFill(HDC, int, int, COLORREF);
4585 
4586 BOOL FrameRgn(HDC, HRGN, HBRUSH, int, int);
4587 
4588 BOOL GdiComment(HDC, UINT, CPtr!(BYTE));
4589 
4590 BOOL GdiFlush();
4591 
4592 DWORD GdiGetBatchLimit();
4593 
4594 DWORD GdiSetBatchLimit(DWORD);
4595 
4596 int GetArcDirection(HDC);
4597 
4598 BOOL GetAspectRatioFilterEx(HDC, LPSIZE);
4599 
4600 LONG GetBitmapBits(HBITMAP, LONG, PVOID);
4601 
4602 BOOL GetBitmapDimensionEx(HBITMAP, LPSIZE);
4603 
4604 COLORREF GetBkColor(HDC);
4605 
4606 int GetBkMode(HDC);
4607 
4608 UINT GetBoundsRect(HDC, LPRECT, UINT);
4609 
4610 BOOL GetBrushOrgEx(HDC, LPPOINT);
4611 
4612 BOOL GetCharABCWidthsA(HDC, UINT, UINT, LPABC);
4613 
4614 BOOL GetCharABCWidthsW(HDC, UINT, UINT, LPABC);
4615 
4616 BOOL GetCharABCWidthsFloatA(HDC, UINT, UINT, LPABCFLOAT);
4617 
4618 BOOL GetCharABCWidthsFloatW(HDC, UINT, UINT, LPABCFLOAT);
4619 
4620 DWORD GetCharacterPlacementA(HDC, LPCSTR, int, int, LPGCP_RESULTSA, DWORD);
4621 
4622 DWORD GetCharacterPlacementW(HDC, LPCWSTR, int, int, LPGCP_RESULTSW, DWORD);
4623 
4624 BOOL GetCharWidth32A(HDC, UINT, UINT, LPINT);
4625 
4626 BOOL GetCharWidth32W(HDC, UINT, UINT, LPINT);
4627 
4628 BOOL GetCharWidthA(HDC, UINT, UINT, LPINT);
4629 
4630 BOOL GetCharWidthW(HDC, UINT, UINT, LPINT);
4631 
4632 BOOL GetCharWidthFloatA(HDC, UINT, UINT, PFLOAT);
4633 
4634 BOOL GetCharWidthFloatW(HDC, UINT, UINT, PFLOAT);
4635 
4636 int GetClipBox(HDC, LPRECT);
4637 
4638 int GetClipRgn(HDC, HRGN);
4639 
4640 BOOL GetColorAdjustment(HDC, LPCOLORADJUSTMENT);
4641 
4642 HANDLE GetColorSpace(HDC);
4643 
4644 HGDIOBJ GetCurrentObject(HDC, UINT);
4645 
4646 BOOL GetCurrentPositionEx(HDC, LPPOINT);
4647 
4648 HCURSOR GetCursor();
4649 
4650 BOOL GetDCOrgEx(HDC, LPPOINT);
4651 
4652 int GetDeviceCaps(HDC, int);
4653 
4654 BOOL GetDeviceGammaRamp(HDC, PVOID);
4655 
4656 UINT GetDIBColorTable(HDC, UINT, UINT, RGBQUAD*);
4657 
4658 int GetDIBits(HDC, HBITMAP, UINT, UINT, PVOID, LPBITMAPINFO, UINT);
4659 
4660 HENHMETAFILE GetEnhMetaFileA(LPCSTR);
4661 
4662 HENHMETAFILE GetEnhMetaFileW(LPCWSTR);
4663 
4664 UINT GetEnhMetaFileBits(HENHMETAFILE, UINT, LPBYTE);
4665 
4666 UINT GetEnhMetaFileDescriptionA(HENHMETAFILE, UINT, LPSTR);
4667 
4668 UINT GetEnhMetaFileDescriptionW(HENHMETAFILE, UINT, LPWSTR);
4669 
4670 UINT GetEnhMetaFileHeader(HENHMETAFILE, UINT, LPENHMETAHEADER);
4671 
4672 UINT GetEnhMetaFilePaletteEntries(HENHMETAFILE, UINT, LPPALETTEENTRY);
4673 
4674 UINT GetEnhMetaFilePixelFormat(HENHMETAFILE, DWORD, CPtr!(PIXELFORMATDESCRIPTOR));
4675 
4676 DWORD GetFontData(HDC, DWORD, DWORD, PVOID, DWORD);
4677 
4678 DWORD GetFontLanguageInfo(HDC);
4679 
4680 DWORD GetGlyphOutlineA(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, PVOID, CPtr!(MAT2));
4681 
4682 DWORD GetGlyphOutlineW(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, PVOID, CPtr!(MAT2));
4683 
4684 int GetGraphicsMode(HDC);
4685 
4686 BOOL GetICMProfileA(HDC, DWORD, LPSTR);
4687 
4688 BOOL GetICMProfileW(HDC, DWORD, LPWSTR);
4689 
4690 DWORD GetKerningPairsA(HDC, DWORD, LPKERNINGPAIR);
4691 
4692 DWORD GetKerningPairsW(HDC, DWORD, LPKERNINGPAIR);
4693 
4694 BOOL GetLogColorSpaceA(HCOLORSPACE, LPLOGCOLORSPACEA, DWORD);
4695 
4696 BOOL GetLogColorSpaceW(HCOLORSPACE, LPLOGCOLORSPACEW, DWORD);
4697 
4698 int GetMapMode(HDC);
4699 
4700 HMETAFILE GetMetaFileA(LPCSTR);
4701 
4702 HMETAFILE GetMetaFileW(LPCWSTR);
4703 
4704 UINT GetMetaFileBitsEx(HMETAFILE, UINT, PVOID);
4705 
4706 int GetMetaRgn(HDC, HRGN);
4707 
4708 BOOL GetMiterLimit(HDC, PFLOAT);
4709 
4710 COLORREF GetNearestColor(HDC, COLORREF);
4711 
4712 UINT GetNearestPaletteIndex(HPALETTE, COLORREF);
4713 
4714 int GetObjectA(HGDIOBJ, int, PVOID);
4715 
4716 int GetObjectW(HGDIOBJ, int, PVOID);
4717 
4718 DWORD GetObjectType(HGDIOBJ);
4719 
4720 UINT GetOutlineTextMetricsA(HDC, UINT, LPOUTLINETEXTMETRICA);
4721 
4722 UINT GetOutlineTextMetricsW(HDC, UINT, LPOUTLINETEXTMETRICW);
4723 
4724 UINT GetPaletteEntries(HPALETTE, UINT, UINT, LPPALETTEENTRY);
4725 
4726 int GetPath(HDC, LPPOINT, PBYTE, int);
4727 
4728 COLORREF GetPixel(HDC, int, int);
4729 
4730 int GetPixelFormat(HDC);
4731 
4732 int GetPolyFillMode(HDC);
4733 
4734 BOOL GetRasterizerCaps(LPRASTERIZER_STATUS, UINT);
4735 
4736 int GetRandomRgn(HDC, HRGN, INT);
4737 
4738 DWORD GetRegionData(HRGN, DWORD, LPRGNDATA);
4739 
4740 int GetRgnBox(HRGN, LPRECT);
4741 
4742 int GetROP2(HDC);
4743 
4744 HGDIOBJ GetStockObject(int);
4745 
4746 int GetStretchBltMode(HDC);
4747 
4748 UINT GetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY);
4749 
4750 UINT GetSystemPaletteUse(HDC);
4751 
4752 UINT GetTextAlign(HDC);
4753 
4754 int GetTextCharacterExtra(HDC);
4755 
4756 int GetTextCharset(HDC);
4757 
4758 int GetTextCharsetInfo(HDC, LPFONTSIGNATURE, DWORD);
4759 
4760 COLORREF GetTextColor(HDC);
4761 
4762 BOOL GetTextExtentExPointA(HDC, LPCSTR, int, int, LPINT, LPINT, LPSIZE);
4763 
4764 BOOL GetTextExtentExPointW(HDC, LPCWSTR, int, int, LPINT, LPINT, LPSIZE);
4765 
4766 BOOL GetTextExtentPointA(HDC, LPCSTR, int, LPSIZE);
4767 
4768 BOOL GetTextExtentPointW(HDC, LPCWSTR, int, LPSIZE);
4769 
4770 BOOL GetTextExtentPoint32A(HDC, LPCSTR, int, LPSIZE);
4771 
4772 BOOL GetTextExtentPoint32W(HDC, LPCWSTR, int, LPSIZE);
4773 
4774 int GetTextFaceA(HDC, int, LPSTR);
4775 
4776 int GetTextFaceW(HDC, int, LPWSTR);
4777 
4778 BOOL GetTextMetricsA(HDC, LPTEXTMETRICA);
4779 
4780 BOOL GetTextMetricsW(HDC, LPTEXTMETRICW);
4781 
4782 BOOL GetViewportExtEx(HDC, LPSIZE);
4783 
4784 BOOL GetViewportOrgEx(HDC, LPPOINT);
4785 
4786 BOOL GetWindowExtEx(HDC, LPSIZE);
4787 
4788 BOOL GetWindowOrgEx(HDC, LPPOINT);
4789 
4790 UINT GetWinMetaFileBits(HENHMETAFILE, UINT, LPBYTE, INT, HDC);
4791 
4792 BOOL GetWorldTransform(HDC, LPXFORM);
4793 
4794 int IntersectClipRect(HDC, int, int, int, int);
4795 
4796 BOOL InvertRgn(HDC, HRGN);
4797 
4798 BOOL LineDDA(int, int, int, int, LINEDDAPROC, LPARAM);
4799 
4800 BOOL LineTo(HDC, int, int);
4801 
4802 BOOL LPtoDP(HDC, LPPOINT, int);
4803 
4804 BOOL MaskBlt(HDC, int, int, int, int, HDC, int, int, HBITMAP, int, int, DWORD);
4805 
4806 BOOL ModifyWorldTransform(HDC, CPtr!(XFORM), DWORD);
4807 
4808 BOOL MoveToEx(HDC, int, int, LPPOINT);
4809 
4810 int OffsetClipRgn(HDC, int, int);
4811 
4812 int OffsetRgn(HRGN, int, int);
4813 
4814 BOOL OffsetViewportOrgEx(HDC, int, int, LPPOINT);
4815 
4816 BOOL OffsetWindowOrgEx(HDC, int, int, LPPOINT);
4817 
4818 BOOL PaintRgn(HDC, HRGN);
4819 
4820 BOOL PatBlt(HDC, int, int, int, int, DWORD);
4821 
4822 HRGN PathToRegion(HDC);
4823 
4824 BOOL Pie(HDC, int, int, int, int, int, int, int, int);
4825 
4826 BOOL PlayEnhMetaFile(HDC, HENHMETAFILE, LPCRECT);
4827 
4828 BOOL PlayEnhMetaFileRecord(HDC, LPHANDLETABLE, CPtr!(ENHMETARECORD), UINT);
4829 
4830 BOOL PlayMetaFile(HDC, HMETAFILE);
4831 
4832 BOOL PlayMetaFileRecord(HDC, LPHANDLETABLE, LPMETARECORD, UINT);
4833 
4834 BOOL PlgBlt(HDC, CPtr!(POINT), HDC, int, int, int, int, HBITMAP, int, int);
4835 
4836 BOOL PolyBezier(HDC, CPtr!(POINT), DWORD);
4837 
4838 BOOL PolyBezierTo(HDC, CPtr!(POINT), DWORD);
4839 
4840 BOOL PolyDraw(HDC, CPtr!(POINT), CPtr!(BYTE), int);
4841 
4842 BOOL Polygon(HDC, CPtr!(POINT), int);
4843 
4844 BOOL Polyline(HDC, CPtr!(POINT), int);
4845 
4846 BOOL PolylineTo(HDC, CPtr!(POINT), DWORD);
4847 
4848 BOOL PolyPolygon(HDC, CPtr!(POINT), CPtr!(INT), int);
4849 
4850 BOOL PolyPolyline(HDC, CPtr!(POINT), CPtr!(DWORD), DWORD);
4851 
4852 BOOL PolyTextOutA(HDC, CPtr!(POLYTEXTA), int);
4853 
4854 BOOL PolyTextOutW(HDC, CPtr!(POLYTEXTW), int);
4855 
4856 BOOL PtInRegion(HRGN, int, int);
4857 
4858 BOOL PtVisible(HDC, int, int);
4859 
4860 UINT RealizePalette(HDC);
4861 
4862 BOOL Rectangle(HDC, int, int, int, int);
4863 
4864 BOOL RectInRegion(HRGN, LPCRECT);
4865 
4866 BOOL RectVisible(HDC, LPCRECT);
4867 
4868 BOOL RemoveFontResourceA(LPCSTR);
4869 
4870 BOOL RemoveFontResourceW(LPCWSTR);
4871 
4872 HDC ResetDCA(HDC, CPtr!(DEVMODEA));
4873 
4874 HDC ResetDCW(HDC, CPtr!(DEVMODEW));
4875 
4876 BOOL ResizePalette(HPALETTE, UINT);
4877 
4878 BOOL RestoreDC(HDC, int);
4879 
4880 BOOL RoundRect(HDC, int, int, int, int, int, int);
4881 
4882 int SaveDC(HDC);
4883 
4884 BOOL ScaleViewportExtEx(HDC, int, int, int, int, LPSIZE);
4885 
4886 BOOL ScaleWindowExtEx(HDC, int, int, int, int, LPSIZE);
4887 
4888 BOOL SelectClipPath(HDC, int);
4889 
4890 int SelectClipRgn(HDC, HRGN);
4891 
4892 HGDIOBJ SelectObject(HDC, HGDIOBJ);
4893 
4894 HPALETTE SelectPalette(HDC, HPALETTE, BOOL);
4895 
4896 int SetAbortProc(HDC, ABORTPROC);
4897 
4898 int SetArcDirection(HDC, int);
4899 
4900 LONG SetBitmapBits(HBITMAP, DWORD, PCVOID);
4901 
4902 BOOL SetBitmapDimensionEx(HBITMAP, int, int, LPSIZE);
4903 
4904 COLORREF SetBkColor(HDC, COLORREF);
4905 
4906 int SetBkMode(HDC, int);
4907 
4908 UINT SetBoundsRect(HDC, LPCRECT, UINT);
4909 
4910 BOOL SetBrushOrgEx(HDC, int, int, LPPOINT);
4911 
4912 BOOL SetColorAdjustment(HDC, CPtr!(COLORADJUSTMENT));
4913 
4914 BOOL SetColorSpace(HDC, HCOLORSPACE);
4915 
4916 BOOL SetDeviceGammaRamp(HDC, PVOID);
4917 
4918 UINT SetDIBColorTable(HDC, UINT, UINT, CPtr!(RGBQUAD));
4919 
4920 int SetDIBits(HDC, HBITMAP, UINT, UINT, PCVOID, CPtr!(BITMAPINFO), UINT);
4921 
4922 int SetDIBitsToDevice(HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, PCVOID, CPtr!(BITMAPINFO), UINT);
4923 
4924 HENHMETAFILE SetEnhMetaFileBits(UINT, CPtr!(BYTE));
4925 
4926 int SetGraphicsMode(HDC, int);
4927 
4928 int SetICMMode(HDC, int);
4929 
4930 BOOL SetICMProfileA(HDC, LPSTR);
4931 
4932 BOOL SetICMProfileW(HDC, LPWSTR);
4933 
4934 int SetMapMode(HDC, int);
4935 
4936 static
4937 
4938 if (WINVER >= 0x0500)
4939 {
4940     DWORD SetLayout(HDC hdc, DWORD l);
4941 
4942     DWORD GetLayout(HDC hdc);
4943 }
4944 
4945 DWORD SetMapperFlags(HDC, DWORD);
4946 
4947 HMETAFILE SetMetaFileBitsEx(UINT, CPtr!(BYTE));
4948 
4949 int SetMetaRgn(HDC);
4950 
4951 BOOL SetMiterLimit(HDC, FLOAT, PFLOAT);
4952 
4953 UINT SetPaletteEntries(HPALETTE, UINT, UINT, CPtr!(PALETTEENTRY));
4954 
4955 COLORREF SetPixel(HDC, int, int, COLORREF);
4956 
4957 BOOL SetPixelFormat(HDC, int, CPtr!(PIXELFORMATDESCRIPTOR));
4958 
4959 BOOL SetPixelV(HDC, int, int, COLORREF);
4960 
4961 int SetPolyFillMode(HDC, int);
4962 
4963 BOOL SetRectRgn(HRGN, int, int, int, int);
4964 
4965 int SetROP2(HDC, int);
4966 
4967 int SetStretchBltMode(HDC, int);
4968 
4969 UINT SetSystemPaletteUse(HDC, UINT);
4970 
4971 UINT SetTextAlign(HDC, UINT);
4972 
4973 int SetTextCharacterExtra(HDC, int);
4974 
4975 COLORREF SetTextColor(HDC, COLORREF);
4976 
4977 BOOL SetTextJustification(HDC, int, int);
4978 
4979 BOOL SetViewportExtEx(HDC, int, int, LPSIZE);
4980 
4981 BOOL SetViewportOrgEx(HDC, int, int, LPPOINT);
4982 
4983 BOOL SetWindowExtEx(HDC, int, int, LPSIZE);
4984 
4985 BOOL SetWindowOrgEx(HDC, int, int, LPPOINT);
4986 
4987 HENHMETAFILE SetWinMetaFileBits(UINT, CPtr!(BYTE), HDC, CPtr!(METAFILEPICT));
4988 
4989 BOOL SetWorldTransform(HDC, CPtr!(XFORM));
4990 
4991 int StartDocA(HDC, CPtr!(DOCINFOA));
4992 
4993 int StartDocW(HDC, CPtr!(DOCINFOW));
4994 
4995 int StartPage(HDC);
4996 
4997 BOOL StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
4998 
4999 int StretchDIBits(HDC, int, int, int, int, int, int, int, int, CPtr!(VOID), CPtr!(BITMAPINFO), UINT, DWORD);
5000 
5001 BOOL StrokeAndFillPath(HDC);
5002 
5003 BOOL StrokePath(HDC);
5004 
5005 BOOL SwapBuffers(HDC);
5006 
5007 BOOL TextOutA(HDC, int, int, LPCSTR, int);
5008 
5009 BOOL TextOutW(HDC, int, int, LPCWSTR, int);
5010 
5011 BOOL TranslateCharsetInfo(PDWORD, LPCHARSETINFO, DWORD);
5012 
5013 BOOL UnrealizeObject(HGDIOBJ);
5014 
5015 BOOL UpdateColors(HDC);
5016 
5017 BOOL UpdateICMRegKeyA(DWORD, DWORD, LPSTR, UINT);
5018 
5019 BOOL UpdateICMRegKeyW(DWORD, DWORD, LPWSTR, UINT);
5020 
5021 BOOL WidenPath(HDC);
5022 
5023 BOOL wglCopyContext(HGLRC, HGLRC, UINT);
5024 
5025 HGLRC wglCreateContext(HDC);
5026 
5027 HGLRC wglCreateLayerContext(HDC, int);
5028 
5029 BOOL wglDeleteContext(HGLRC);
5030 
5031 BOOL wglDescribeLayerPlane(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR);
5032 
5033 HGLRC wglGetCurrentContext();
5034 
5035 HDC wglGetCurrentDC();
5036 
5037 int wglGetLayerPaletteEntries(HDC, int, int, int, COLORREF*);
5038 
5039 PROC wglGetProcAddress(LPCSTR);
5040 
5041 BOOL wglMakeCurrent(HDC, HGLRC);
5042 
5043 BOOL wglRealizeLayerPalette(HDC, int, BOOL);
5044 
5045 int wglSetLayerPaletteEntries(HDC, int, int, int, CPtr!(COLORREF));
5046 
5047 BOOL wglShareLists(HGLRC, HGLRC);
5048 
5049 BOOL wglSwapLayerBuffers(HDC, UINT);
5050 
5051 BOOL wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
5052 
5053 BOOL wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD);
5054 
5055 BOOL wglUseFontOutlinesA(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
5056 
5057 BOOL wglUseFontOutlinesW(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
5058 
5059 static
5060 
5061 if (WINVER >= 0x0500)
5062 {
5063     alias WGLSWAP*PWGLSWAP;
5064     struct WGLSWAP
5065     {
5066         HDC hdc;
5067         UINT uiFlags;
5068     }
5069     const WGL_SWAPMULTIPLE_MAX = 16;
5070     DWORD  wglSwapMultipleBuffers(UINT, WGLSWAP*);
5071 }
5072 
5073 static
5074 
5075 if (WINVER >= 0x0500)
5076 {
5077     BOOL GdiAlphaBlend(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION);
5078 
5079     BOOL GradientFill(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG);
5080 
5081     BOOL TransparentBlt(HDC, int, int, int, int, HDC, int, int, int, int, UINT);
5082 }
5083 
5084 static
5085 
5086 if (_WIN32_WINNT >= 0x0500)
5087 {
5088     COLORREF SetDCBrushColor(HDC, COLORREF);
5089 
5090     COLORREF SetDCPenColor(HDC, COLORREF);
5091 
5092     HANDLE AddFontMemResourceEx(PVOID, DWORD, PVOID, DWORD*);
5093 
5094     int AddFontResourceExA(LPCSTR, DWORD, PVOID);
5095 
5096     int AddFontResourceExW(LPCWSTR, DWORD, PVOID);
5097 
5098     BOOL RemoveFontMemResourceEx(HANDLE);
5099 
5100     BOOL RemoveFontResourceExA(LPCSTR, DWORD, PVOID);
5101 
5102     BOOL RemoveFontResourceExW(LPCWSTR, DWORD, PVOID);
5103 
5104     DWORD GetFontUnicodeRanges(HDC, LPGLYPHSET);
5105 
5106     DWORD GetGlyphIndicesA(HDC, LPCSTR, int, LPWORD, DWORD);
5107 
5108     DWORD GetGlyphIndicesW(HDC, LPCWSTR, int, LPWORD, DWORD);
5109 
5110     BOOL GetTextExtentPointI(HDC, LPWORD, int, LPSIZE);
5111 
5112     BOOL GetTextExtentExPointI(HDC, LPWORD, int, int, LPINT, LPINT, LPSIZE);
5113 
5114     BOOL GetCharWidthI(HDC, UINT, UINT, LPWORD, LPINT);
5115 
5116     BOOL GetCharABCWidthsI(HDC, UINT, UINT, LPWORD, LPABC);
5117 }
5118 } // extern (Windows)
5119 
5120 version (Unicode)
5121 {
5122     alias WCHAR BCHAR;
5123     alias DOCINFOW DOCINFO;
5124     alias LOGFONTW LOGFONT;
5125 
5126     alias TEXTMETRICW TEXTMETRIC;
5127     alias NPTEXTMETRICW NPTEXTMETRIC;
5128     alias ICMENUMPROCW  ICMENUMPROC;
5129     alias FONTENUMPROCW FONTENUMPROC;
5130     alias DEVMODEW DEVMODE;
5131 
5132     alias EXTLOGFONTW  EXTLOGFONT;
5133     alias GCP_RESULTSW GCP_RESULTS;
5134     alias OUTLINETEXTMETRICW OUTLINETEXTMETRIC;
5135     alias POLYTEXTW POLYTEXT;
5136     alias LOGCOLORSPACEW LOGCOLORSPACE;
5137     alias NEWTEXTMETRICW NEWTEXTMETRIC;
5138     alias NEWTEXTMETRICEXW NEWTEXTMETRICEX;
5139     alias ENUMLOGFONTW ENUMLOGFONT;
5140     alias ENUMLOGFONTEXW   ENUMLOGFONTEX;
5141     alias DISPLAY_DEVICEW  DISPLAY_DEVICE;
5142     alias AddFontResourceW AddFontResource;
5143 
5144     alias CopyEnhMetaFileW CopyEnhMetaFile;
5145     alias CopyMetaFileW CopyMetaFile;
5146     alias CreateColorSpaceW CreateColorSpace;
5147     alias CreateDCW CreateDC;
5148     alias CreateEnhMetaFileW CreateEnhMetaFile;
5149     alias CreateFontW CreateFont;
5150     alias CreateFontIndirectW CreateFontIndirect;
5151     alias CreateICW CreateIC;
5152     alias CreateMetaFileW CreateMetaFile;
5153     alias CreateScalableFontResourceW CreateScalableFontResource;
5154     alias DeviceCapabilitiesW DeviceCapabilities;
5155     alias EnumFontFamiliesW EnumFontFamilies;
5156     alias EnumFontFamiliesExW EnumFontFamiliesEx;
5157     alias EnumFontsW EnumFonts;
5158     alias EnumICMProfilesW EnumICMProfiles;
5159     alias ExtTextOutW ExtTextOut;
5160     alias GetCharABCWidthsFloatW GetCharABCWidthsFloat;
5161     alias GetCharABCWidthsW GetCharABCWidths;
5162     alias GetCharacterPlacementW GetCharacterPlacement;
5163     alias GetCharWidth32W GetCharWidth32;
5164     alias GetCharWidthFloatW GetCharWidthFloat;
5165     alias GetCharWidthW GetCharWidth;
5166     alias GetEnhMetaFileW GetEnhMetaFile;
5167     alias GetEnhMetaFileDescriptionW GetEnhMetaFileDescription;
5168     alias GetGlyphOutlineW GetGlyphOutline;
5169     alias GetICMProfileW GetICMProfile;
5170     alias GetKerningPairsW  GetKerningPairs;
5171     alias GetLogColorSpaceW GetLogColorSpace;
5172     alias GetMetaFileW GetMetaFile;
5173     alias GetObjectW GetObject;
5174     alias GetOutlineTextMetricsW GetOutlineTextMetrics;
5175     alias GetTextExtentPointW GetTextExtentPoint;
5176     alias GetTextExtentExPointW GetTextExtentExPoint;
5177     alias GetTextExtentPoint32W GetTextExtentPoint32;
5178     alias GetTextFaceW GetTextFace;
5179     alias GetTextMetricsW GetTextMetrics;
5180     alias PolyTextOutW PolyTextOut;
5181     alias RemoveFontResourceW RemoveFontResource;
5182 
5183     alias ResetDCW ResetDC;
5184     alias SetICMProfileW SetICMProfile;
5185     alias StartDocW StartDoc;
5186     alias TextOutW  TextOut;
5187     alias UpdateICMRegKeyW UpdateICMRegKey;
5188     alias wglUseFontBitmapsW  wglUseFontBitmaps;
5189     alias wglUseFontOutlinesW wglUseFontOutlines;
5190     static
5191 
5192     if (_WIN32_WINNT >= 0x0500)
5193     {
5194         alias ENUMLOGFONTEXDVW   ENUMLOGFONTEXDV;
5195         alias PENUMLOGFONTEXDVW  PENUMLOGFONTEXDV;
5196         alias LPENUMLOGFONTEXDVW LPENUMLOGFONTEXDV;
5197         alias AddFontResourceExW AddFontResourceEx;
5198         alias RemoveFontResourceExW RemoveFontResourceEx;
5199         alias GetGlyphIndicesW GetGlyphIndices;
5200     }
5201 }
5202 else     /* non-unicode build */
5203 {
5204     alias BYTE BCHAR;
5205     alias DOCINFOA DOCINFO;
5206     alias LOGFONTA LOGFONT;
5207     alias TEXTMETRICA TEXTMETRIC;
5208     alias NPTEXTMETRICA NPTEXTMETRIC;
5209     alias ICMENUMPROCA  ICMENUMPROC;
5210     alias FONTENUMPROCA FONTENUMPROC;
5211     alias DEVMODEA DEVMODE;
5212     alias EXTLOGFONTA  EXTLOGFONT;
5213     alias GCP_RESULTSA GCP_RESULTS;
5214     alias OUTLINETEXTMETRICA OUTLINETEXTMETRIC;
5215     alias POLYTEXTA POLYTEXT;
5216     alias LOGCOLORSPACEA LOGCOLORSPACE;
5217     alias NEWTEXTMETRICA NEWTEXTMETRIC;
5218     alias NEWTEXTMETRICEXA NEWTEXTMETRICEX;
5219     alias ENUMLOGFONTA ENUMLOGFONT;
5220     alias ENUMLOGFONTEXA  ENUMLOGFONTEX;
5221     alias DISPLAY_DEVICEA DISPLAY_DEVICE;
5222 
5223     alias AddFontResourceA AddFontResource;
5224     alias CopyEnhMetaFileA CopyEnhMetaFile;
5225     alias CopyMetaFileA CopyMetaFile;
5226     alias CreateColorSpaceA CreateColorSpace;
5227     alias CreateDCA CreateDC;
5228     alias CreateEnhMetaFileA CreateEnhMetaFile;
5229     alias CreateFontA CreateFont;
5230     alias CreateFontIndirectA CreateFontIndirect;
5231     alias CreateICA CreateIC;
5232     alias CreateMetaFileA CreateMetaFile;
5233     alias CreateScalableFontResourceA CreateScalableFontResource;
5234     alias DeviceCapabilitiesA DeviceCapabilities;
5235     alias EnumFontFamiliesA EnumFontFamilies;
5236     alias EnumFontFamiliesExA EnumFontFamiliesEx;
5237     alias EnumFontsA EnumFonts;
5238     alias EnumICMProfilesA EnumICMProfiles;
5239     alias ExtTextOutA ExtTextOut;
5240     alias GetCharWidthFloatA GetCharWidthFloat;
5241     alias GetCharWidthA GetCharWidth;
5242     alias GetCharacterPlacementA GetCharacterPlacement;
5243     alias GetCharABCWidthsA GetCharABCWidths;
5244     alias GetCharABCWidthsFloatA GetCharABCWidthsFloat;
5245     alias GetCharWidth32A GetCharWidth32;
5246     alias GetEnhMetaFileA GetEnhMetaFile;
5247     alias GetEnhMetaFileDescriptionA GetEnhMetaFileDescription;
5248     alias GetGlyphOutlineA GetGlyphOutline;
5249     alias GetICMProfileA GetICMProfile;
5250     alias GetKerningPairsA  GetKerningPairs;
5251     alias GetLogColorSpaceA GetLogColorSpace;
5252     alias GetMetaFileA GetMetaFile;
5253     alias GetObjectA GetObject;
5254     alias GetOutlineTextMetricsA GetOutlineTextMetrics;
5255     alias GetTextExtentPointA GetTextExtentPoint;
5256     alias GetTextExtentExPointA GetTextExtentExPoint;
5257     alias GetTextExtentPoint32A GetTextExtentPoint32;
5258     alias GetTextFaceA GetTextFace;
5259     alias GetTextMetricsA GetTextMetrics;
5260     alias PolyTextOutA PolyTextOut;
5261     alias RemoveFontResourceA RemoveFontResource;
5262     alias ResetDCA ResetDC;
5263     alias SetICMProfileA SetICMProfile;
5264     alias StartDocA StartDoc;
5265     alias TextOutA  TextOut;
5266     alias UpdateICMRegKeyA UpdateICMRegKey;
5267     alias wglUseFontBitmapsA  wglUseFontBitmaps;
5268     alias wglUseFontOutlinesA wglUseFontOutlines;
5269     static
5270 
5271     if (_WIN32_WINNT >= 0x0500)
5272     {
5273         alias ENUMLOGFONTEXDVA   ENUMLOGFONTEXDV;
5274         alias PENUMLOGFONTEXDVA  PENUMLOGFONTEXDV;
5275         alias LPENUMLOGFONTEXDVA LPENUMLOGFONTEXDV;
5276         alias AddFontResourceExA AddFontResourceEx;
5277         alias RemoveFontResourceExA RemoveFontResourceEx;
5278         alias GetGlyphIndicesA GetGlyphIndices;
5279     }
5280 }
5281 
5282 // Common to both ASCII & UNICODE
5283 alias DOCINFO*LPDOCINFO;
5284 alias LOGFONT*PLOGFONT, NPLOGFONT, LPLOGFONT;
5285 alias TEXTMETRIC*PTEXTMETRIC, LPTEXTMETRIC;
5286 alias DEVMODE*PDEVMODE, NPDEVMODE, LPDEVMODE;
5287 alias EXTLOGFONT *PEXTLOGFONT, NPEXTLOGFONT, LPEXTLOGFONT;
5288 alias GCP_RESULTS*LPGCP_RESULTS;
5289 alias OUTLINETEXTMETRIC*POUTLINETEXTMETRIC, NPOUTLINETEXTMETRIC, LPOUTLINETEXTMETRIC;
5290 alias POLYTEXT*PPOLYTEXT, NPPOLYTEXT, LPPOLYTEXT;
5291 alias LOGCOLORSPACE*LPLOGCOLORSPACE;
5292 alias NEWTEXTMETRIC*PNEWTEXTMETRIC, NPNEWTEXTMETRIC, LPNEWTEXTMETRIC;
5293 alias ENUMLOGFONT*LPENUMLOGFONT;
5294 alias ENUMLOGFONTEX *LPENUMLOGFONTEX;
5295 alias DISPLAY_DEVICE*PDISPLAY_DEVICE, LPDISPLAY_DEVICE;