The OpenD Programming Language

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