module win32.ansi.wingdi;

// Translated from Microsoft Platform SDK August 2001 Edition
// by Y.Tomino (demoonlit@inter7.jp)

import win32.ansi.windef;

// #ifndef _WINGDI_
// #define _WINGDI_

// #ifdef _MAC
// #...
// #endif

// #if !defined(_GDI32_)
// #define WINGDIAPI DECLSPEC_IMPORT
// #else
// #...
// #endif

// #if !defined(_SPOOL32_)
// #define WINSPOOLAPI DECLSPEC_IMPORT
// #else
// #...
// #endif

// #ifdef __cplusplus
// extern "C" {
// #endif

// #ifndef WINVER
// #...
// #endif /* WINVER */

// #ifndef NOGDI

// #ifndef NORASTEROPS

enum : uint { R2_BLACK = 1 }
enum : uint { R2_NOTMERGEPEN = 2 }
enum : uint { R2_MASKNOTPEN = 3 }
enum : uint { R2_NOTCOPYPEN = 4 }
enum : uint { R2_MASKPENNOT = 5 }
enum : uint { R2_NOT = 6 }
enum : uint { R2_XORPEN = 7 }
enum : uint { R2_NOTMASKPEN = 8 }
enum : uint { R2_MASKPEN = 9 }
enum : uint { R2_NOTXORPEN = 10 }
enum : uint { R2_NOP = 11 }
enum : uint { R2_MERGENOTPEN = 12 }
enum : uint { R2_COPYPEN = 13 }
enum : uint { R2_MERGEPENNOT = 14 }
enum : uint { R2_MERGEPEN = 15 }
enum : uint { R2_WHITE = 16 }
enum : uint { R2_LAST = 16 }

enum : DWORD { SRCCOPY = 0x00CC0020 }
enum : DWORD { SRCPAINT = 0x00EE0086 }
enum : DWORD { SRCAND = 0x008800C6 }
enum : DWORD { SRCINVERT = 0x00660046 }
enum : DWORD { SRCERASE = 0x00440328 }
enum : DWORD { NOTSRCCOPY = 0x00330008 }
enum : DWORD { NOTSRCERASE = 0x001100A6 }
enum : DWORD { MERGECOPY = 0x00C000CA }
enum : DWORD { MERGEPAINT = 0x00BB0226 }
enum : DWORD { PATCOPY = 0x00F00021 }
enum : DWORD { PATPAINT = 0x00FB0A09 }
enum : DWORD { PATINVERT = 0x005A0049 }
enum : DWORD { DSTINVERT = 0x00550009 }
enum : DWORD { BLACKNESS = 0x00000042 }
enum : DWORD { WHITENESS = 0x00FF0062 }
// #if(WINVER >= 0x0500)

enum : DWORD { NOMIRRORBITMAP = 0x80000000 }
enum : DWORD { CAPTUREBLT = 0x40000000 }
// #endif /* WINVER >= 0x0500 */

DWORD MAKEROP4(DWORD fore, DWORD back){ return ((back << 8) & 0xFF000000) | fore; }

// #endif /* NORASTEROPS */

enum : uint { GDI_ERROR = 0xFFFFFFFF }
const HANDLE HGDI_ERROR = cast(HANDLE)(0xFFFFFFFFL);

enum : uint { ERROR = 0 }
enum : uint { NULLREGION = 1 }
enum : uint { SIMPLEREGION = 2 }
enum : uint { COMPLEXREGION = 3 }
alias ERROR RGN_ERROR;

enum : uint { RGN_AND = 1 }
enum : uint { RGN_OR = 2 }
enum : uint { RGN_XOR = 3 }
enum : uint { RGN_DIFF = 4 }
enum : uint { RGN_COPY = 5 }
alias RGN_AND RGN_MIN;
alias RGN_COPY RGN_MAX;

enum : uint { BLACKONWHITE = 1 }
enum : uint { WHITEONBLACK = 2 }
enum : uint { COLORONCOLOR = 3 }
enum : uint { HALFTONE = 4 }
enum : uint { MAXSTRETCHBLTMODE = 4 }

// #if(WINVER >= 0x0400)

alias BLACKONWHITE STRETCH_ANDSCANS;
alias WHITEONBLACK STRETCH_ORSCANS;
alias COLORONCOLOR STRETCH_DELETESCANS;
alias HALFTONE STRETCH_HALFTONE;
// #endif /* WINVER >= 0x0400 */

enum : uint { ALTERNATE = 1 }
enum : uint { WINDING = 2 }
enum : uint { POLYFILL_LAST = 2 }

// #if(WINVER >= 0x0500)
enum : uint { LAYOUT_RTL = 0x00000001 }
enum : uint { LAYOUT_BTT = 0x00000002 }
enum : uint { LAYOUT_VBH = 0x00000004 }
enum : uint { LAYOUT_ORIENTATIONMASK = LAYOUT_RTL | LAYOUT_BTT | LAYOUT_VBH }
enum : uint { LAYOUT_BITMAPORIENTATIONPRESERVED = 0x00000008 }
// #endif /* WINVER >= 0x0500 */

enum : uint { TA_NOUPDATECP = 0 }
enum : uint { TA_UPDATECP = 1 }

enum : uint { TA_LEFT = 0 }
enum : uint { TA_RIGHT = 2 }
enum : uint { TA_CENTER = 6 }

enum : uint { TA_TOP = 0 }
enum : uint { TA_BOTTOM = 8 }
enum : uint { TA_BASELINE = 24 }
// #if (WINVER >= 0x0400)
enum : uint { TA_RTLREADING = 256 }
enum : uint { TA_MASK = TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING }
// #else
// #...
// #endif

alias TA_BASELINE VTA_BASELINE;
alias TA_BOTTOM VTA_LEFT;
alias TA_TOP VTA_RIGHT;
alias TA_CENTER VTA_CENTER;
alias TA_RIGHT VTA_BOTTOM;
alias TA_LEFT VTA_TOP;

enum : uint { ETO_OPAQUE = 0x0002 }
enum : uint { ETO_CLIPPED = 0x0004 }
// #if(WINVER >= 0x0400)
enum : uint { ETO_GLYPH_INDEX = 0x0010 }
enum : uint { ETO_RTLREADING = 0x0080 }
enum : uint { ETO_NUMERICSLOCAL = 0x0400 }
enum : uint { ETO_NUMERICSLATIN = 0x0800 }
enum : uint { ETO_IGNORELANGUAGE = 0x1000 }
// #endif /* WINVER >= 0x0400 */
// #if (_WIN32_WINNT >= 0x0500)
enum : uint { ETO_PDY = 0x2000 }
// #endif // (_WIN32_WINNT >= 0x0500)

enum : uint { ASPECT_FILTERING = 0x0001 }

enum : uint { DCB_RESET = 0x0001 }
enum : uint { DCB_ACCUMULATE = 0x0002 }
alias DCB_ACCUMULATE DCB_DIRTY;
enum : uint { DCB_SET = DCB_RESET | DCB_ACCUMULATE }
enum : uint { DCB_ENABLE = 0x0004 }
enum : uint { DCB_DISABLE = 0x0008 }

// #ifndef NOMETAFILE

enum : uint { META_SETBKCOLOR = 0x0201 }
enum : uint { META_SETBKMODE = 0x0102 }
enum : uint { META_SETMAPMODE = 0x0103 }
enum : uint { META_SETROP2 = 0x0104 }
enum : uint { META_SETRELABS = 0x0105 }
enum : uint { META_SETPOLYFILLMODE = 0x0106 }
enum : uint { META_SETSTRETCHBLTMODE = 0x0107 }
enum : uint { META_SETTEXTCHAREXTRA = 0x0108 }
enum : uint { META_SETTEXTCOLOR = 0x0209 }
enum : uint { META_SETTEXTJUSTIFICATION = 0x020A }
enum : uint { META_SETWINDOWORG = 0x020B }
enum : uint { META_SETWINDOWEXT = 0x020C }
enum : uint { META_SETVIEWPORTORG = 0x020D }
enum : uint { META_SETVIEWPORTEXT = 0x020E }
enum : uint { META_OFFSETWINDOWORG = 0x020F }
enum : uint { META_SCALEWINDOWEXT = 0x0410 }
enum : uint { META_OFFSETVIEWPORTORG = 0x0211 }
enum : uint { META_SCALEVIEWPORTEXT = 0x0412 }
enum : uint { META_LINETO = 0x0213 }
enum : uint { META_MOVETO = 0x0214 }
enum : uint { META_EXCLUDECLIPRECT = 0x0415 }
enum : uint { META_INTERSECTCLIPRECT = 0x0416 }
enum : uint { META_ARC = 0x0817 }
enum : uint { META_ELLIPSE = 0x0418 }
enum : uint { META_FLOODFILL = 0x0419 }
enum : uint { META_PIE = 0x081A }
enum : uint { META_RECTANGLE = 0x041B }
enum : uint { META_ROUNDRECT = 0x061C }
enum : uint { META_PATBLT = 0x061D }
enum : uint { META_SAVEDC = 0x001E }
enum : uint { META_SETPIXEL = 0x041F }
enum : uint { META_OFFSETCLIPRGN = 0x0220 }
enum : uint { META_TEXTOUT = 0x0521 }
enum : uint { META_BITBLT = 0x0922 }
enum : uint { META_STRETCHBLT = 0x0B23 }
enum : uint { META_POLYGON = 0x0324 }
enum : uint { META_POLYLINE = 0x0325 }
enum : uint { META_ESCAPE = 0x0626 }
enum : uint { META_RESTOREDC = 0x0127 }
enum : uint { META_FILLREGION = 0x0228 }
enum : uint { META_FRAMEREGION = 0x0429 }
enum : uint { META_INVERTREGION = 0x012A }
enum : uint { META_PAINTREGION = 0x012B }
enum : uint { META_SELECTCLIPREGION = 0x012C }
enum : uint { META_SELECTOBJECT = 0x012D }
enum : uint { META_SETTEXTALIGN = 0x012E }
enum : uint { META_CHORD = 0x0830 }
enum : uint { META_SETMAPPERFLAGS = 0x0231 }
enum : uint { META_EXTTEXTOUT = 0x0a32 }
enum : uint { META_SETDIBTODEV = 0x0d33 }
enum : uint { META_SELECTPALETTE = 0x0234 }
enum : uint { META_REALIZEPALETTE = 0x0035 }
enum : uint { META_ANIMATEPALETTE = 0x0436 }
enum : uint { META_SETPALENTRIES = 0x0037 }
enum : uint { META_POLYPOLYGON = 0x0538 }
enum : uint { META_RESIZEPALETTE = 0x0139 }
enum : uint { META_DIBBITBLT = 0x0940 }
enum : uint { META_DIBSTRETCHBLT = 0x0b41 }
enum : uint { META_DIBCREATEPATTERNBRUSH = 0x0142 }
enum : uint { META_STRETCHDIB = 0x0f43 }
enum : uint { META_EXTFLOODFILL = 0x0548 }
// #if(WINVER >= 0x0500)
enum : uint { META_SETLAYOUT = 0x0149 }
// #endif /* WINVER >= 0x0500 */
enum : uint { META_DELETEOBJECT = 0x01f0 }
enum : uint { META_CREATEPALETTE = 0x00f7 }
enum : uint { META_CREATEPATTERNBRUSH = 0x01F9 }
enum : uint { META_CREATEPENINDIRECT = 0x02FA }
enum : uint { META_CREATEFONTINDIRECT = 0x02FB }
enum : uint { META_CREATEBRUSHINDIRECT = 0x02FC }
enum : uint { META_CREATEREGION = 0x06FF }

// #if(WINVER >= 0x0400)
struct _DRAWPATRECT {
  POINT ptPosition;
  POINT ptSize;
  WORD wStyle;
  WORD wPattern;
}
alias _DRAWPATRECT DRAWPATRECT;
alias _DRAWPATRECT* PDRAWPATRECT;

// #endif /* WINVER >= 0x0400 */

// #endif /* NOMETAFILE */

enum : uint { NEWFRAME = 1 }
enum : uint { ABORTDOC = 2 }
enum : uint { NEXTBAND = 3 }
enum : uint { SETCOLORTABLE = 4 }
enum : uint { GETCOLORTABLE = 5 }
enum : uint { FLUSHOUTPUT = 6 }
enum : uint { DRAFTMODE = 7 }
enum : uint { QUERYESCSUPPORT = 8 }
enum : uint { SETABORTPROC = 9 }
enum : uint { STARTDOC = 10 }
enum : uint { ENDDOC = 11 }
enum : uint { GETPHYSPAGESIZE = 12 }
enum : uint { GETPRINTINGOFFSET = 13 }
enum : uint { GETSCALINGFACTOR = 14 }
enum : uint { MFCOMMENT = 15 }
enum : uint { GETPENWIDTH = 16 }
enum : uint { SETCOPYCOUNT = 17 }
enum : uint { SELECTPAPERSOURCE = 18 }
enum : uint { DEVICEDATA = 19 }
enum : uint { PASSTHROUGH = 19 }
enum : uint { GETTECHNOLGY = 20 }
enum : uint { GETTECHNOLOGY = 20 }
enum : uint { SETLINECAP = 21 }
enum : uint { SETLINEJOIN = 22 }
enum : uint { SETMITERLIMIT = 23 }
enum : uint { BANDINFO = 24 }
enum : uint { DRAWPATTERNRECT = 25 }
enum : uint { GETVECTORPENSIZE = 26 }
enum : uint { GETVECTORBRUSHSIZE = 27 }
enum : uint { ENABLEDUPLEX = 28 }
enum : uint { GETSETPAPERBINS = 29 }
enum : uint { GETSETPRINTORIENT = 30 }
enum : uint { ENUMPAPERBINS = 31 }
enum : uint { SETDIBSCALING = 32 }
enum : uint { EPSPRINTING = 33 }
enum : uint { ENUMPAPERMETRICS = 34 }
enum : uint { GETSETPAPERMETRICS = 35 }
enum : uint { POSTSCRIPT_DATA = 37 }
enum : uint { POSTSCRIPT_IGNORE = 38 }
enum : uint { MOUSETRAILS = 39 }
enum : uint { GETDEVICEUNITS = 42 }

enum : uint { GETEXTENDEDTEXTMETRICS = 256 }
enum : uint { GETEXTENTTABLE = 257 }
enum : uint { GETPAIRKERNTABLE = 258 }
enum : uint { GETTRACKKERNTABLE = 259 }
enum : uint { EXTTEXTOUT = 512 }
enum : uint { GETFACENAME = 513 }
enum : uint { DOWNLOADFACE = 514 }
enum : uint { ENABLERELATIVEWIDTHS = 768 }
enum : uint { ENABLEPAIRKERNING = 769 }
enum : uint { SETKERNTRACK = 770 }
enum : uint { SETALLJUSTVALUES = 771 }
enum : uint { SETCHARSET = 772 }

enum : uint { STRETCHBLT = 2048 }
enum : uint { METAFILE_DRIVER = 2049 }
enum : uint { GETSETSCREENPARAMS = 3072 }
enum : uint { QUERYDIBSUPPORT = 3073 }
enum : uint { BEGIN_PATH = 4096 }
enum : uint { CLIP_TO_PATH = 4097 }
enum : uint { END_PATH = 4098 }
enum : uint { EXT_DEVICE_CAPS = 4099 }
enum : uint { RESTORE_CTM = 4100 }
enum : uint { SAVE_CTM = 4101 }
enum : uint { SET_ARC_DIRECTION = 4102 }
enum : uint { SET_BACKGROUND_COLOR = 4103 }
enum : uint { SET_POLY_MODE = 4104 }
enum : uint { SET_SCREEN_ANGLE = 4105 }
enum : uint { SET_SPREAD = 4106 }
enum : uint { TRANSFORM_CTM = 4107 }
enum : uint { SET_CLIP_BOX = 4108 }
enum : uint { SET_BOUNDS = 4109 }
enum : uint { SET_MIRROR_MODE = 4110 }
enum : uint { OPENCHANNEL = 4110 }
enum : uint { DOWNLOADHEADER = 4111 }
enum : uint { CLOSECHANNEL = 4112 }
enum : uint { POSTSCRIPT_PASSTHROUGH = 4115 }
enum : uint { ENCAPSULATED_POSTSCRIPT = 4116 }

enum : uint { POSTSCRIPT_IDENTIFY = 4117 }
enum : uint { POSTSCRIPT_INJECTION = 4118 }

enum : uint { CHECKJPEGFORMAT = 4119 }
enum : uint { CHECKPNGFORMAT = 4120 }

enum : uint { GET_PS_FEATURESETTING = 4121 }

enum : uint { SPCLPASSTHROUGH2 = 4568 }

enum : uint { PSIDENT_GDICENTRIC = 0 }
enum : uint { PSIDENT_PSCENTRIC = 1 }

struct _PSINJECTDATA {

  DWORD DataBytes;
  WORD InjectionPoint;
  WORD PageNumber;

}
alias _PSINJECTDATA PSINJECTDATA;
alias _PSINJECTDATA* PPSINJECTDATA;

enum : uint { PSINJECT_BEGINSTREAM = 1 }
enum : uint { PSINJECT_PSADOBE = 2 }
enum : uint { PSINJECT_PAGESATEND = 3 }
enum : uint { PSINJECT_PAGES = 4 }

enum : uint { PSINJECT_DOCNEEDEDRES = 5 }
enum : uint { PSINJECT_DOCSUPPLIEDRES = 6 }
enum : uint { PSINJECT_PAGEORDER = 7 }
enum : uint { PSINJECT_ORIENTATION = 8 }
enum : uint { PSINJECT_BOUNDINGBOX = 9 }
enum : uint { PSINJECT_DOCUMENTPROCESSCOLORS = 10 }

enum : uint { PSINJECT_COMMENTS = 11 }
enum : uint { PSINJECT_BEGINDEFAULTS = 12 }
enum : uint { PSINJECT_ENDDEFAULTS = 13 }
enum : uint { PSINJECT_BEGINPROLOG = 14 }
enum : uint { PSINJECT_ENDPROLOG = 15 }
enum : uint { PSINJECT_BEGINSETUP = 16 }
enum : uint { PSINJECT_ENDSETUP = 17 }
enum : uint { PSINJECT_TRAILER = 18 }
enum : uint { PSINJECT_EOF = 19 }
enum : uint { PSINJECT_ENDSTREAM = 20 }
enum : uint { PSINJECT_DOCUMENTPROCESSCOLORSATEND = 21 }

enum : uint { PSINJECT_PAGENUMBER = 100 }
enum : uint { PSINJECT_BEGINPAGESETUP = 101 }
enum : uint { PSINJECT_ENDPAGESETUP = 102 }
enum : uint { PSINJECT_PAGETRAILER = 103 }
enum : uint { PSINJECT_PLATECOLOR = 104 }

enum : uint { PSINJECT_SHOWPAGE = 105 }
enum : uint { PSINJECT_PAGEBBOX = 106 }
enum : uint { PSINJECT_ENDPAGECOMMENTS = 107 }

enum : uint { PSINJECT_VMSAVE = 200 }
enum : uint { PSINJECT_VMRESTORE = 201 }

enum : uint { FEATURESETTING_NUP = 0 }
enum : uint { FEATURESETTING_OUTPUT = 1 }
enum : uint { FEATURESETTING_PSLEVEL = 2 }
enum : uint { FEATURESETTING_CUSTPAPER = 3 }
enum : uint { FEATURESETTING_MIRROR = 4 }
enum : uint { FEATURESETTING_NEGATIVE = 5 }
enum : uint { FEATURESETTING_PROTOCOL = 6 }

enum : uint { FEATURESETTING_PRIVATE_BEGIN = 0x1000 }
enum : uint { FEATURESETTING_PRIVATE_END = 0x1FFF }

struct _PSFEATURE_OUTPUT {

  BOOL bPageIndependent;
  BOOL bSetPageDevice;
}
alias _PSFEATURE_OUTPUT PSFEATURE_OUTPUT;
alias _PSFEATURE_OUTPUT* PPSFEATURE_OUTPUT;

struct _PSFEATURE_CUSTPAPER {

  LONG lOrientation;
  LONG lWidth;
  LONG lHeight;
  LONG lWidthOffset;
  LONG lHeightOffset;
}
alias _PSFEATURE_CUSTPAPER PSFEATURE_CUSTPAPER;
alias _PSFEATURE_CUSTPAPER* PPSFEATURE_CUSTPAPER;

enum : uint { PSPROTOCOL_ASCII = 0 }
enum : uint { PSPROTOCOL_BCP = 1 }
enum : uint { PSPROTOCOL_TBCP = 2 }
enum : uint { PSPROTOCOL_BINARY = 3 }

enum : uint { QDI_SETDIBITS = 1 }
enum : uint { QDI_GETDIBITS = 2 }
enum : uint { QDI_DIBTOSCREEN = 4 }
enum : uint { QDI_STRETCHDIB = 8 }

enum : uint { SP_NOTREPORTED = 0x4000 }
enum { SP_ERROR = -1 }
enum { SP_APPABORT = -2 }
enum { SP_USERABORT = -3 }
enum { SP_OUTOFDISK = -4 }
enum { SP_OUTOFMEMORY = -5 }

enum : uint { PR_JOBSTATUS = 0x0000 }

enum : uint { OBJ_PEN = 1 }
enum : uint { OBJ_BRUSH = 2 }
enum : uint { OBJ_DC = 3 }
enum : uint { OBJ_METADC = 4 }
enum : uint { OBJ_PAL = 5 }
enum : uint { OBJ_FONT = 6 }
enum : uint { OBJ_BITMAP = 7 }
enum : uint { OBJ_REGION = 8 }
enum : uint { OBJ_METAFILE = 9 }
enum : uint { OBJ_MEMDC = 10 }
enum : uint { OBJ_EXTPEN = 11 }
enum : uint { OBJ_ENHMETADC = 12 }
enum : uint { OBJ_ENHMETAFILE = 13 }
enum : uint { OBJ_COLORSPACE = 14 }

enum : uint { MWT_IDENTITY = 1 }
enum : uint { MWT_LEFTMULTIPLY = 2 }
enum : uint { MWT_RIGHTMULTIPLY = 3 }

alias MWT_IDENTITY MWT_MIN;
alias MWT_RIGHTMULTIPLY MWT_MAX;

// #define _XFORM_
struct tagXFORM {
  FLOAT eM11;
  FLOAT eM12;
  FLOAT eM21;
  FLOAT eM22;
  FLOAT eDx;
  FLOAT eDy;
}
alias tagXFORM XFORM;
alias tagXFORM* PXFORM;
alias tagXFORM* LPXFORM;

struct tagBITMAP {
  LONG bmType;
  LONG bmWidth;
  LONG bmHeight;
  LONG bmWidthBytes;
  WORD bmPlanes;
  WORD bmBitsPixel;
  LPVOID bmBits;
}
alias tagBITMAP BITMAP;
alias tagBITMAP* PBITMAP;
alias tagBITMAP* NPBITMAP;
alias tagBITMAP* LPBITMAP;

align(1):
struct tagRGBTRIPLE {
  BYTE rgbtBlue;
  BYTE rgbtGreen;
  BYTE rgbtRed;
}
alias tagRGBTRIPLE RGBTRIPLE;

align:

struct tagRGBQUAD {
  BYTE rgbBlue;
  BYTE rgbGreen;
  BYTE rgbRed;
  BYTE rgbReserved;
}
alias tagRGBQUAD RGBQUAD;

alias RGBQUAD* LPRGBQUAD;

// #if(WINVER >= 0x0400)

enum : uint { CS_ENABLE = 0x00000001 }
enum : uint { CS_DISABLE = 0x00000002 }
enum : uint { CS_DELETE_TRANSFORM = 0x00000003 }

// #define LCS_SIGNATURE 'PSOC'

// #define LCS_sRGB 'sRGB'
// #define LCS_WINDOWS_COLOR_SPACE 'Win '

alias LONG LCSCSTYPE;
enum : uint { LCS_CALIBRATED_RGB = 0x00000000 }

alias LONG LCSGAMUTMATCH;
enum : uint { LCS_GM_BUSINESS = 0x00000001 }
enum : uint { LCS_GM_GRAPHICS = 0x00000002 }
enum : uint { LCS_GM_IMAGES = 0x00000004 }
enum : uint { LCS_GM_ABS_COLORIMETRIC = 0x00000008 }

enum : uint { CM_OUT_OF_GAMUT = 255 }
enum : uint { CM_IN_GAMUT = 0 }

enum : uint { ICM_ADDPROFILE = 1 }
enum : uint { ICM_DELETEPROFILE = 2 }
enum : uint { ICM_QUERYPROFILE = 3 }
enum : uint { ICM_SETDEFAULTPROFILE = 4 }
enum : uint { ICM_REGISTERICMATCHER = 5 }
enum : uint { ICM_UNREGISTERICMATCHER = 6 }
enum : uint { ICM_QUERYMATCH = 7 }

BYTE GetKValue(DWORD cmyk){ return cast(BYTE)cmyk; }
BYTE GetYValue(DWORD cmyk){ return cast(BYTE)(cmyk >>> 8); }
BYTE GetMValue(DWORD cmyk){ return cast(BYTE)(cmyk >>> 16); }
BYTE GetCValue(DWORD cmyk){ return cast(BYTE)(cmyk >>> 24); }

DWORD CMYK(BYTE c, BYTE m, BYTE y, BYTE k){ return (cast(COLORREF)(((cast(BYTE)(k)|(cast(WORD)(cast(BYTE)(y))<<8))|((cast(DWORD)cast(BYTE)(m))<<16))|((cast(DWORD)cast(BYTE)(c))<<24))); }

alias int FXPT16DOT16;
alias int* LPFXPT16DOT16;
alias int FXPT2DOT30;
alias int* LPFXPT2DOT30;

struct tagCIEXYZ {
  FXPT2DOT30 ciexyzX;
  FXPT2DOT30 ciexyzY;
  FXPT2DOT30 ciexyzZ;
}
alias tagCIEXYZ CIEXYZ;

alias CIEXYZ* LPCIEXYZ;

struct tagICEXYZTRIPLE {
  CIEXYZ ciexyzRed;
  CIEXYZ ciexyzGreen;
  CIEXYZ ciexyzBlue;
}
alias tagICEXYZTRIPLE CIEXYZTRIPLE;

alias CIEXYZTRIPLE* LPCIEXYZTRIPLE;

struct tagLOGCOLORSPACEA {
  DWORD lcsSignature;
  DWORD lcsVersion;
  DWORD lcsSize;
  LCSCSTYPE lcsCSType;
  LCSGAMUTMATCH lcsIntent;
  CIEXYZTRIPLE lcsEndpoints;
  DWORD lcsGammaRed;
  DWORD lcsGammaGreen;
  DWORD lcsGammaBlue;
  CHAR lcsFilename[MAX_PATH];
}
alias tagLOGCOLORSPACEA LOGCOLORSPACEA;
alias tagLOGCOLORSPACEA* LPLOGCOLORSPACEA;

struct tagLOGCOLORSPACEW {
  DWORD lcsSignature;
  DWORD lcsVersion;
  DWORD lcsSize;
  LCSCSTYPE lcsCSType;
  LCSGAMUTMATCH lcsIntent;
  CIEXYZTRIPLE lcsEndpoints;
  DWORD lcsGammaRed;
  DWORD lcsGammaGreen;
  DWORD lcsGammaBlue;
  WCHAR lcsFilename[MAX_PATH];
}
alias tagLOGCOLORSPACEW LOGCOLORSPACEW;
alias tagLOGCOLORSPACEW* LPLOGCOLORSPACEW;

// #ifdef UNICODE
// ...
// #else
alias LOGCOLORSPACEA LOGCOLORSPACE;
alias LPLOGCOLORSPACEA LPLOGCOLORSPACE;
// #endif // UNICODE

// #endif /* WINVER >= 0x0400 */

struct tagBITMAPCOREHEADER {
  DWORD bcSize;
  WORD bcWidth;
  WORD bcHeight;
  WORD bcPlanes;
  WORD bcBitCount;
}
alias tagBITMAPCOREHEADER BITMAPCOREHEADER;
alias tagBITMAPCOREHEADER* LPBITMAPCOREHEADER;
alias tagBITMAPCOREHEADER* PBITMAPCOREHEADER;

struct tagBITMAPINFOHEADER {
  DWORD biSize;
  LONG biWidth;
  LONG biHeight;
  WORD biPlanes;
  WORD biBitCount;
  DWORD biCompression;
  DWORD biSizeImage;
  LONG biXPelsPerMeter;
  LONG biYPelsPerMeter;
  DWORD biClrUsed;
  DWORD biClrImportant;
}
alias tagBITMAPINFOHEADER BITMAPINFOHEADER;
alias tagBITMAPINFOHEADER* LPBITMAPINFOHEADER;
alias tagBITMAPINFOHEADER* PBITMAPINFOHEADER;

// #if(WINVER >= 0x0400)
struct _0 {
  DWORD bV4Size;
  LONG bV4Width;
  LONG bV4Height;
  WORD bV4Planes;
  WORD bV4BitCount;
  DWORD bV4V4Compression;
  DWORD bV4SizeImage;
  LONG bV4XPelsPerMeter;
  LONG bV4YPelsPerMeter;
  DWORD bV4ClrUsed;
  DWORD bV4ClrImportant;
  DWORD bV4RedMask;
  DWORD bV4GreenMask;
  DWORD bV4BlueMask;
  DWORD bV4AlphaMask;
  DWORD bV4CSType;
  CIEXYZTRIPLE bV4Endpoints;
  DWORD bV4GammaRed;
  DWORD bV4GammaGreen;
  DWORD bV4GammaBlue;
}
alias _0 BITMAPV4HEADER;
alias _0* LPBITMAPV4HEADER;
alias _0* PBITMAPV4HEADER;

// #endif /* WINVER >= 0x0400 */

// #if (WINVER >= 0x0500)
struct _1 {
  DWORD bV5Size;
  LONG bV5Width;
  LONG bV5Height;
  WORD bV5Planes;
  WORD bV5BitCount;
  DWORD bV5Compression;
  DWORD bV5SizeImage;
  LONG bV5XPelsPerMeter;
  LONG bV5YPelsPerMeter;
  DWORD bV5ClrUsed;
  DWORD bV5ClrImportant;
  DWORD bV5RedMask;
  DWORD bV5GreenMask;
  DWORD bV5BlueMask;
  DWORD bV5AlphaMask;
  DWORD bV5CSType;
  CIEXYZTRIPLE bV5Endpoints;
  DWORD bV5GammaRed;
  DWORD bV5GammaGreen;
  DWORD bV5GammaBlue;
  DWORD bV5Intent;
  DWORD bV5ProfileData;
  DWORD bV5ProfileSize;
  DWORD bV5Reserved;
}
alias _1 BITMAPV5HEADER;
alias _1* LPBITMAPV5HEADER;
alias _1* PBITMAPV5HEADER;

// #define PROFILE_LINKED 'LINK'
// #define PROFILE_EMBEDDED 'MBED'
// #endif

enum : uint { BI_RGB = 0 }
enum : uint { BI_RLE8 = 1 }
enum : uint { BI_RLE4 = 2 }
enum : uint { BI_BITFIELDS = 3 }
enum : uint { BI_JPEG = 4 }
enum : uint { BI_PNG = 5 }
// #if (_WIN32_WINNT >= 0x0400)
// #endif

struct tagBITMAPINFO {
  BITMAPINFOHEADER bmiHeader;
  RGBQUAD bmiColors[1];
}
alias tagBITMAPINFO BITMAPINFO;
alias tagBITMAPINFO* LPBITMAPINFO;
alias tagBITMAPINFO* PBITMAPINFO;

struct tagBITMAPCOREINFO {
  BITMAPCOREHEADER bmciHeader;
  RGBTRIPLE bmciColors[1];
}
alias tagBITMAPCOREINFO BITMAPCOREINFO;
alias tagBITMAPCOREINFO* LPBITMAPCOREINFO;
alias tagBITMAPCOREINFO* PBITMAPCOREINFO;

align(2):
struct tagBITMAPFILEHEADER {
  WORD bfType;
  DWORD bfSize;
  WORD bfReserved1;
  WORD bfReserved2;
  DWORD bfOffBits;
}
alias tagBITMAPFILEHEADER BITMAPFILEHEADER;
alias tagBITMAPFILEHEADER* LPBITMAPFILEHEADER;
alias tagBITMAPFILEHEADER* PBITMAPFILEHEADER;

align:

// #define MAKEPOINTS(l) (*((POINTS FAR *)&(l)))

// #if(WINVER >= 0x0400)
// #ifndef NOFONTSIG
struct tagFONTSIGNATURE {
  DWORD fsUsb[4];
  DWORD fsCsb[2];
}
alias tagFONTSIGNATURE FONTSIGNATURE;
alias tagFONTSIGNATURE* PFONTSIGNATURE;
alias tagFONTSIGNATURE* LPFONTSIGNATURE;

struct tagCHARSETINFO {
  UINT ciCharset;
  UINT ciACP;
  FONTSIGNATURE fs;
}
alias tagCHARSETINFO CHARSETINFO;
alias tagCHARSETINFO* PCHARSETINFO;
alias tagCHARSETINFO* NPCHARSETINFO;
alias tagCHARSETINFO* LPCHARSETINFO;

enum : uint { TCI_SRCCHARSET = 1 }
enum : uint { TCI_SRCCODEPAGE = 2 }
enum : uint { TCI_SRCFONTSIG = 3 }

struct tagLOCALESIGNATURE {
  DWORD lsUsb[4];
  DWORD lsCsbDefault[2];
  DWORD lsCsbSupported[2];
}
alias tagLOCALESIGNATURE LOCALESIGNATURE;
alias tagLOCALESIGNATURE* PLOCALESIGNATURE;
alias tagLOCALESIGNATURE* LPLOCALESIGNATURE;

// #endif
// #endif /* WINVER >= 0x0400 */

// #ifndef NOMETAFILE

struct tagHANDLETABLE {
  HGDIOBJ objectHandle[1];
}
alias tagHANDLETABLE HANDLETABLE;
alias tagHANDLETABLE* PHANDLETABLE;
alias tagHANDLETABLE* LPHANDLETABLE;

struct tagMETARECORD {
  DWORD rdSize;
  WORD rdFunction;
  WORD rdParm[1];
}
alias tagMETARECORD METARECORD;

alias tagMETARECORD* PMETARECORD;
alias tagMETARECORD* LPMETARECORD;

struct tagMETAFILEPICT {
  LONG mm;
  LONG xExt;
  LONG yExt;
  HMETAFILE hMF;
}
alias tagMETAFILEPICT METAFILEPICT;
alias tagMETAFILEPICT* LPMETAFILEPICT;

align(2):
struct tagMETAHEADER {
  WORD mtType;
  WORD mtHeaderSize;
  WORD mtVersion;
  DWORD mtSize;
  WORD mtNoObjects;
  DWORD mtMaxRecord;
  WORD mtNoParameters;
}
alias tagMETAHEADER METAHEADER;

alias tagMETAHEADER* PMETAHEADER;
alias tagMETAHEADER* LPMETAHEADER;

align:

struct tagENHMETARECORD {
  DWORD iType;
  DWORD nSize;
  DWORD dParm[1];
}
alias tagENHMETARECORD ENHMETARECORD;
alias tagENHMETARECORD* PENHMETARECORD;
alias tagENHMETARECORD* LPENHMETARECORD;

struct tagENHMETAHEADER {
  DWORD iType;
  DWORD nSize;

  RECTL rclBounds;
  RECTL rclFrame;
  DWORD dSignature;
  DWORD nVersion;
  DWORD nBytes;
  DWORD nRecords;
  WORD nHandles;

  WORD sReserved;
  DWORD nDescription;

  DWORD offDescription;

  DWORD nPalEntries;
  SIZEL szlDevice;
  SIZEL szlMillimeters;
// #if(WINVER >= 0x0400)
  DWORD cbPixelFormat;

  DWORD offPixelFormat;

  DWORD bOpenGL;

// #endif /* WINVER >= 0x0400 */
// #if(WINVER >= 0x0500)
  SIZEL szlMicrometers;
// #endif /* WINVER >= 0x0500 */

}
alias tagENHMETAHEADER ENHMETAHEADER;
alias tagENHMETAHEADER* PENHMETAHEADER;
alias tagENHMETAHEADER* LPENHMETAHEADER;

// #endif /* NOMETAFILE */

// #ifndef NOTEXTMETRIC

enum : uint { TMPF_FIXED_PITCH = 0x01 }
enum : uint { TMPF_VECTOR = 0x02 }
enum : uint { TMPF_DEVICE = 0x08 }
enum : uint { TMPF_TRUETYPE = 0x04 }

// #ifdef UNICODE
// ...
// #else
alias BYTE BCHAR;
// #endif

// #ifndef _TEXTMETRIC_DEFINED
// #define _TEXTMETRIC_DEFINED
struct tagTEXTMETRICA {
  LONG tmHeight;
  LONG tmAscent;
  LONG tmDescent;
  LONG tmInternalLeading;
  LONG tmExternalLeading;
  LONG tmAveCharWidth;
  LONG tmMaxCharWidth;
  LONG tmWeight;
  LONG tmOverhang;
  LONG tmDigitizedAspectX;
  LONG tmDigitizedAspectY;
  BYTE tmFirstChar;
  BYTE tmLastChar;
  BYTE tmDefaultChar;
  BYTE tmBreakChar;
  BYTE tmItalic;
  BYTE tmUnderlined;
  BYTE tmStruckOut;
  BYTE tmPitchAndFamily;
  BYTE tmCharSet;
}
alias tagTEXTMETRICA TEXTMETRICA;
alias tagTEXTMETRICA* PTEXTMETRICA;
alias tagTEXTMETRICA* NPTEXTMETRICA;
alias tagTEXTMETRICA* LPTEXTMETRICA;

struct tagTEXTMETRICW {
  LONG tmHeight;
  LONG tmAscent;
  LONG tmDescent;
  LONG tmInternalLeading;
  LONG tmExternalLeading;
  LONG tmAveCharWidth;
  LONG tmMaxCharWidth;
  LONG tmWeight;
  LONG tmOverhang;
  LONG tmDigitizedAspectX;
  LONG tmDigitizedAspectY;
  WCHAR tmFirstChar;
  WCHAR tmLastChar;
  WCHAR tmDefaultChar;
  WCHAR tmBreakChar;
  BYTE tmItalic;
  BYTE tmUnderlined;
  BYTE tmStruckOut;
  BYTE tmPitchAndFamily;
  BYTE tmCharSet;
}
alias tagTEXTMETRICW TEXTMETRICW;
alias tagTEXTMETRICW* PTEXTMETRICW;
alias tagTEXTMETRICW* NPTEXTMETRICW;
alias tagTEXTMETRICW* LPTEXTMETRICW;

// #ifdef UNICODE
// ...
// #else
alias TEXTMETRICA TEXTMETRIC;
alias PTEXTMETRICA PTEXTMETRIC;
alias NPTEXTMETRICA NPTEXTMETRIC;
alias LPTEXTMETRICA LPTEXTMETRIC;
// #endif // UNICODE
// #endif // !_TEXTMETRIC_DEFINED

enum : uint { NTM_REGULAR = 0x00000040 }
enum : uint { NTM_BOLD = 0x00000020 }
enum : uint { NTM_ITALIC = 0x00000001 }

enum : uint { NTM_NONNEGATIVE_AC = 0x00010000 }
enum : uint { NTM_PS_OPENTYPE = 0x00020000 }
enum : uint { NTM_TT_OPENTYPE = 0x00040000 }
enum : uint { NTM_MULTIPLEMASTER = 0x00080000 }
enum : uint { NTM_TYPE1 = 0x00100000 }
enum : uint { NTM_DSIG = 0x00200000 }

align(4):
struct tagNEWTEXTMETRICA {
  LONG tmHeight;
  LONG tmAscent;
  LONG tmDescent;
  LONG tmInternalLeading;
  LONG tmExternalLeading;
  LONG tmAveCharWidth;
  LONG tmMaxCharWidth;
  LONG tmWeight;
  LONG tmOverhang;
  LONG tmDigitizedAspectX;
  LONG tmDigitizedAspectY;
  BYTE tmFirstChar;
  BYTE tmLastChar;
  BYTE tmDefaultChar;
  BYTE tmBreakChar;
  BYTE tmItalic;
  BYTE tmUnderlined;
  BYTE tmStruckOut;
  BYTE tmPitchAndFamily;
  BYTE tmCharSet;
  DWORD ntmFlags;
  UINT ntmSizeEM;
  UINT ntmCellHeight;
  UINT ntmAvgWidth;
}
alias tagNEWTEXTMETRICA NEWTEXTMETRICA;
alias tagNEWTEXTMETRICA* PNEWTEXTMETRICA;
alias tagNEWTEXTMETRICA* NPNEWTEXTMETRICA;
alias tagNEWTEXTMETRICA* LPNEWTEXTMETRICA;

struct tagNEWTEXTMETRICW {
  LONG tmHeight;
  LONG tmAscent;
  LONG tmDescent;
  LONG tmInternalLeading;
  LONG tmExternalLeading;
  LONG tmAveCharWidth;
  LONG tmMaxCharWidth;
  LONG tmWeight;
  LONG tmOverhang;
  LONG tmDigitizedAspectX;
  LONG tmDigitizedAspectY;
  WCHAR tmFirstChar;
  WCHAR tmLastChar;
  WCHAR tmDefaultChar;
  WCHAR tmBreakChar;
  BYTE tmItalic;
  BYTE tmUnderlined;
  BYTE tmStruckOut;
  BYTE tmPitchAndFamily;
  BYTE tmCharSet;
  DWORD ntmFlags;
  UINT ntmSizeEM;
  UINT ntmCellHeight;
  UINT ntmAvgWidth;
}
alias tagNEWTEXTMETRICW NEWTEXTMETRICW;
alias tagNEWTEXTMETRICW* PNEWTEXTMETRICW;
alias tagNEWTEXTMETRICW* NPNEWTEXTMETRICW;
alias tagNEWTEXTMETRICW* LPNEWTEXTMETRICW;

// #ifdef UNICODE
// ...
// #else
alias NEWTEXTMETRICA NEWTEXTMETRIC;
alias PNEWTEXTMETRICA PNEWTEXTMETRIC;
alias NPNEWTEXTMETRICA NPNEWTEXTMETRIC;
alias LPNEWTEXTMETRICA LPNEWTEXTMETRIC;
// #endif // UNICODE
align:

// #if(WINVER >= 0x0400)
struct tagNEWTEXTMETRICEXA {
  NEWTEXTMETRICA ntmTm;
  FONTSIGNATURE ntmFontSig;
}
alias tagNEWTEXTMETRICEXA NEWTEXTMETRICEXA;

struct tagNEWTEXTMETRICEXW {
  NEWTEXTMETRICW ntmTm;
  FONTSIGNATURE ntmFontSig;
}
alias tagNEWTEXTMETRICEXW NEWTEXTMETRICEXW;

// #ifdef UNICODE
// ...
// #else
alias NEWTEXTMETRICEXA NEWTEXTMETRICEX;
// #endif // UNICODE
// #endif /* WINVER >= 0x0400 */

// #endif /* NOTEXTMETRIC */

struct tagPELARRAY {
  LONG paXCount;
  LONG paYCount;
  LONG paXExt;
  LONG paYExt;
  BYTE paRGBs;
}
alias tagPELARRAY PELARRAY;
alias tagPELARRAY* PPELARRAY;
alias tagPELARRAY* NPPELARRAY;
alias tagPELARRAY* LPPELARRAY;

struct tagLOGBRUSH {
  UINT lbStyle;
  COLORREF lbColor;
  ULONG_PTR lbHatch;
}
alias tagLOGBRUSH LOGBRUSH;
alias tagLOGBRUSH* PLOGBRUSH;
alias tagLOGBRUSH* NPLOGBRUSH;
alias tagLOGBRUSH* LPLOGBRUSH;

struct tagLOGBRUSH32 {
  UINT lbStyle;
  COLORREF lbColor;
  ULONG lbHatch;
}
alias tagLOGBRUSH32 LOGBRUSH32;
alias tagLOGBRUSH32* PLOGBRUSH32;
alias tagLOGBRUSH32* NPLOGBRUSH32;
alias tagLOGBRUSH32* LPLOGBRUSH32;

alias LOGBRUSH PATTERN;
alias PATTERN* PPATTERN;
alias PATTERN* NPPATTERN;
alias PATTERN* LPPATTERN;

struct tagLOGPEN {
  UINT lopnStyle;
  POINT lopnWidth;
  COLORREF lopnColor;
}
alias tagLOGPEN LOGPEN;
alias tagLOGPEN* PLOGPEN;
alias tagLOGPEN* NPLOGPEN;
alias tagLOGPEN* LPLOGPEN;

struct tagEXTLOGPEN {
  DWORD elpPenStyle;
  DWORD elpWidth;
  UINT elpBrushStyle;
  COLORREF elpColor;
  ULONG_PTR elpHatch;
  DWORD elpNumEntries;
  DWORD elpStyleEntry[1];
}
alias tagEXTLOGPEN EXTLOGPEN;
alias tagEXTLOGPEN* PEXTLOGPEN;
alias tagEXTLOGPEN* NPEXTLOGPEN;
alias tagEXTLOGPEN* LPEXTLOGPEN;

// #ifndef _PALETTEENTRY_DEFINED
// #define _PALETTEENTRY_DEFINED
struct tagPALETTEENTRY {
  BYTE peRed;
  BYTE peGreen;
  BYTE peBlue;
  BYTE peFlags;
}
alias tagPALETTEENTRY PALETTEENTRY;
alias tagPALETTEENTRY* PPALETTEENTRY;
alias tagPALETTEENTRY* LPPALETTEENTRY;

// #endif // !_PALETTEENTRY_DEFINED

// #ifndef _LOGPALETTE_DEFINED
// #define _LOGPALETTE_DEFINED

struct tagLOGPALETTE {
  WORD palVersion;
  WORD palNumEntries;
  PALETTEENTRY palPalEntry[1];
}
alias tagLOGPALETTE LOGPALETTE;
alias tagLOGPALETTE* PLOGPALETTE;
alias tagLOGPALETTE* NPLOGPALETTE;
alias tagLOGPALETTE* LPLOGPALETTE;

// #endif // !_LOGPALETTE_DEFINED

enum : uint { LF_FACESIZE = 32 }

struct tagLOGFONTA {
  LONG lfHeight;
  LONG lfWidth;
  LONG lfEscapement;
  LONG lfOrientation;
  LONG lfWeight;
  BYTE lfItalic;
  BYTE lfUnderline;
  BYTE lfStrikeOut;
  BYTE lfCharSet;
  BYTE lfOutPrecision;
  BYTE lfClipPrecision;
  BYTE lfQuality;
  BYTE lfPitchAndFamily;
  CHAR lfFaceName[LF_FACESIZE];
}
alias tagLOGFONTA LOGFONTA;
alias tagLOGFONTA* PLOGFONTA;
alias tagLOGFONTA* NPLOGFONTA;
alias tagLOGFONTA* LPLOGFONTA;

struct tagLOGFONTW {
  LONG lfHeight;
  LONG lfWidth;
  LONG lfEscapement;
  LONG lfOrientation;
  LONG lfWeight;
  BYTE lfItalic;
  BYTE lfUnderline;
  BYTE lfStrikeOut;
  BYTE lfCharSet;
  BYTE lfOutPrecision;
  BYTE lfClipPrecision;
  BYTE lfQuality;
  BYTE lfPitchAndFamily;
  WCHAR lfFaceName[LF_FACESIZE];
}
alias tagLOGFONTW LOGFONTW;
alias tagLOGFONTW* PLOGFONTW;
alias tagLOGFONTW* NPLOGFONTW;
alias tagLOGFONTW* LPLOGFONTW;

// #ifdef UNICODE
// ...
// #else
alias LOGFONTA LOGFONT;
alias PLOGFONTA PLOGFONT;
alias NPLOGFONTA NPLOGFONT;
alias LPLOGFONTA LPLOGFONT;
// #endif // UNICODE

enum : uint { LF_FULLFACESIZE = 64 }

struct tagENUMLOGFONTA {
  LOGFONTA elfLogFont;
  BYTE elfFullName[LF_FULLFACESIZE];
  BYTE elfStyle[LF_FACESIZE];
}
alias tagENUMLOGFONTA ENUMLOGFONTA;
alias tagENUMLOGFONTA* LPENUMLOGFONTA;

struct tagENUMLOGFONTW {
  LOGFONTW elfLogFont;
  WCHAR elfFullName[LF_FULLFACESIZE];
  WCHAR elfStyle[LF_FACESIZE];
}
alias tagENUMLOGFONTW ENUMLOGFONTW;
alias tagENUMLOGFONTW* LPENUMLOGFONTW;

// #ifdef UNICODE
// ...
// #else
alias ENUMLOGFONTA ENUMLOGFONT;
alias LPENUMLOGFONTA LPENUMLOGFONT;
// #endif // UNICODE

// #if(WINVER >= 0x0400)
struct tagENUMLOGFONTEXA {
  LOGFONTA elfLogFont;
  BYTE elfFullName[LF_FULLFACESIZE];
  BYTE elfStyle[LF_FACESIZE];
  BYTE elfScript[LF_FACESIZE];
}
alias tagENUMLOGFONTEXA ENUMLOGFONTEXA;
alias tagENUMLOGFONTEXA* LPENUMLOGFONTEXA;

struct tagENUMLOGFONTEXW {
  LOGFONTW elfLogFont;
  WCHAR elfFullName[LF_FULLFACESIZE];
  WCHAR elfStyle[LF_FACESIZE];
  WCHAR elfScript[LF_FACESIZE];
}
alias tagENUMLOGFONTEXW ENUMLOGFONTEXW;
alias tagENUMLOGFONTEXW* LPENUMLOGFONTEXW;

// #ifdef UNICODE
// ...
// #else
alias ENUMLOGFONTEXA ENUMLOGFONTEX;
alias LPENUMLOGFONTEXA LPENUMLOGFONTEX;
// #endif // UNICODE
// #endif /* WINVER >= 0x0400 */

enum : uint { OUT_DEFAULT_PRECIS = 0 }
enum : uint { OUT_STRING_PRECIS = 1 }
enum : uint { OUT_CHARACTER_PRECIS = 2 }
enum : uint { OUT_STROKE_PRECIS = 3 }
enum : uint { OUT_TT_PRECIS = 4 }
enum : uint { OUT_DEVICE_PRECIS = 5 }
enum : uint { OUT_RASTER_PRECIS = 6 }
enum : uint { OUT_TT_ONLY_PRECIS = 7 }
enum : uint { OUT_OUTLINE_PRECIS = 8 }
enum : uint { OUT_SCREEN_OUTLINE_PRECIS = 9 }
enum : uint { OUT_PS_ONLY_PRECIS = 10 }

enum : uint { CLIP_DEFAULT_PRECIS = 0 }
enum : uint { CLIP_CHARACTER_PRECIS = 1 }
enum : uint { CLIP_STROKE_PRECIS = 2 }
enum : uint { CLIP_MASK = 0xf }
enum : uint { CLIP_LH_ANGLES = 1<<4 }
enum : uint { CLIP_TT_ALWAYS = 2<<4 }
enum : uint { CLIP_EMBEDDED = 8<<4 }

enum : uint { DEFAULT_QUALITY = 0 }
enum : uint { DRAFT_QUALITY = 1 }
enum : uint { PROOF_QUALITY = 2 }
// #if(WINVER >= 0x0400)
enum : uint { NONANTIALIASED_QUALITY = 3 }
enum : uint { ANTIALIASED_QUALITY = 4 }
// #endif /* WINVER >= 0x0400 */

// #if (_WIN32_WINNT >= 0x0500)
enum : uint { CLEARTYPE_QUALITY = 5 }
// #endif

enum : uint { DEFAULT_PITCH = 0 }
enum : uint { FIXED_PITCH = 1 }
enum : uint { VARIABLE_PITCH = 2 }
// #if(WINVER >= 0x0400)
enum : uint { MONO_FONT = 8 }
// #endif /* WINVER >= 0x0400 */

enum : uint { ANSI_CHARSET = 0 }
enum : uint { DEFAULT_CHARSET = 1 }
enum : uint { SYMBOL_CHARSET = 2 }
enum : uint { SHIFTJIS_CHARSET = 128 }
enum : uint { HANGEUL_CHARSET = 129 }
enum : uint { HANGUL_CHARSET = 129 }
enum : uint { GB2312_CHARSET = 134 }
enum : uint { CHINESEBIG5_CHARSET = 136 }
enum : uint { OEM_CHARSET = 255 }
// #if(WINVER >= 0x0400)
enum : uint { JOHAB_CHARSET = 130 }
enum : uint { HEBREW_CHARSET = 177 }
enum : uint { ARABIC_CHARSET = 178 }
enum : uint { GREEK_CHARSET = 161 }
enum : uint { TURKISH_CHARSET = 162 }
enum : uint { VIETNAMESE_CHARSET = 163 }
enum : uint { THAI_CHARSET = 222 }
enum : uint { EASTEUROPE_CHARSET = 238 }
enum : uint { RUSSIAN_CHARSET = 204 }

enum : uint { MAC_CHARSET = 77 }
enum : uint { BALTIC_CHARSET = 186 }

enum : uint { FS_LATIN1 = 0x00000001 }
enum : uint { FS_LATIN2 = 0x00000002 }
enum : uint { FS_CYRILLIC = 0x00000004 }
enum : uint { FS_GREEK = 0x00000008 }
enum : uint { FS_TURKISH = 0x00000010 }
enum : uint { FS_HEBREW = 0x00000020 }
enum : uint { FS_ARABIC = 0x00000040 }
enum : uint { FS_BALTIC = 0x00000080 }
enum : uint { FS_VIETNAMESE = 0x00000100 }
enum : uint { FS_THAI = 0x00010000 }
enum : uint { FS_JISJAPAN = 0x00020000 }
enum : uint { FS_CHINESESIMP = 0x00040000 }
enum : uint { FS_WANSUNG = 0x00080000 }
enum : uint { FS_CHINESETRAD = 0x00100000 }
enum : uint { FS_JOHAB = 0x00200000 }
enum : uint { FS_SYMBOL = 0x80000000 }
// #endif /* WINVER >= 0x0400 */

enum : uint { FF_DONTCARE = 0<<4 }
enum : uint { FF_ROMAN = 1<<4 }

enum : uint { FF_SWISS = 2<<4 }

enum : uint { FF_MODERN = 3<<4 }

enum : uint { FF_SCRIPT = 4<<4 }
enum : uint { FF_DECORATIVE = 5<<4 }

enum : uint { FW_DONTCARE = 0 }
enum : uint { FW_THIN = 100 }
enum : uint { FW_EXTRALIGHT = 200 }
enum : uint { FW_LIGHT = 300 }
enum : uint { FW_NORMAL = 400 }
enum : uint { FW_MEDIUM = 500 }
enum : uint { FW_SEMIBOLD = 600 }
enum : uint { FW_BOLD = 700 }
enum : uint { FW_EXTRABOLD = 800 }
enum : uint { FW_HEAVY = 900 }

alias FW_EXTRALIGHT FW_ULTRALIGHT;
alias FW_NORMAL FW_REGULAR;
alias FW_SEMIBOLD FW_DEMIBOLD;
alias FW_EXTRABOLD FW_ULTRABOLD;
alias FW_HEAVY FW_BLACK;

enum : uint { PANOSE_COUNT = 10 }
enum : uint { PAN_FAMILYTYPE_INDEX = 0 }
enum : uint { PAN_SERIFSTYLE_INDEX = 1 }
enum : uint { PAN_WEIGHT_INDEX = 2 }
enum : uint { PAN_PROPORTION_INDEX = 3 }
enum : uint { PAN_CONTRAST_INDEX = 4 }
enum : uint { PAN_STROKEVARIATION_INDEX = 5 }
enum : uint { PAN_ARMSTYLE_INDEX = 6 }
enum : uint { PAN_LETTERFORM_INDEX = 7 }
enum : uint { PAN_MIDLINE_INDEX = 8 }
enum : uint { PAN_XHEIGHT_INDEX = 9 }

enum : uint { PAN_CULTURE_LATIN = 0 }

struct tagPANOSE {
  BYTE bFamilyType;
  BYTE bSerifStyle;
  BYTE bWeight;
  BYTE bProportion;
  BYTE bContrast;
  BYTE bStrokeVariation;
  BYTE bArmStyle;
  BYTE bLetterform;
  BYTE bMidline;
  BYTE bXHeight;
}
alias tagPANOSE PANOSE;
alias tagPANOSE* LPPANOSE;

enum : uint { PAN_ANY = 0 }
enum : uint { PAN_NO_FIT = 1 }

enum : uint { PAN_FAMILY_TEXT_DISPLAY = 2 }
enum : uint { PAN_FAMILY_SCRIPT = 3 }
enum : uint { PAN_FAMILY_DECORATIVE = 4 }
enum : uint { PAN_FAMILY_PICTORIAL = 5 }

enum : uint { PAN_SERIF_COVE = 2 }
enum : uint { PAN_SERIF_OBTUSE_COVE = 3 }
enum : uint { PAN_SERIF_SQUARE_COVE = 4 }
enum : uint { PAN_SERIF_OBTUSE_SQUARE_COVE = 5 }
enum : uint { PAN_SERIF_SQUARE = 6 }
enum : uint { PAN_SERIF_THIN = 7 }
enum : uint { PAN_SERIF_BONE = 8 }
enum : uint { PAN_SERIF_EXAGGERATED = 9 }
enum : uint { PAN_SERIF_TRIANGLE = 10 }
enum : uint { PAN_SERIF_NORMAL_SANS = 11 }
enum : uint { PAN_SERIF_OBTUSE_SANS = 12 }
enum : uint { PAN_SERIF_PERP_SANS = 13 }
enum : uint { PAN_SERIF_FLARED = 14 }
enum : uint { PAN_SERIF_ROUNDED = 15 }

enum : uint { PAN_WEIGHT_VERY_LIGHT = 2 }
enum : uint { PAN_WEIGHT_LIGHT = 3 }
enum : uint { PAN_WEIGHT_THIN = 4 }
enum : uint { PAN_WEIGHT_BOOK = 5 }
enum : uint { PAN_WEIGHT_MEDIUM = 6 }
enum : uint { PAN_WEIGHT_DEMI = 7 }
enum : uint { PAN_WEIGHT_BOLD = 8 }
enum : uint { PAN_WEIGHT_HEAVY = 9 }
enum : uint { PAN_WEIGHT_BLACK = 10 }
enum : uint { PAN_WEIGHT_NORD = 11 }

enum : uint { PAN_PROP_OLD_STYLE = 2 }
enum : uint { PAN_PROP_MODERN = 3 }
enum : uint { PAN_PROP_EVEN_WIDTH = 4 }
enum : uint { PAN_PROP_EXPANDED = 5 }
enum : uint { PAN_PROP_CONDENSED = 6 }
enum : uint { PAN_PROP_VERY_EXPANDED = 7 }
enum : uint { PAN_PROP_VERY_CONDENSED = 8 }
enum : uint { PAN_PROP_MONOSPACED = 9 }

enum : uint { PAN_CONTRAST_NONE = 2 }
enum : uint { PAN_CONTRAST_VERY_LOW = 3 }
enum : uint { PAN_CONTRAST_LOW = 4 }
enum : uint { PAN_CONTRAST_MEDIUM_LOW = 5 }
enum : uint { PAN_CONTRAST_MEDIUM = 6 }
enum : uint { PAN_CONTRAST_MEDIUM_HIGH = 7 }
enum : uint { PAN_CONTRAST_HIGH = 8 }
enum : uint { PAN_CONTRAST_VERY_HIGH = 9 }

enum : uint { PAN_STROKE_GRADUAL_DIAG = 2 }
enum : uint { PAN_STROKE_GRADUAL_TRAN = 3 }
enum : uint { PAN_STROKE_GRADUAL_VERT = 4 }
enum : uint { PAN_STROKE_GRADUAL_HORZ = 5 }
enum : uint { PAN_STROKE_RAPID_VERT = 6 }
enum : uint { PAN_STROKE_RAPID_HORZ = 7 }
enum : uint { PAN_STROKE_INSTANT_VERT = 8 }

enum : uint { PAN_STRAIGHT_ARMS_HORZ = 2 }
enum : uint { PAN_STRAIGHT_ARMS_WEDGE = 3 }
enum : uint { PAN_STRAIGHT_ARMS_VERT = 4 }
enum : uint { PAN_STRAIGHT_ARMS_SINGLE_SERIF = 5 }
enum : uint { PAN_STRAIGHT_ARMS_DOUBLE_SERIF = 6 }
enum : uint { PAN_BENT_ARMS_HORZ = 7 }
enum : uint { PAN_BENT_ARMS_WEDGE = 8 }
enum : uint { PAN_BENT_ARMS_VERT = 9 }
enum : uint { PAN_BENT_ARMS_SINGLE_SERIF = 10 }
enum : uint { PAN_BENT_ARMS_DOUBLE_SERIF = 11 }

enum : uint { PAN_LETT_NORMAL_CONTACT = 2 }
enum : uint { PAN_LETT_NORMAL_WEIGHTED = 3 }
enum : uint { PAN_LETT_NORMAL_BOXED = 4 }
enum : uint { PAN_LETT_NORMAL_FLATTENED = 5 }
enum : uint { PAN_LETT_NORMAL_ROUNDED = 6 }
enum : uint { PAN_LETT_NORMAL_OFF_CENTER = 7 }
enum : uint { PAN_LETT_NORMAL_SQUARE = 8 }
enum : uint { PAN_LETT_OBLIQUE_CONTACT = 9 }
enum : uint { PAN_LETT_OBLIQUE_WEIGHTED = 10 }
enum : uint { PAN_LETT_OBLIQUE_BOXED = 11 }
enum : uint { PAN_LETT_OBLIQUE_FLATTENED = 12 }
enum : uint { PAN_LETT_OBLIQUE_ROUNDED = 13 }
enum : uint { PAN_LETT_OBLIQUE_OFF_CENTER = 14 }
enum : uint { PAN_LETT_OBLIQUE_SQUARE = 15 }

enum : uint { PAN_MIDLINE_STANDARD_TRIMMED = 2 }
enum : uint { PAN_MIDLINE_STANDARD_POINTED = 3 }
enum : uint { PAN_MIDLINE_STANDARD_SERIFED = 4 }
enum : uint { PAN_MIDLINE_HIGH_TRIMMED = 5 }
enum : uint { PAN_MIDLINE_HIGH_POINTED = 6 }
enum : uint { PAN_MIDLINE_HIGH_SERIFED = 7 }
enum : uint { PAN_MIDLINE_CONSTANT_TRIMMED = 8 }
enum : uint { PAN_MIDLINE_CONSTANT_POINTED = 9 }
enum : uint { PAN_MIDLINE_CONSTANT_SERIFED = 10 }
enum : uint { PAN_MIDLINE_LOW_TRIMMED = 11 }
enum : uint { PAN_MIDLINE_LOW_POINTED = 12 }
enum : uint { PAN_MIDLINE_LOW_SERIFED = 13 }

enum : uint { PAN_XHEIGHT_CONSTANT_SMALL = 2 }
enum : uint { PAN_XHEIGHT_CONSTANT_STD = 3 }
enum : uint { PAN_XHEIGHT_CONSTANT_LARGE = 4 }
enum : uint { PAN_XHEIGHT_DUCKING_SMALL = 5 }
enum : uint { PAN_XHEIGHT_DUCKING_STD = 6 }
enum : uint { PAN_XHEIGHT_DUCKING_LARGE = 7 }

enum : uint { ELF_VENDOR_SIZE = 4 }

struct tagEXTLOGFONTA {
  LOGFONTA elfLogFont;
  BYTE elfFullName[LF_FULLFACESIZE];
  BYTE elfStyle[LF_FACESIZE];
  DWORD elfVersion;
  DWORD elfStyleSize;
  DWORD elfMatch;
  DWORD elfReserved;
  BYTE elfVendorId[ELF_VENDOR_SIZE];
  DWORD elfCulture;
  PANOSE elfPanose;
}
alias tagEXTLOGFONTA EXTLOGFONTA;
alias tagEXTLOGFONTA* PEXTLOGFONTA;
alias tagEXTLOGFONTA* NPEXTLOGFONTA;
alias tagEXTLOGFONTA* LPEXTLOGFONTA;

struct tagEXTLOGFONTW {
  LOGFONTW elfLogFont;
  WCHAR elfFullName[LF_FULLFACESIZE];
  WCHAR elfStyle[LF_FACESIZE];
  DWORD elfVersion;
  DWORD elfStyleSize;
  DWORD elfMatch;
  DWORD elfReserved;
  BYTE elfVendorId[ELF_VENDOR_SIZE];
  DWORD elfCulture;
  PANOSE elfPanose;
}
alias tagEXTLOGFONTW EXTLOGFONTW;
alias tagEXTLOGFONTW* PEXTLOGFONTW;
alias tagEXTLOGFONTW* NPEXTLOGFONTW;
alias tagEXTLOGFONTW* LPEXTLOGFONTW;

// #ifdef UNICODE
// ...
// #else
alias EXTLOGFONTA EXTLOGFONT;
alias PEXTLOGFONTA PEXTLOGFONT;
alias NPEXTLOGFONTA NPEXTLOGFONT;
alias LPEXTLOGFONTA LPEXTLOGFONT;
// #endif // UNICODE

enum : uint { ELF_VERSION = 0 }
enum : uint { ELF_CULTURE_LATIN = 0 }

enum : uint { RASTER_FONTTYPE = 0x0001 }
enum : uint { DEVICE_FONTTYPE = 0x002 }
enum : uint { TRUETYPE_FONTTYPE = 0x004 }

COLORREF RGB(BYTE r, BYTE g, BYTE b){ return r|(g <<8)|(b << 16); }
COLORREF PALETTERGB(BYTE r, BYTE g, BYTE b){ return (0x02000000 | RGB(r,g,b)); }
COLORREF PALETTEINDEX(WORD i){ return (cast(COLORREF)(0x01000000 | cast(DWORD)cast(WORD)(i))); }

enum : uint { PC_RESERVED = 0x01 }
enum : uint { PC_EXPLICIT = 0x02 }
enum : uint { PC_NOCOLLAPSE = 0x04 }

BYTE GetRValue(COLORREF rgb){ return cast(BYTE)rgb; }
BYTE GetGValue(COLORREF rgb){ return cast(BYTE)(rgb >>> 8); }
BYTE GetBValue(COLORREF rgb){ return cast(BYTE)(rgb >>> 16); }

enum : uint { TRANSPARENT = 1 }
enum : uint { OPAQUE = 2 }
enum : uint { BKMODE_LAST = 2 }

enum : uint { GM_COMPATIBLE = 1 }
enum : uint { GM_ADVANCED = 2 }
enum : uint { GM_LAST = 2 }

enum : uint { PT_CLOSEFIGURE = 0x01 }
enum : uint { PT_LINETO = 0x02 }
enum : uint { PT_BEZIERTO = 0x04 }
enum : uint { PT_MOVETO = 0x06 }

enum : uint { MM_TEXT = 1 }
enum : uint { MM_LOMETRIC = 2 }
enum : uint { MM_HIMETRIC = 3 }
enum : uint { MM_LOENGLISH = 4 }
enum : uint { MM_HIENGLISH = 5 }
enum : uint { MM_TWIPS = 6 }
enum : uint { MM_ISOTROPIC = 7 }
enum : uint { MM_ANISOTROPIC = 8 }

alias MM_TEXT MM_MIN;
alias MM_ANISOTROPIC MM_MAX;
alias MM_TWIPS MM_MAX_FIXEDSCALE;

enum : uint { ABSOLUTE = 1 }
enum : uint { RELATIVE = 2 }

enum : uint { WHITE_BRUSH = 0 }
enum : uint { LTGRAY_BRUSH = 1 }
enum : uint { GRAY_BRUSH = 2 }
enum : uint { DKGRAY_BRUSH = 3 }
enum : uint { BLACK_BRUSH = 4 }
enum : uint { NULL_BRUSH = 5 }
alias NULL_BRUSH HOLLOW_BRUSH;
enum : uint { WHITE_PEN = 6 }
enum : uint { BLACK_PEN = 7 }
enum : uint { NULL_PEN = 8 }
enum : uint { OEM_FIXED_FONT = 10 }
enum : uint { ANSI_FIXED_FONT = 11 }
enum : uint { ANSI_VAR_FONT = 12 }
enum : uint { SYSTEM_FONT = 13 }
enum : uint { DEVICE_DEFAULT_FONT = 14 }
enum : uint { DEFAULT_PALETTE = 15 }
enum : uint { SYSTEM_FIXED_FONT = 16 }

// #if(WINVER >= 0x0400)
enum : uint { DEFAULT_GUI_FONT = 17 }
// #endif /* WINVER >= 0x0400 */

// #if (_WIN32_WINNT >= 0x0500)
enum : uint { DC_BRUSH = 18 }
enum : uint { DC_PEN = 19 }
// #endif

// #if (_WIN32_WINNT >= 0x0500)
enum : uint { STOCK_LAST = 19 }
// #elif (WINVER >= 0x0400)
// #...
// #else
// #...
// #endif

enum : uint { CLR_INVALID = 0xFFFFFFFF }

enum : uint { BS_SOLID = 0 }
enum : uint { BS_NULL = 1 }
alias BS_NULL BS_HOLLOW;
enum : uint { BS_HATCHED = 2 }
enum : uint { BS_PATTERN = 3 }
enum : uint { BS_INDEXED = 4 }
enum : uint { BS_DIBPATTERN = 5 }
enum : uint { BS_DIBPATTERNPT = 6 }
enum : uint { BS_PATTERN8X8 = 7 }
enum : uint { BS_DIBPATTERN8X8 = 8 }
enum : uint { BS_MONOPATTERN = 9 }

enum : uint { HS_HORIZONTAL = 0 }
enum : uint { HS_VERTICAL = 1 }
enum : uint { HS_FDIAGONAL = 2 }
enum : uint { HS_BDIAGONAL = 3 }
enum : uint { HS_CROSS = 4 }
enum : uint { HS_DIAGCROSS = 5 }

enum : uint { PS_SOLID = 0 }
enum : uint { PS_DASH = 1 }
enum : uint { PS_DOT = 2 }
enum : uint { PS_DASHDOT = 3 }
enum : uint { PS_DASHDOTDOT = 4 }
enum : uint { PS_NULL = 5 }
enum : uint { PS_INSIDEFRAME = 6 }
enum : uint { PS_USERSTYLE = 7 }
enum : uint { PS_ALTERNATE = 8 }
enum : uint { PS_STYLE_MASK = 0x0000000F }

enum : uint { PS_ENDCAP_ROUND = 0x00000000 }
enum : uint { PS_ENDCAP_SQUARE = 0x00000100 }
enum : uint { PS_ENDCAP_FLAT = 0x00000200 }
enum : uint { PS_ENDCAP_MASK = 0x00000F00 }

enum : uint { PS_JOIN_ROUND = 0x00000000 }
enum : uint { PS_JOIN_BEVEL = 0x00001000 }
enum : uint { PS_JOIN_MITER = 0x00002000 }
enum : uint { PS_JOIN_MASK = 0x0000F000 }

enum : uint { PS_COSMETIC = 0x00000000 }
enum : uint { PS_GEOMETRIC = 0x00010000 }
enum : uint { PS_TYPE_MASK = 0x000F0000 }

enum : uint { AD_COUNTERCLOCKWISE = 1 }
enum : uint { AD_CLOCKWISE = 2 }

enum : uint { DRIVERVERSION = 0 }
enum : uint { TECHNOLOGY = 2 }
enum : uint { HORZSIZE = 4 }
enum : uint { VERTSIZE = 6 }
enum : uint { HORZRES = 8 }
enum : uint { VERTRES = 10 }
enum : uint { BITSPIXEL = 12 }
enum : uint { PLANES = 14 }
enum : uint { NUMBRUSHES = 16 }
enum : uint { NUMPENS = 18 }
enum : uint { NUMMARKERS = 20 }
enum : uint { NUMFONTS = 22 }
enum : uint { NUMCOLORS = 24 }
enum : uint { PDEVICESIZE = 26 }
enum : uint { CURVECAPS = 28 }
enum : uint { LINECAPS = 30 }
enum : uint { POLYGONALCAPS = 32 }
enum : uint { TEXTCAPS = 34 }
enum : uint { CLIPCAPS = 36 }
enum : uint { RASTERCAPS = 38 }
enum : uint { ASPECTX = 40 }
enum : uint { ASPECTY = 42 }
enum : uint { ASPECTXY = 44 }

enum : uint { LOGPIXELSX = 88 }
enum : uint { LOGPIXELSY = 90 }

enum : uint { SIZEPALETTE = 104 }
enum : uint { NUMRESERVED = 106 }
enum : uint { COLORRES = 108 }

enum : uint { PHYSICALWIDTH = 110 }
enum : uint { PHYSICALHEIGHT = 111 }
enum : uint { PHYSICALOFFSETX = 112 }
enum : uint { PHYSICALOFFSETY = 113 }
enum : uint { SCALINGFACTORX = 114 }
enum : uint { SCALINGFACTORY = 115 }

enum : uint { VREFRESH = 116 }

enum : uint { DESKTOPVERTRES = 117 }

enum : uint { DESKTOPHORZRES = 118 }

enum : uint { BLTALIGNMENT = 119 }

// #if(WINVER >= 0x0500)
enum : uint { SHADEBLENDCAPS = 120 }
enum : uint { COLORMGMTCAPS = 121 }
// #endif /* WINVER >= 0x0500 */

// #ifndef NOGDICAPMASKS

enum : uint { DT_PLOTTER = 0 }
enum : uint { DT_RASDISPLAY = 1 }
enum : uint { DT_RASPRINTER = 2 }
enum : uint { DT_RASCAMERA = 3 }
enum : uint { DT_CHARSTREAM = 4 }
enum : uint { DT_METAFILE = 5 }
enum : uint { DT_DISPFILE = 6 }

enum : uint { CC_NONE = 0 }
enum : uint { CC_CIRCLES = 1 }
enum : uint { CC_PIE = 2 }
enum : uint { CC_CHORD = 4 }
enum : uint { CC_ELLIPSES = 8 }
enum : uint { CC_WIDE = 16 }
enum : uint { CC_STYLED = 32 }
enum : uint { CC_WIDESTYLED = 64 }
enum : uint { CC_INTERIORS = 128 }
enum : uint { CC_ROUNDRECT = 256 }

enum : uint { LC_NONE = 0 }
enum : uint { LC_POLYLINE = 2 }
enum : uint { LC_MARKER = 4 }
enum : uint { LC_POLYMARKER = 8 }
enum : uint { LC_WIDE = 16 }
enum : uint { LC_STYLED = 32 }
enum : uint { LC_WIDESTYLED = 64 }
enum : uint { LC_INTERIORS = 128 }

enum : uint { PC_NONE = 0 }
enum : uint { PC_POLYGON = 1 }
enum : uint { PC_RECTANGLE = 2 }
enum : uint { PC_WINDPOLYGON = 4 }
enum : uint { PC_TRAPEZOID = 4 }
enum : uint { PC_SCANLINE = 8 }
enum : uint { PC_WIDE = 16 }
enum : uint { PC_STYLED = 32 }
enum : uint { PC_WIDESTYLED = 64 }
enum : uint { PC_INTERIORS = 128 }
enum : uint { PC_POLYPOLYGON = 256 }
enum : uint { PC_PATHS = 512 }

enum : uint { CP_NONE = 0 }
enum : uint { CP_RECTANGLE = 1 }
enum : uint { CP_REGION = 2 }

enum : uint { TC_OP_CHARACTER = 0x00000001 }
enum : uint { TC_OP_STROKE = 0x00000002 }
enum : uint { TC_CP_STROKE = 0x00000004 }
enum : uint { TC_CR_90 = 0x00000008 }
enum : uint { TC_CR_ANY = 0x00000010 }
enum : uint { TC_SF_X_YINDEP = 0x00000020 }
enum : uint { TC_SA_DOUBLE = 0x00000040 }
enum : uint { TC_SA_INTEGER = 0x00000080 }
enum : uint { TC_SA_CONTIN = 0x00000100 }
enum : uint { TC_EA_DOUBLE = 0x00000200 }
enum : uint { TC_IA_ABLE = 0x00000400 }
enum : uint { TC_UA_ABLE = 0x00000800 }
enum : uint { TC_SO_ABLE = 0x00001000 }
enum : uint { TC_RA_ABLE = 0x00002000 }
enum : uint { TC_VA_ABLE = 0x00004000 }
enum : uint { TC_RESERVED = 0x00008000 }
enum : uint { TC_SCROLLBLT = 0x00010000 }

// #endif /* NOGDICAPMASKS */

// #define RC_NONE
enum : uint { RC_BITBLT = 1 }
enum : uint { RC_BANDING = 2 }
enum : uint { RC_SCALING = 4 }
enum : uint { RC_BITMAP64 = 8 }
enum : uint { RC_GDI20_OUTPUT = 0x0010 }
enum : uint { RC_GDI20_STATE = 0x0020 }
enum : uint { RC_SAVEBITMAP = 0x0040 }
enum : uint { RC_DI_BITMAP = 0x0080 }
enum : uint { RC_PALETTE = 0x0100 }
enum : uint { RC_DIBTODEV = 0x0200 }
enum : uint { RC_BIGFONT = 0x0400 }
enum : uint { RC_STRETCHBLT = 0x0800 }
enum : uint { RC_FLOODFILL = 0x1000 }
enum : uint { RC_STRETCHDIB = 0x2000 }
enum : uint { RC_OP_DX_OUTPUT = 0x4000 }
enum : uint { RC_DEVBITS = 0x8000 }

// #if(WINVER >= 0x0500)

enum : uint { SB_NONE = 0x00000000 }
enum : uint { SB_CONST_ALPHA = 0x00000001 }
enum : uint { SB_PIXEL_ALPHA = 0x00000002 }
enum : uint { SB_PREMULT_ALPHA = 0x00000004 }

enum : uint { SB_GRAD_RECT = 0x00000010 }
enum : uint { SB_GRAD_TRI = 0x00000020 }

enum : uint { CM_NONE = 0x00000000 }
enum : uint { CM_DEVICE_ICM = 0x00000001 }
enum : uint { CM_GAMMA_RAMP = 0x00000002 }
enum : uint { CM_CMYK_COLOR = 0x00000004 }

// #endif /* WINVER >= 0x0500 */

enum : uint { DIB_RGB_COLORS = 0 }
enum : uint { DIB_PAL_COLORS = 1 }

enum : uint { SYSPAL_ERROR = 0 }
enum : uint { SYSPAL_STATIC = 1 }
enum : uint { SYSPAL_NOSTATIC = 2 }
enum : uint { SYSPAL_NOSTATIC256 = 3 }

enum : uint { CBM_INIT = 0x04 }

enum : uint { FLOODFILLBORDER = 0 }
enum : uint { FLOODFILLSURFACE = 1 }

enum : uint { CCHDEVICENAME = 32 }

enum : uint { CCHFORMNAME = 32 }

struct _devicemodeA {
  BYTE dmDeviceName[CCHDEVICENAME];
  WORD dmSpecVersion;
  WORD dmDriverVersion;
  WORD dmSize;
  WORD dmDriverExtra;
  DWORD dmFields;
union {
struct {
  short dmOrientation;
  short dmPaperSize;
  short dmPaperLength;
  short dmPaperWidth;
}

  POINTL dmPosition;
}

  short dmScale;
  short dmCopies;
  short dmDefaultSource;
  short dmPrintQuality;
  short dmColor;
  short dmDuplex;
  short dmYResolution;
  short dmTTOption;
  short dmCollate;
  BYTE dmFormName[CCHFORMNAME];
  WORD dmLogPixels;
  DWORD dmBitsPerPel;
  DWORD dmPelsWidth;
  DWORD dmPelsHeight;
union {
  DWORD dmDisplayFlags;
  DWORD dmNup;
}

  DWORD dmDisplayFrequency;
// #if(WINVER >= 0x0400)
  DWORD dmICMMethod;
  DWORD dmICMIntent;
  DWORD dmMediaType;
  DWORD dmDitherType;
  DWORD dmReserved1;
  DWORD dmReserved2;
// #if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
  DWORD dmPanningWidth;
  DWORD dmPanningHeight;
// #endif
// #endif /* WINVER >= 0x0400 */
}
alias _devicemodeA DEVMODEA;
alias _devicemodeA* PDEVMODEA;
alias _devicemodeA* NPDEVMODEA;
alias _devicemodeA* LPDEVMODEA;

struct _devicemodeW {
  WCHAR dmDeviceName[CCHDEVICENAME];
  WORD dmSpecVersion;
  WORD dmDriverVersion;
  WORD dmSize;
  WORD dmDriverExtra;
  DWORD dmFields;
union {
struct {
  short dmOrientation;
  short dmPaperSize;
  short dmPaperLength;
  short dmPaperWidth;
}

  POINTL dmPosition;
}

  short dmScale;
  short dmCopies;
  short dmDefaultSource;
  short dmPrintQuality;
  short dmColor;
  short dmDuplex;
  short dmYResolution;
  short dmTTOption;
  short dmCollate;
  WCHAR dmFormName[CCHFORMNAME];
  WORD dmLogPixels;
  DWORD dmBitsPerPel;
  DWORD dmPelsWidth;
  DWORD dmPelsHeight;
union {
  DWORD dmDisplayFlags;
  DWORD dmNup;
}

  DWORD dmDisplayFrequency;
// #if(WINVER >= 0x0400)
  DWORD dmICMMethod;
  DWORD dmICMIntent;
  DWORD dmMediaType;
  DWORD dmDitherType;
  DWORD dmReserved1;
  DWORD dmReserved2;
// #if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
  DWORD dmPanningWidth;
  DWORD dmPanningHeight;
// #endif
// #endif /* WINVER >= 0x0400 */
}
alias _devicemodeW DEVMODEW;
alias _devicemodeW* PDEVMODEW;
alias _devicemodeW* NPDEVMODEW;
alias _devicemodeW* LPDEVMODEW;

// #ifdef UNICODE
// ...
// #else
alias DEVMODEA DEVMODE;
alias PDEVMODEA PDEVMODE;
alias NPDEVMODEA NPDEVMODE;
alias LPDEVMODEA LPDEVMODE;
// #endif // UNICODE

// #if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
enum : uint { DM_SPECVERSION = 0x0401 }
// #elif (WINVER >= 0x0400)
// #...
// #else
// #...
// #endif /* WINVER */

enum : uint { DM_ORIENTATION = 0x00000001 }
enum : uint { DM_PAPERSIZE = 0x00000002 }
enum : uint { DM_PAPERLENGTH = 0x00000004 }
enum : uint { DM_PAPERWIDTH = 0x00000008 }
enum : uint { DM_SCALE = 0x00000010 }
// #if(WINVER >= 0x0500)
enum : uint { DM_POSITION = 0x00000020 }
enum : uint { DM_NUP = 0x00000040 }
// #endif /* WINVER >= 0x0500 */
enum : uint { DM_COPIES = 0x00000100 }
enum : uint { DM_DEFAULTSOURCE = 0x00000200 }
enum : uint { DM_PRINTQUALITY = 0x00000400 }
enum : uint { DM_COLOR = 0x00000800 }
enum : uint { DM_DUPLEX = 0x00001000 }
enum : uint { DM_YRESOLUTION = 0x00002000 }
enum : uint { DM_TTOPTION = 0x00004000 }
enum : uint { DM_COLLATE = 0x00008000 }
enum : uint { DM_FORMNAME = 0x00010000 }
enum : uint { DM_LOGPIXELS = 0x00020000 }
enum : uint { DM_BITSPERPEL = 0x00040000 }
enum : uint { DM_PELSWIDTH = 0x00080000 }
enum : uint { DM_PELSHEIGHT = 0x00100000 }
enum : uint { DM_DISPLAYFLAGS = 0x00200000 }
enum : uint { DM_DISPLAYFREQUENCY = 0x00400000 }
// #if(WINVER >= 0x0400)
enum : uint { DM_ICMMETHOD = 0x00800000 }
enum : uint { DM_ICMINTENT = 0x01000000 }
enum : uint { DM_MEDIATYPE = 0x02000000 }
enum : uint { DM_DITHERTYPE = 0x04000000 }
enum : uint { DM_PANNINGWIDTH = 0x08000000 }
enum : uint { DM_PANNINGHEIGHT = 0x10000000 }
// #endif /* WINVER >= 0x0400 */

enum : uint { DMORIENT_PORTRAIT = 1 }
enum : uint { DMORIENT_LANDSCAPE = 2 }

enum { DMPAPER_FIRST = 1 }
enum : uint { DMPAPER_LETTER = 1 }
enum : uint { DMPAPER_LETTERSMALL = 2 }
enum : uint { DMPAPER_TABLOID = 3 }
enum : uint { DMPAPER_LEDGER = 4 }
enum : uint { DMPAPER_LEGAL = 5 }
enum : uint { DMPAPER_STATEMENT = 6 }
enum : uint { DMPAPER_EXECUTIVE = 7 }
enum : uint { DMPAPER_A3 = 8 }
enum : uint { DMPAPER_A4 = 9 }
enum : uint { DMPAPER_A4SMALL = 10 }
enum : uint { DMPAPER_A5 = 11 }
enum : uint { DMPAPER_B4 = 12 }
enum : uint { DMPAPER_B5 = 13 }
enum : uint { DMPAPER_FOLIO = 14 }
enum : uint { DMPAPER_QUARTO = 15 }
enum : uint { DMPAPER_10X14 = 16 }
enum : uint { DMPAPER_11X17 = 17 }
enum : uint { DMPAPER_NOTE = 18 }
enum : uint { DMPAPER_ENV_9 = 19 }
enum : uint { DMPAPER_ENV_10 = 20 }
enum : uint { DMPAPER_ENV_11 = 21 }
enum : uint { DMPAPER_ENV_12 = 22 }
enum : uint { DMPAPER_ENV_14 = 23 }
enum : uint { DMPAPER_CSHEET = 24 }
enum : uint { DMPAPER_DSHEET = 25 }
enum : uint { DMPAPER_ESHEET = 26 }
enum : uint { DMPAPER_ENV_DL = 27 }
enum : uint { DMPAPER_ENV_C5 = 28 }
enum : uint { DMPAPER_ENV_C3 = 29 }
enum : uint { DMPAPER_ENV_C4 = 30 }
enum : uint { DMPAPER_ENV_C6 = 31 }
enum : uint { DMPAPER_ENV_C65 = 32 }
enum : uint { DMPAPER_ENV_B4 = 33 }
enum : uint { DMPAPER_ENV_B5 = 34 }
enum : uint { DMPAPER_ENV_B6 = 35 }
enum : uint { DMPAPER_ENV_ITALY = 36 }
enum : uint { DMPAPER_ENV_MONARCH = 37 }
enum : uint { DMPAPER_ENV_PERSONAL = 38 }
enum : uint { DMPAPER_FANFOLD_US = 39 }
enum : uint { DMPAPER_FANFOLD_STD_GERMAN = 40 }
enum : uint { DMPAPER_FANFOLD_LGL_GERMAN = 41 }
// #if(WINVER >= 0x0400)
enum : uint { DMPAPER_ISO_B4 = 42 }
enum : uint { DMPAPER_JAPANESE_POSTCARD = 43 }
enum : uint { DMPAPER_9X11 = 44 }
enum : uint { DMPAPER_10X11 = 45 }
enum : uint { DMPAPER_15X11 = 46 }
enum : uint { DMPAPER_ENV_INVITE = 47 }
enum : uint { DMPAPER_RESERVED_48 = 48 }
enum : uint { DMPAPER_RESERVED_49 = 49 }
enum : uint { DMPAPER_LETTER_EXTRA = 50 }
enum : uint { DMPAPER_LEGAL_EXTRA = 51 }
enum : uint { DMPAPER_TABLOID_EXTRA = 52 }
enum : uint { DMPAPER_A4_EXTRA = 53 }
enum : uint { DMPAPER_LETTER_TRANSVERSE = 54 }
enum : uint { DMPAPER_A4_TRANSVERSE = 55 }
enum : uint { DMPAPER_LETTER_EXTRA_TRANSVERSE = 56 }
enum : uint { DMPAPER_A_PLUS = 57 }
enum : uint { DMPAPER_B_PLUS = 58 }
enum : uint { DMPAPER_LETTER_PLUS = 59 }
enum : uint { DMPAPER_A4_PLUS = 60 }
enum : uint { DMPAPER_A5_TRANSVERSE = 61 }
enum : uint { DMPAPER_B5_TRANSVERSE = 62 }
enum : uint { DMPAPER_A3_EXTRA = 63 }
enum : uint { DMPAPER_A5_EXTRA = 64 }
enum : uint { DMPAPER_B5_EXTRA = 65 }
enum : uint { DMPAPER_A2 = 66 }
enum : uint { DMPAPER_A3_TRANSVERSE = 67 }
enum : uint { DMPAPER_A3_EXTRA_TRANSVERSE = 68 }
// #endif /* WINVER >= 0x0400 */

// #if(WINVER >= 0x0500)
enum : uint { DMPAPER_DBL_JAPANESE_POSTCARD = 69 }
enum : uint { DMPAPER_A6 = 70 }
enum : uint { DMPAPER_JENV_KAKU2 = 71 }
enum : uint { DMPAPER_JENV_KAKU3 = 72 }
enum : uint { DMPAPER_JENV_CHOU3 = 73 }
enum : uint { DMPAPER_JENV_CHOU4 = 74 }
enum : uint { DMPAPER_LETTER_ROTATED = 75 }
enum : uint { DMPAPER_A3_ROTATED = 76 }
enum : uint { DMPAPER_A4_ROTATED = 77 }
enum : uint { DMPAPER_A5_ROTATED = 78 }
enum : uint { DMPAPER_B4_JIS_ROTATED = 79 }
enum : uint { DMPAPER_B5_JIS_ROTATED = 80 }
enum : uint { DMPAPER_JAPANESE_POSTCARD_ROTATED = 81 }
enum : uint { DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82 }
enum : uint { DMPAPER_A6_ROTATED = 83 }
enum : uint { DMPAPER_JENV_KAKU2_ROTATED = 84 }
enum : uint { DMPAPER_JENV_KAKU3_ROTATED = 85 }
enum : uint { DMPAPER_JENV_CHOU3_ROTATED = 86 }
enum : uint { DMPAPER_JENV_CHOU4_ROTATED = 87 }
enum : uint { DMPAPER_B6_JIS = 88 }
enum : uint { DMPAPER_B6_JIS_ROTATED = 89 }
enum : uint { DMPAPER_12X11 = 90 }
enum : uint { DMPAPER_JENV_YOU4 = 91 }
enum : uint { DMPAPER_JENV_YOU4_ROTATED = 92 }
enum : uint { DMPAPER_P16K = 93 }
enum : uint { DMPAPER_P32K = 94 }
enum : uint { DMPAPER_P32KBIG = 95 }
enum : uint { DMPAPER_PENV_1 = 96 }
enum : uint { DMPAPER_PENV_2 = 97 }
enum : uint { DMPAPER_PENV_3 = 98 }
enum : uint { DMPAPER_PENV_4 = 99 }
enum : uint { DMPAPER_PENV_5 = 100 }
enum : uint { DMPAPER_PENV_6 = 101 }
enum : uint { DMPAPER_PENV_7 = 102 }
enum : uint { DMPAPER_PENV_8 = 103 }
enum : uint { DMPAPER_PENV_9 = 104 }
enum : uint { DMPAPER_PENV_10 = 105 }
enum : uint { DMPAPER_P16K_ROTATED = 106 }
enum : uint { DMPAPER_P32K_ROTATED = 107 }
enum : uint { DMPAPER_P32KBIG_ROTATED = 108 }
enum : uint { DMPAPER_PENV_1_ROTATED = 109 }
enum : uint { DMPAPER_PENV_2_ROTATED = 110 }
enum : uint { DMPAPER_PENV_3_ROTATED = 111 }
enum : uint { DMPAPER_PENV_4_ROTATED = 112 }
enum : uint { DMPAPER_PENV_5_ROTATED = 113 }
enum : uint { DMPAPER_PENV_6_ROTATED = 114 }
enum : uint { DMPAPER_PENV_7_ROTATED = 115 }
enum : uint { DMPAPER_PENV_8_ROTATED = 116 }
enum : uint { DMPAPER_PENV_9_ROTATED = 117 }
enum : uint { DMPAPER_PENV_10_ROTATED = 118 }
// #endif /* WINVER >= 0x0500 */

// #if (WINVER >= 0x0500)
alias DMPAPER_PENV_10_ROTATED DMPAPER_LAST;
// #elif (WINVER >= 0x0400)
// #...
// #else
// #...
// #endif

enum : uint { DMPAPER_USER = 256 }

enum { DMBIN_FIRST = 1 }
enum : uint { DMBIN_UPPER = 1 }
enum : uint { DMBIN_ONLYONE = 1 }
enum : uint { DMBIN_LOWER = 2 }
enum : uint { DMBIN_MIDDLE = 3 }
enum : uint { DMBIN_MANUAL = 4 }
enum : uint { DMBIN_ENVELOPE = 5 }
enum : uint { DMBIN_ENVMANUAL = 6 }
enum : uint { DMBIN_AUTO = 7 }
enum : uint { DMBIN_TRACTOR = 8 }
enum : uint { DMBIN_SMALLFMT = 9 }
enum : uint { DMBIN_LARGEFMT = 10 }
enum : uint { DMBIN_LARGECAPACITY = 11 }
enum : uint { DMBIN_CASSETTE = 14 }
enum : uint { DMBIN_FORMSOURCE = 15 }
alias DMBIN_FORMSOURCE DMBIN_LAST;

enum : uint { DMBIN_USER = 256 }

enum { DMRES_DRAFT = -1 }
enum { DMRES_LOW = -2 }
enum { DMRES_MEDIUM = -3 }
enum { DMRES_HIGH = -4 }

enum : uint { DMCOLOR_MONOCHROME = 1 }
enum : uint { DMCOLOR_COLOR = 2 }

enum : uint { DMDUP_SIMPLEX = 1 }
enum : uint { DMDUP_VERTICAL = 2 }
enum : uint { DMDUP_HORIZONTAL = 3 }

enum : uint { DMTT_BITMAP = 1 }
enum : uint { DMTT_DOWNLOAD = 2 }
enum : uint { DMTT_SUBDEV = 3 }
// #if(WINVER >= 0x0400)
enum : uint { DMTT_DOWNLOAD_OUTLINE = 4 }
// #endif /* WINVER >= 0x0400 */

enum : uint { DMCOLLATE_FALSE = 0 }
enum : uint { DMCOLLATE_TRUE = 1 }

enum : uint { DMDISPLAYFLAGS_TEXTMODE = 0x00000004 }

enum : uint { DMNUP_SYSTEM = 1 }
enum : uint { DMNUP_ONEUP = 2 }

// #if(WINVER >= 0x0400)

enum : uint { DMICMMETHOD_NONE = 1 }
enum : uint { DMICMMETHOD_SYSTEM = 2 }
enum : uint { DMICMMETHOD_DRIVER = 3 }
enum : uint { DMICMMETHOD_DEVICE = 4 }

enum : uint { DMICMMETHOD_USER = 256 }

enum : uint { DMICM_SATURATE = 1 }
enum : uint { DMICM_CONTRAST = 2 }
enum : uint { DMICM_COLORIMETRIC = 3 }
enum : uint { DMICM_ABS_COLORIMETRIC = 4 }

enum : uint { DMICM_USER = 256 }

enum : uint { DMMEDIA_STANDARD = 1 }
enum : uint { DMMEDIA_TRANSPARENCY = 2 }
enum : uint { DMMEDIA_GLOSSY = 3 }

enum : uint { DMMEDIA_USER = 256 }

enum : uint { DMDITHER_NONE = 1 }
enum : uint { DMDITHER_COARSE = 2 }
enum : uint { DMDITHER_FINE = 3 }
enum : uint { DMDITHER_LINEART = 4 }
enum : uint { DMDITHER_ERRORDIFFUSION = 5 }
enum : uint { DMDITHER_RESERVED6 = 6 }
enum : uint { DMDITHER_RESERVED7 = 7 }
enum : uint { DMDITHER_RESERVED8 = 8 }
enum : uint { DMDITHER_RESERVED9 = 9 }
enum : uint { DMDITHER_GRAYSCALE = 10 }

enum : uint { DMDITHER_USER = 256 }
// #endif /* WINVER >= 0x0400 */

struct _DISPLAY_DEVICEA {
  DWORD cb;
  CHAR DeviceName[32];
  CHAR DeviceString[128];
  DWORD StateFlags;
  CHAR DeviceID[128];
  CHAR DeviceKey[128];
}
alias _DISPLAY_DEVICEA DISPLAY_DEVICEA;
alias _DISPLAY_DEVICEA* PDISPLAY_DEVICEA;
alias _DISPLAY_DEVICEA* LPDISPLAY_DEVICEA;

struct _DISPLAY_DEVICEW {
  DWORD cb;
  WCHAR DeviceName[32];
  WCHAR DeviceString[128];
  DWORD StateFlags;
  WCHAR DeviceID[128];
  WCHAR DeviceKey[128];
}
alias _DISPLAY_DEVICEW DISPLAY_DEVICEW;
alias _DISPLAY_DEVICEW* PDISPLAY_DEVICEW;
alias _DISPLAY_DEVICEW* LPDISPLAY_DEVICEW;

// #ifdef UNICODE
// ...
// #else
alias DISPLAY_DEVICEA DISPLAY_DEVICE;
alias PDISPLAY_DEVICEA PDISPLAY_DEVICE;
alias LPDISPLAY_DEVICEA LPDISPLAY_DEVICE;
// #endif // UNICODE

enum : uint { DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 0x00000001 }
enum : uint { DISPLAY_DEVICE_MULTI_DRIVER = 0x00000002 }
enum : uint { DISPLAY_DEVICE_PRIMARY_DEVICE = 0x00000004 }
enum : uint { DISPLAY_DEVICE_MIRRORING_DRIVER = 0x00000008 }
enum : uint { DISPLAY_DEVICE_VGA_COMPATIBLE = 0x00000010 }
enum : uint { DISPLAY_DEVICE_REMOVABLE = 0x00000020 }
enum : uint { DISPLAY_DEVICE_MODESPRUNED = 0x08000000 }
enum : uint { DISPLAY_DEVICE_REMOTE = 0x04000000 }
enum : uint { DISPLAY_DEVICE_DISCONNECT = 0x02000000 }

enum : uint { DISPLAY_DEVICE_ACTIVE = 0x00000001 }
enum : uint { DISPLAY_DEVICE_ATTACHED = 0x00000002 }

enum : uint { RDH_RECTANGLES = 1 }

struct _RGNDATAHEADER {
  DWORD dwSize;
  DWORD iType;
  DWORD nCount;
  DWORD nRgnSize;
  RECT rcBound;
}
alias _RGNDATAHEADER RGNDATAHEADER;
alias _RGNDATAHEADER* PRGNDATAHEADER;

struct _RGNDATA {
  RGNDATAHEADER rdh;
  char Buffer[1];
}
alias _RGNDATA RGNDATA;
alias _RGNDATA* PRGNDATA;
alias _RGNDATA* NPRGNDATA;
alias _RGNDATA* LPRGNDATA;

enum : uint { SYSRGN = 4 }

struct _ABC {
  int abcA;
  UINT abcB;
  int abcC;
}
alias _ABC ABC;
alias _ABC* PABC;
alias _ABC* NPABC;
alias _ABC* LPABC;

struct _ABCFLOAT {
  FLOAT abcfA;
  FLOAT abcfB;
  FLOAT abcfC;
}
alias _ABCFLOAT ABCFLOAT;
alias _ABCFLOAT* PABCFLOAT;
alias _ABCFLOAT* NPABCFLOAT;
alias _ABCFLOAT* LPABCFLOAT;

// #ifndef NOTEXTMETRIC

// #ifdef _MAC
// #...
// #endif
struct _OUTLINETEXTMETRICA {
  UINT otmSize;
  TEXTMETRICA otmTextMetrics;
  BYTE otmFiller;
  PANOSE otmPanoseNumber;
  UINT otmfsSelection;
  UINT otmfsType;
  int otmsCharSlopeRise;
  int otmsCharSlopeRun;
  int otmItalicAngle;
  UINT otmEMSquare;
  int otmAscent;
  int otmDescent;
  UINT otmLineGap;
  UINT otmsCapEmHeight;
  UINT otmsXHeight;
  RECT otmrcFontBox;
  int otmMacAscent;
  int otmMacDescent;
  UINT otmMacLineGap;
  UINT otmusMinimumPPEM;
  POINT otmptSubscriptSize;
  POINT otmptSubscriptOffset;
  POINT otmptSuperscriptSize;
  POINT otmptSuperscriptOffset;
  UINT otmsStrikeoutSize;
  int otmsStrikeoutPosition;
  int otmsUnderscoreSize;
  int otmsUnderscorePosition;
  PSTR otmpFamilyName;
  PSTR otmpFaceName;
  PSTR otmpStyleName;
  PSTR otmpFullName;
}
alias _OUTLINETEXTMETRICA OUTLINETEXTMETRICA;
alias _OUTLINETEXTMETRICA* POUTLINETEXTMETRICA;
alias _OUTLINETEXTMETRICA* NPOUTLINETEXTMETRICA;
alias _OUTLINETEXTMETRICA* LPOUTLINETEXTMETRICA;

struct _OUTLINETEXTMETRICW {
  UINT otmSize;
  TEXTMETRICW otmTextMetrics;
  BYTE otmFiller;
  PANOSE otmPanoseNumber;
  UINT otmfsSelection;
  UINT otmfsType;
  int otmsCharSlopeRise;
  int otmsCharSlopeRun;
  int otmItalicAngle;
  UINT otmEMSquare;
  int otmAscent;
  int otmDescent;
  UINT otmLineGap;
  UINT otmsCapEmHeight;
  UINT otmsXHeight;
  RECT otmrcFontBox;
  int otmMacAscent;
  int otmMacDescent;
  UINT otmMacLineGap;
  UINT otmusMinimumPPEM;
  POINT otmptSubscriptSize;
  POINT otmptSubscriptOffset;
  POINT otmptSuperscriptSize;
  POINT otmptSuperscriptOffset;
  UINT otmsStrikeoutSize;
  int otmsStrikeoutPosition;
  int otmsUnderscoreSize;
  int otmsUnderscorePosition;
  PSTR otmpFamilyName;
  PSTR otmpFaceName;
  PSTR otmpStyleName;
  PSTR otmpFullName;
}
alias _OUTLINETEXTMETRICW OUTLINETEXTMETRICW;
alias _OUTLINETEXTMETRICW* POUTLINETEXTMETRICW;
alias _OUTLINETEXTMETRICW* NPOUTLINETEXTMETRICW;
alias _OUTLINETEXTMETRICW* LPOUTLINETEXTMETRICW;

// #ifdef UNICODE
// ...
// #else
alias OUTLINETEXTMETRICA OUTLINETEXTMETRIC;
alias POUTLINETEXTMETRICA POUTLINETEXTMETRIC;
alias NPOUTLINETEXTMETRICA NPOUTLINETEXTMETRIC;
alias LPOUTLINETEXTMETRICA LPOUTLINETEXTMETRIC;
// #endif // UNICODE

// #ifdef _MAC
// #...
// #endif

// #endif /* NOTEXTMETRIC */

struct tagPOLYTEXTA {
  int x;
  int y;
  UINT n;
  LPCSTR lpstr;
  UINT uiFlags;
  RECT rcl;
  int *pdx;
}
alias tagPOLYTEXTA POLYTEXTA;
alias tagPOLYTEXTA* PPOLYTEXTA;
alias tagPOLYTEXTA* NPPOLYTEXTA;
alias tagPOLYTEXTA* LPPOLYTEXTA;

struct tagPOLYTEXTW {
  int x;
  int y;
  UINT n;
  LPCWSTR lpstr;
  UINT uiFlags;
  RECT rcl;
  int *pdx;
}
alias tagPOLYTEXTW POLYTEXTW;
alias tagPOLYTEXTW* PPOLYTEXTW;
alias tagPOLYTEXTW* NPPOLYTEXTW;
alias tagPOLYTEXTW* LPPOLYTEXTW;

// #ifdef UNICODE
// ...
// #else
alias POLYTEXTA POLYTEXT;
alias PPOLYTEXTA PPOLYTEXT;
alias NPPOLYTEXTA NPPOLYTEXT;
alias LPPOLYTEXTA LPPOLYTEXT;
// #endif // UNICODE

struct _FIXED {
// #ifndef _MAC
  WORD fract;
  short value;
// #else
// ...
// #endif
}
alias _FIXED FIXED;

struct _MAT2 {
  FIXED eM11;
  FIXED eM12;
  FIXED eM21;
  FIXED eM22;
}
alias _MAT2 MAT2;
alias _MAT2* LPMAT2;

struct _GLYPHMETRICS {
  UINT gmBlackBoxX;
  UINT gmBlackBoxY;
  POINT gmptGlyphOrigin;
  short gmCellIncX;
  short gmCellIncY;
}
alias _GLYPHMETRICS GLYPHMETRICS;
alias _GLYPHMETRICS* LPGLYPHMETRICS;

enum : uint { GGO_METRICS = 0 }
enum : uint { GGO_BITMAP = 1 }
enum : uint { GGO_NATIVE = 2 }
enum : uint { GGO_BEZIER = 3 }

// #if(WINVER >= 0x0400)
enum : uint { GGO_GRAY2_BITMAP = 4 }
enum : uint { GGO_GRAY4_BITMAP = 5 }
enum : uint { GGO_GRAY8_BITMAP = 6 }
enum : uint { GGO_GLYPH_INDEX = 0x0080 }
// #endif /* WINVER >= 0x0400 */

// #if (_WIN32_WINNT >= 0x0500)
enum : uint { GGO_UNHINTED = 0x0100 }
// #endif // (_WIN32_WINNT >= 0x0500)

enum : uint { TT_POLYGON_TYPE = 24 }

enum : uint { TT_PRIM_LINE = 1 }
enum : uint { TT_PRIM_QSPLINE = 2 }
enum : uint { TT_PRIM_CSPLINE = 3 }

struct tagPOINTFX {
  FIXED x;
  FIXED y;
}
alias tagPOINTFX POINTFX;
alias tagPOINTFX* LPPOINTFX;

struct tagTTPOLYCURVE {
  WORD wType;
  WORD cpfx;
  POINTFX apfx[1];
}
alias tagTTPOLYCURVE TTPOLYCURVE;
alias tagTTPOLYCURVE* LPTTPOLYCURVE;

struct tagTTPOLYGONHEADER {
  DWORD cb;
  DWORD dwType;
  POINTFX pfxStart;
}
alias tagTTPOLYGONHEADER TTPOLYGONHEADER;
alias tagTTPOLYGONHEADER* LPTTPOLYGONHEADER;

// #if(WINVER >= 0x0400)
enum : uint { GCP_DBCS = 0x0001 }
enum : uint { GCP_REORDER = 0x0002 }
enum : uint { GCP_USEKERNING = 0x0008 }
enum : uint { GCP_GLYPHSHAPE = 0x0010 }
enum : uint { GCP_LIGATE = 0x0020 }

enum : uint { GCP_DIACRITIC = 0x0100 }
enum : uint { GCP_KASHIDA = 0x0400 }
enum : uint { GCP_ERROR = 0x8000 }
enum : uint { FLI_MASK = 0x103B }

enum : uint { GCP_JUSTIFY = 0x00010000 }

enum : uint { FLI_GLYPHS = 0x00040000 }
enum : uint { GCP_CLASSIN = 0x00080000 }
enum : uint { GCP_MAXEXTENT = 0x00100000 }
enum : uint { GCP_JUSTIFYIN = 0x00200000 }
enum : uint { GCP_DISPLAYZWG = 0x00400000 }
enum : uint { GCP_SYMSWAPOFF = 0x00800000 }
enum : uint { GCP_NUMERICOVERRIDE = 0x01000000 }
enum : uint { GCP_NEUTRALOVERRIDE = 0x02000000 }
enum : uint { GCP_NUMERICSLATIN = 0x04000000 }
enum : uint { GCP_NUMERICSLOCAL = 0x08000000 }

enum : uint { GCPCLASS_LATIN = 1 }
enum : uint { GCPCLASS_HEBREW = 2 }
enum : uint { GCPCLASS_ARABIC = 2 }
enum : uint { GCPCLASS_NEUTRAL = 3 }
enum : uint { GCPCLASS_LOCALNUMBER = 4 }
enum : uint { GCPCLASS_LATINNUMBER = 5 }
enum : uint { GCPCLASS_LATINNUMERICTERMINATOR = 6 }
enum : uint { GCPCLASS_LATINNUMERICSEPARATOR = 7 }
enum : uint { GCPCLASS_NUMERICSEPARATOR = 8 }
enum : uint { GCPCLASS_PREBOUNDLTR = 0x80 }
enum : uint { GCPCLASS_PREBOUNDRTL = 0x40 }
enum : uint { GCPCLASS_POSTBOUNDLTR = 0x20 }
enum : uint { GCPCLASS_POSTBOUNDRTL = 0x10 }

enum : uint { GCPGLYPH_LINKBEFORE = 0x8000 }
enum : uint { GCPGLYPH_LINKAFTER = 0x4000 }

struct tagGCP_RESULTSA {
  DWORD lStructSize;
  LPSTR lpOutString;
  UINT *lpOrder;
  int *lpDx;
  int *lpCaretPos;
  LPSTR lpClass;
  LPWSTR lpGlyphs;
  UINT nGlyphs;
  int nMaxFit;
}
alias tagGCP_RESULTSA GCP_RESULTSA;
alias tagGCP_RESULTSA* LPGCP_RESULTSA;

struct tagGCP_RESULTSW {
  DWORD lStructSize;
  LPWSTR lpOutString;
  UINT *lpOrder;
  int *lpDx;
  int *lpCaretPos;
  LPSTR lpClass;
  LPWSTR lpGlyphs;
  UINT nGlyphs;
  int nMaxFit;
}
alias tagGCP_RESULTSW GCP_RESULTSW;
alias tagGCP_RESULTSW* LPGCP_RESULTSW;

// #ifdef UNICODE
// ...
// #else
alias GCP_RESULTSA GCP_RESULTS;
alias LPGCP_RESULTSA LPGCP_RESULTS;
// #endif // UNICODE
// #endif /* WINVER >= 0x0400 */

struct _RASTERIZER_STATUS {
  short nSize;
  short wFlags;
  short nLanguageID;
}
alias _RASTERIZER_STATUS RASTERIZER_STATUS;
alias _RASTERIZER_STATUS* LPRASTERIZER_STATUS;

enum : uint { TT_AVAILABLE = 0x0001 }
enum : uint { TT_ENABLED = 0x0002 }

struct tagPIXELFORMATDESCRIPTOR {
  WORD nSize;
  WORD nVersion;
  DWORD dwFlags;
  BYTE iPixelType;
  BYTE cColorBits;
  BYTE cRedBits;
  BYTE cRedShift;
  BYTE cGreenBits;
  BYTE cGreenShift;
  BYTE cBlueBits;
  BYTE cBlueShift;
  BYTE cAlphaBits;
  BYTE cAlphaShift;
  BYTE cAccumBits;
  BYTE cAccumRedBits;
  BYTE cAccumGreenBits;
  BYTE cAccumBlueBits;
  BYTE cAccumAlphaBits;
  BYTE cDepthBits;
  BYTE cStencilBits;
  BYTE cAuxBuffers;
  BYTE iLayerType;
  BYTE bReserved;
  DWORD dwLayerMask;
  DWORD dwVisibleMask;
  DWORD dwDamageMask;
}
alias tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR;
alias tagPIXELFORMATDESCRIPTOR* PPIXELFORMATDESCRIPTOR;
alias tagPIXELFORMATDESCRIPTOR* LPPIXELFORMATDESCRIPTOR;

enum : uint { PFD_TYPE_RGBA = 0 }
enum : uint { PFD_TYPE_COLORINDEX = 1 }

enum : uint { PFD_MAIN_PLANE = 0 }
enum : uint { PFD_OVERLAY_PLANE = 1 }
enum { PFD_UNDERLAY_PLANE = -1 }

enum : uint { PFD_DOUBLEBUFFER = 0x00000001 }
enum : uint { PFD_STEREO = 0x00000002 }
enum : uint { PFD_DRAW_TO_WINDOW = 0x00000004 }
enum : uint { PFD_DRAW_TO_BITMAP = 0x00000008 }
enum : uint { PFD_SUPPORT_GDI = 0x00000010 }
enum : uint { PFD_SUPPORT_OPENGL = 0x00000020 }
enum : uint { PFD_GENERIC_FORMAT = 0x00000040 }
enum : uint { PFD_NEED_PALETTE = 0x00000080 }
enum : uint { PFD_NEED_SYSTEM_PALETTE = 0x00000100 }
enum : uint { PFD_SWAP_EXCHANGE = 0x00000200 }
enum : uint { PFD_SWAP_COPY = 0x00000400 }
enum : uint { PFD_SWAP_LAYER_BUFFERS = 0x00000800 }
enum : uint { PFD_GENERIC_ACCELERATED = 0x00001000 }
enum : uint { PFD_SUPPORT_DIRECTDRAW = 0x00002000 }

enum : uint { PFD_DEPTH_DONTCARE = 0x20000000 }
enum : uint { PFD_DOUBLEBUFFER_DONTCARE = 0x40000000 }
enum : uint { PFD_STEREO_DONTCARE = 0x80000000 }

// #ifdef STRICT
// #if !defined(NOTEXTMETRIC)
extern(Windows) alias int function( LOGFONTA *,  TEXTMETRICA *, DWORD, LPARAM) OLDFONTENUMPROCA;
extern(Windows) alias int function( LOGFONTW *,  TEXTMETRICW *, DWORD, LPARAM) OLDFONTENUMPROCW;
// #ifdef UNICODE
// #...
// #else
alias OLDFONTENUMPROCA OLDFONTENUMPROC;
// #endif // !UNICODE
// #else
// ...
// #ifdef UNICODE
// #...
// #else
// #...
// #endif // !UNICODE
// #endif

alias OLDFONTENUMPROCA FONTENUMPROCA;
alias OLDFONTENUMPROCW FONTENUMPROCW;
// #ifdef UNICODE
// ...
// #else
alias FONTENUMPROCA FONTENUMPROC;
// #endif // UNICODE

extern(Windows) alias int function(LPVOID, LPARAM) GOBJENUMPROC;
extern(Windows) alias VOID function(int, int, LPARAM) LINEDDAPROC;
// #else
// ...
// #ifdef UNICODE
// ...
// #else
// ...
// #endif // UNICODE
// ...
// #endif

extern(Windows) export int AddFontResourceA(LPCSTR);
extern(Windows) export int AddFontResourceW(LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias AddFontResourceA AddFontResource;
// #endif // !UNICODE

extern(Windows) export BOOL AnimatePalette(HPALETTE, UINT, UINT, PALETTEENTRY *);
extern(Windows) export BOOL Arc(HDC, int, int, int, int, int, int, int, int);
extern(Windows) export BOOL BitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
extern(Windows) export BOOL CancelDC(HDC);
extern(Windows) export BOOL Chord(HDC, int, int, int, int, int, int, int, int);
extern(Windows) export int ChoosePixelFormat(HDC, PIXELFORMATDESCRIPTOR *);
extern(Windows) export HMETAFILE CloseMetaFile(HDC);
extern(Windows) export int CombineRgn(HRGN, HRGN, HRGN, int);
extern(Windows) export HMETAFILE CopyMetaFileA(HMETAFILE, LPCSTR);
extern(Windows) export HMETAFILE CopyMetaFileW(HMETAFILE, LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias CopyMetaFileA CopyMetaFile;
// #endif // !UNICODE
extern(Windows) export HBITMAP CreateBitmap(int, int, UINT, UINT, VOID *);
extern(Windows) export HBITMAP CreateBitmapIndirect(BITMAP *);
extern(Windows) export HBRUSH CreateBrushIndirect(LOGBRUSH *);
extern(Windows) export HBITMAP CreateCompatibleBitmap(HDC, int, int);
extern(Windows) export HBITMAP CreateDiscardableBitmap(HDC, int, int);
extern(Windows) export HDC CreateCompatibleDC(HDC);
extern(Windows) export HDC CreateDCA(LPCSTR, LPCSTR, LPCSTR, DEVMODEA *);
extern(Windows) export HDC CreateDCW(LPCWSTR, LPCWSTR, LPCWSTR, DEVMODEW *);
// #ifdef UNICODE
// #...
// #else
alias CreateDCA CreateDC;
// #endif // !UNICODE
extern(Windows) export HBITMAP CreateDIBitmap(HDC, BITMAPINFOHEADER *, DWORD, VOID *, BITMAPINFO *, UINT);
extern(Windows) export HBRUSH CreateDIBPatternBrush(HGLOBAL, UINT);
extern(Windows) export HBRUSH CreateDIBPatternBrushPt(VOID *, UINT);
extern(Windows) export HRGN CreateEllipticRgn(int, int, int, int);
extern(Windows) export HRGN CreateEllipticRgnIndirect(RECT *);
extern(Windows) export HFONT CreateFontIndirectA(LOGFONTA *);
extern(Windows) export HFONT CreateFontIndirectW(LOGFONTW *);
// #ifdef UNICODE
// #...
// #else
alias CreateFontIndirectA CreateFontIndirect;
// #endif // !UNICODE
extern(Windows) export HFONT CreateFontA(int, int, int, int, int, DWORD,
  DWORD, DWORD, DWORD, DWORD, DWORD,
  DWORD, DWORD, LPCSTR);
extern(Windows) export HFONT CreateFontW(int, int, int, int, int, DWORD,
  DWORD, DWORD, DWORD, DWORD, DWORD,
  DWORD, DWORD, LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias CreateFontA CreateFont;
// #endif // !UNICODE

extern(Windows) export HBRUSH CreateHatchBrush(int, COLORREF);
extern(Windows) export HDC CreateICA(LPCSTR, LPCSTR, LPCSTR, DEVMODEA *);
extern(Windows) export HDC CreateICW(LPCWSTR, LPCWSTR, LPCWSTR, DEVMODEW *);
// #ifdef UNICODE
// #...
// #else
alias CreateICA CreateIC;
// #endif // !UNICODE
extern(Windows) export HDC CreateMetaFileA(LPCSTR);
extern(Windows) export HDC CreateMetaFileW(LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias CreateMetaFileA CreateMetaFile;
// #endif // !UNICODE
extern(Windows) export HPALETTE CreatePalette(LOGPALETTE *);
extern(Windows) export HPEN CreatePen(int, int, COLORREF);
extern(Windows) export HPEN CreatePenIndirect(LOGPEN *);
extern(Windows) export HRGN CreatePolyPolygonRgn(POINT *, INT *, int, int);
extern(Windows) export HBRUSH CreatePatternBrush(HBITMAP);
extern(Windows) export HRGN CreateRectRgn(int, int, int, int);
extern(Windows) export HRGN CreateRectRgnIndirect(RECT *);
extern(Windows) export HRGN CreateRoundRectRgn(int, int, int, int, int, int);
extern(Windows) export BOOL CreateScalableFontResourceA(DWORD, LPCSTR, LPCSTR, LPCSTR);
extern(Windows) export BOOL CreateScalableFontResourceW(DWORD, LPCWSTR, LPCWSTR, LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias CreateScalableFontResourceA CreateScalableFontResource;
// #endif // !UNICODE
extern(Windows) export HBRUSH CreateSolidBrush(COLORREF);

extern(Windows) export BOOL DeleteDC(HDC);
extern(Windows) export BOOL DeleteMetaFile(HMETAFILE);
extern(Windows) export BOOL DeleteObject(HGDIOBJ);
extern(Windows) export int DescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);

extern(Windows) alias UINT function(HWND, HMODULE, LPDEVMODE, LPSTR, LPSTR, LPDEVMODE, LPSTR, UINT) LPFNDEVMODE;

extern(Windows) alias DWORD function(LPSTR, LPSTR, UINT, LPSTR, LPDEVMODE) LPFNDEVCAPS;

enum : uint { DM_UPDATE = 1 }
enum : uint { DM_COPY = 2 }
enum : uint { DM_PROMPT = 4 }
enum : uint { DM_MODIFY = 8 }

alias DM_MODIFY DM_IN_BUFFER;
alias DM_PROMPT DM_IN_PROMPT;
alias DM_COPY DM_OUT_BUFFER;
alias DM_UPDATE DM_OUT_DEFAULT;

enum : uint { DC_FIELDS = 1 }
enum : uint { DC_PAPERS = 2 }
enum : uint { DC_PAPERSIZE = 3 }
enum : uint { DC_MINEXTENT = 4 }
enum : uint { DC_MAXEXTENT = 5 }
enum : uint { DC_BINS = 6 }
enum : uint { DC_DUPLEX = 7 }
enum : uint { DC_SIZE = 8 }
enum : uint { DC_EXTRA = 9 }
enum : uint { DC_VERSION = 10 }
enum : uint { DC_DRIVER = 11 }
enum : uint { DC_BINNAMES = 12 }
enum : uint { DC_ENUMRESOLUTIONS = 13 }
enum : uint { DC_FILEDEPENDENCIES = 14 }
enum : uint { DC_TRUETYPE = 15 }
enum : uint { DC_PAPERNAMES = 16 }
enum : uint { DC_ORIENTATION = 17 }
enum : uint { DC_COPIES = 18 }
// #if(WINVER >= 0x0400)
enum : uint { DC_BINADJUST = 19 }
enum : uint { DC_EMF_COMPLIANT = 20 }
enum : uint { DC_DATATYPE_PRODUCED = 21 }
enum : uint { DC_COLLATE = 22 }
enum : uint { DC_MANUFACTURER = 23 }
enum : uint { DC_MODEL = 24 }
// #endif /* WINVER >= 0x0400 */

// #if(WINVER >= 0x0500)
enum : uint { DC_PERSONALITY = 25 }
enum : uint { DC_PRINTRATE = 26 }
enum : uint { DC_PRINTRATEUNIT = 27 }
enum : uint { PRINTRATEUNIT_PPM = 1 }
enum : uint { PRINTRATEUNIT_CPS = 2 }
enum : uint { PRINTRATEUNIT_LPM = 3 }
enum : uint { PRINTRATEUNIT_IPM = 4 }
enum : uint { DC_PRINTERMEM = 28 }
enum : uint { DC_MEDIAREADY = 29 }
enum : uint { DC_STAPLE = 30 }
enum : uint { DC_PRINTRATEPPM = 31 }
enum : uint { DC_COLORDEVICE = 32 }
enum : uint { DC_NUP = 33 }
enum : uint { DC_MEDIATYPENAMES = 34 }
enum : uint { DC_MEDIATYPES = 35 }
// #endif /* WINVER >= 0x0500 */

enum : uint { DCTT_BITMAP = 0x0000001 }
enum : uint { DCTT_DOWNLOAD = 0x0000002 }
enum : uint { DCTT_SUBDEV = 0x0000004 }
// #if(WINVER >= 0x0400)
enum : uint { DCTT_DOWNLOAD_OUTLINE = 0x0000008 }

enum : uint { DCBA_FACEUPNONE = 0x0000 }
enum : uint { DCBA_FACEUPCENTER = 0x0001 }
enum : uint { DCBA_FACEUPLEFT = 0x0002 }
enum : uint { DCBA_FACEUPRIGHT = 0x0003 }
enum : uint { DCBA_FACEDOWNNONE = 0x0100 }
enum : uint { DCBA_FACEDOWNCENTER = 0x0101 }
enum : uint { DCBA_FACEDOWNLEFT = 0x0102 }
enum : uint { DCBA_FACEDOWNRIGHT = 0x0103 }
// #endif /* WINVER >= 0x0400 */

extern(Windows) export int DeviceCapabilitiesA(LPCSTR, LPCSTR, WORD,
  LPSTR, DEVMODEA *);
extern(Windows) export int DeviceCapabilitiesW(LPCWSTR, LPCWSTR, WORD,
  LPWSTR, DEVMODEW *);
// #ifdef UNICODE
// #...
// #else
alias DeviceCapabilitiesA DeviceCapabilities;
// #endif // !UNICODE

extern(Windows) export int DrawEscape(HDC, int, int, LPCSTR);
extern(Windows) export BOOL Ellipse(HDC, int, int, int, int);

// #if(WINVER >= 0x0400)
extern(Windows) export int EnumFontFamiliesExA(HDC, LPLOGFONTA, FONTENUMPROCA, LPARAM, DWORD);
extern(Windows) export int EnumFontFamiliesExW(HDC, LPLOGFONTW, FONTENUMPROCW, LPARAM, DWORD);
// #ifdef UNICODE
// #...
// #else
alias EnumFontFamiliesExA EnumFontFamiliesEx;
// #endif // !UNICODE
// #endif /* WINVER >= 0x0400 */

extern(Windows) export int EnumFontFamiliesA(HDC, LPCSTR, FONTENUMPROCA, LPARAM);
extern(Windows) export int EnumFontFamiliesW(HDC, LPCWSTR, FONTENUMPROCW, LPARAM);
// #ifdef UNICODE
// #...
// #else
alias EnumFontFamiliesA EnumFontFamilies;
// #endif // !UNICODE
extern(Windows) export int EnumFontsA(HDC, LPCSTR, FONTENUMPROCA, LPARAM);
extern(Windows) export int EnumFontsW(HDC, LPCWSTR, FONTENUMPROCW, LPARAM);
// #ifdef UNICODE
// #...
// #else
alias EnumFontsA EnumFonts;
// #endif // !UNICODE

// #ifdef STRICT
extern(Windows) export int EnumObjects(HDC, int, GOBJENUMPROC, LPARAM);
// #else
// ...
// #endif

extern(Windows) export BOOL EqualRgn(HRGN, HRGN);
extern(Windows) export int Escape(HDC, int, int, LPCSTR, LPVOID);
extern(Windows) export int ExtEscape(HDC, int, int, LPCSTR, int, LPSTR);
extern(Windows) export int ExcludeClipRect(HDC, int, int, int, int);
extern(Windows) export HRGN ExtCreateRegion(XFORM *, DWORD, RGNDATA *);
extern(Windows) export BOOL ExtFloodFill(HDC, int, int, COLORREF, UINT);
extern(Windows) export BOOL FillRgn(HDC, HRGN, HBRUSH);
extern(Windows) export BOOL FloodFill(HDC, int, int, COLORREF);
extern(Windows) export BOOL FrameRgn(HDC, HRGN, HBRUSH, int, int);
extern(Windows) export int GetROP2(HDC);
extern(Windows) export BOOL GetAspectRatioFilterEx(HDC, LPSIZE);
extern(Windows) export COLORREF GetBkColor(HDC);

// #if (_WIN32_WINNT >= 0x0500)
extern(Windows) export COLORREF GetDCBrushColor(HDC);
extern(Windows) export COLORREF GetDCPenColor(HDC);
// #endif

extern(Windows) export int GetBkMode(HDC);
extern(Windows) export LONG GetBitmapBits(HBITMAP, LONG, LPVOID);
extern(Windows) export BOOL GetBitmapDimensionEx(HBITMAP, LPSIZE);
extern(Windows) export UINT GetBoundsRect(HDC, LPRECT, UINT);

extern(Windows) export BOOL GetBrushOrgEx(HDC, LPPOINT);

extern(Windows) export BOOL GetCharWidthA(HDC, UINT, UINT, LPINT);
extern(Windows) export BOOL GetCharWidthW(HDC, UINT, UINT, LPINT);
// #ifdef UNICODE
// #...
// #else
alias GetCharWidthA GetCharWidth;
// #endif // !UNICODE
extern(Windows) export BOOL GetCharWidth32A(HDC, UINT, UINT, LPINT);
extern(Windows) export BOOL GetCharWidth32W(HDC, UINT, UINT, LPINT);
// #ifdef UNICODE
// #...
// #else
alias GetCharWidth32A GetCharWidth32;
// #endif // !UNICODE
extern(Windows) export BOOL GetCharWidthFloatA(HDC, UINT, UINT, PFLOAT);
extern(Windows) export BOOL GetCharWidthFloatW(HDC, UINT, UINT, PFLOAT);
// #ifdef UNICODE
// #...
// #else
alias GetCharWidthFloatA GetCharWidthFloat;
// #endif // !UNICODE
extern(Windows) export BOOL GetCharABCWidthsA(HDC, UINT, UINT, LPABC);
extern(Windows) export BOOL GetCharABCWidthsW(HDC, UINT, UINT, LPABC);
// #ifdef UNICODE
// #...
// #else
alias GetCharABCWidthsA GetCharABCWidths;
// #endif // !UNICODE
extern(Windows) export BOOL GetCharABCWidthsFloatA(HDC, UINT, UINT, LPABCFLOAT);
extern(Windows) export BOOL GetCharABCWidthsFloatW(HDC, UINT, UINT, LPABCFLOAT);
// #ifdef UNICODE
// #...
// #else
alias GetCharABCWidthsFloatA GetCharABCWidthsFloat;
// #endif // !UNICODE
extern(Windows) export int GetClipBox(HDC, LPRECT);
extern(Windows) export int GetClipRgn(HDC, HRGN);
extern(Windows) export int GetMetaRgn(HDC, HRGN);
extern(Windows) export HGDIOBJ GetCurrentObject(HDC, UINT);
extern(Windows) export BOOL GetCurrentPositionEx(HDC, LPPOINT);
extern(Windows) export int GetDeviceCaps(HDC, int);
extern(Windows) export int GetDIBits(HDC, HBITMAP, UINT, UINT, LPVOID, LPBITMAPINFO, UINT);
extern(Windows) export DWORD GetFontData(HDC, DWORD, DWORD, LPVOID, DWORD);
extern(Windows) export DWORD GetGlyphOutlineA(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, MAT2 *);
extern(Windows) export DWORD GetGlyphOutlineW(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, MAT2 *);
// #ifdef UNICODE
// #...
// #else
alias GetGlyphOutlineA GetGlyphOutline;
// #endif // !UNICODE
extern(Windows) export int GetGraphicsMode(HDC);
extern(Windows) export int GetMapMode(HDC);
extern(Windows) export UINT GetMetaFileBitsEx(HMETAFILE, UINT, LPVOID);
extern(Windows) export HMETAFILE GetMetaFileA(LPCSTR);
extern(Windows) export HMETAFILE GetMetaFileW(LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias GetMetaFileA GetMetaFile;
// #endif // !UNICODE
extern(Windows) export COLORREF GetNearestColor(HDC, COLORREF);
extern(Windows) export UINT GetNearestPaletteIndex(HPALETTE, COLORREF);
extern(Windows) export DWORD GetObjectType(HGDIOBJ h);

// #ifndef NOTEXTMETRIC

extern(Windows) export UINT GetOutlineTextMetricsA(HDC, UINT, LPOUTLINETEXTMETRICA);
extern(Windows) export UINT GetOutlineTextMetricsW(HDC, UINT, LPOUTLINETEXTMETRICW);
// #ifdef UNICODE
// #...
// #else
alias GetOutlineTextMetricsA GetOutlineTextMetrics;
// #endif // !UNICODE

// #endif /* NOTEXTMETRIC */

extern(Windows) export UINT GetPaletteEntries(HPALETTE, UINT, UINT, LPPALETTEENTRY);
extern(Windows) export COLORREF GetPixel(HDC, int, int);
extern(Windows) export int GetPixelFormat(HDC);
extern(Windows) export int GetPolyFillMode(HDC);
extern(Windows) export BOOL GetRasterizerCaps(LPRASTERIZER_STATUS, UINT);
extern(Windows) export int GetRandomRgn(HDC, HRGN, INT);
extern(Windows) export DWORD GetRegionData(HRGN, DWORD, LPRGNDATA);
extern(Windows) export int GetRgnBox(HRGN, LPRECT);
extern(Windows) export HGDIOBJ GetStockObject(int);
extern(Windows) export int GetStretchBltMode(HDC);
extern(Windows) export UINT GetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY);
extern(Windows) export UINT GetSystemPaletteUse(HDC);
extern(Windows) export int GetTextCharacterExtra(HDC);
extern(Windows) export UINT GetTextAlign(HDC);
extern(Windows) export COLORREF GetTextColor(HDC);

extern(Windows) export BOOL GetTextExtentPointA(
  HDC,
  LPCSTR,
  int,
  LPSIZE);
extern(Windows) export BOOL GetTextExtentPointW(
  HDC,
  LPCWSTR,
  int,
  LPSIZE);
// #ifdef UNICODE
// #...
// #else
alias GetTextExtentPointA GetTextExtentPoint;
// #endif // !UNICODE

extern(Windows) export BOOL GetTextExtentPoint32A(
  HDC,
  LPCSTR,
  int,
  LPSIZE);
extern(Windows) export BOOL GetTextExtentPoint32W(
  HDC,
  LPCWSTR,
  int,
  LPSIZE);
// #ifdef UNICODE
// #...
// #else
alias GetTextExtentPoint32A GetTextExtentPoint32;
// #endif // !UNICODE

extern(Windows) export BOOL GetTextExtentExPointA(
  HDC,
  LPCSTR,
  int,
  int,
  LPINT,
  LPINT,
  LPSIZE);
extern(Windows) export BOOL GetTextExtentExPointW(
  HDC,
  LPCWSTR,
  int,
  int,
  LPINT,
  LPINT,
  LPSIZE);
// #ifdef UNICODE
// #...
// #else
alias GetTextExtentExPointA GetTextExtentExPoint;
// #endif // !UNICODE
// #if(WINVER >= 0x0400)
extern(Windows) export int GetTextCharset(HDC hdc);
extern(Windows) export int GetTextCharsetInfo(HDC hdc, LPFONTSIGNATURE lpSig, DWORD dwFlags);
extern(Windows) export BOOL TranslateCharsetInfo(DWORD *lpSrc, LPCHARSETINFO lpCs, DWORD dwFlags);
extern(Windows) export DWORD GetFontLanguageInfo(HDC );
extern(Windows) export DWORD GetCharacterPlacementA(HDC, LPCSTR, int, int, LPGCP_RESULTSA, DWORD);
extern(Windows) export DWORD GetCharacterPlacementW(HDC, LPCWSTR, int, int, LPGCP_RESULTSW, DWORD);
// #ifdef UNICODE
// #...
// #else
alias GetCharacterPlacementA GetCharacterPlacement;
// #endif // !UNICODE
// #endif /* WINVER >= 0x0400 */

// #if (_WIN32_WINNT >= 0x0500)

struct tagWCRANGE {
  WCHAR wcLow;
  USHORT cGlyphs;
}
alias tagWCRANGE WCRANGE;
alias tagWCRANGE* PWCRANGE;
alias tagWCRANGE* LPWCRANGE;

struct tagGLYPHSET {
  DWORD cbThis;
  DWORD flAccel;
  DWORD cGlyphsSupported;
  DWORD cRanges;
  WCRANGE ranges[1];
}
alias tagGLYPHSET GLYPHSET;
alias tagGLYPHSET* PGLYPHSET;
alias tagGLYPHSET* LPGLYPHSET;

enum : uint { GS_8BIT_INDICES = 0x00000001 }

enum : uint { GGI_MARK_NONEXISTING_GLYPHS = 0X0001 }

extern(Windows) export DWORD GetFontUnicodeRanges(HDC, LPGLYPHSET);
extern(Windows) export DWORD GetGlyphIndicesA(HDC, LPCSTR, int, LPWORD, DWORD);
extern(Windows) export DWORD GetGlyphIndicesW(HDC, LPCWSTR, int, LPWORD, DWORD);
// #ifdef UNICODE
// #...
// #else
alias GetGlyphIndicesA GetGlyphIndices;
// #endif // !UNICODE
extern(Windows) export BOOL GetTextExtentPointI(HDC, LPWORD, int, LPSIZE);
extern(Windows) export BOOL GetTextExtentExPointI(HDC, LPWORD, int, int, LPINT, LPINT, LPSIZE);
extern(Windows) export BOOL GetCharWidthI(HDC, UINT, UINT, LPWORD, LPINT);
extern(Windows) export BOOL GetCharABCWidthsI(HDC, UINT, UINT, LPWORD, LPABC);

enum : uint { STAMP_DESIGNVECTOR = 0x8000000 + 'd' + ('v' << 8) }
enum : uint { STAMP_AXESLIST = 0x8000000 + 'a' + ('l' << 8) }
enum : uint { MM_MAX_NUMAXES = 16 }

struct tagDESIGNVECTOR {
  DWORD dvReserved;
  DWORD dvNumAxes;
  LONG dvValues[MM_MAX_NUMAXES];
}
alias tagDESIGNVECTOR DESIGNVECTOR;
alias tagDESIGNVECTOR* PDESIGNVECTOR;
alias tagDESIGNVECTOR* LPDESIGNVECTOR;

extern(Windows) export int AddFontResourceExA(LPCSTR, DWORD, PVOID);
extern(Windows) export int AddFontResourceExW(LPCWSTR, DWORD, PVOID);
// #ifdef UNICODE
// #...
// #else
alias AddFontResourceExA AddFontResourceEx;
// #endif // !UNICODE
extern(Windows) export BOOL RemoveFontResourceExA(LPCSTR, DWORD, PVOID);
extern(Windows) export BOOL RemoveFontResourceExW(LPCWSTR, DWORD, PVOID);
// #ifdef UNICODE
// #...
// #else
alias RemoveFontResourceExA RemoveFontResourceEx;
// #endif // !UNICODE
extern(Windows) export HANDLE AddFontMemResourceEx(PVOID, DWORD, PVOID , DWORD*);
extern(Windows) export BOOL RemoveFontMemResourceEx(HANDLE);
enum : uint { FR_PRIVATE = 0x10 }
enum : uint { FR_NOT_ENUM = 0x20 }

enum : uint { MM_MAX_AXES_NAMELEN = 16 }

struct tagAXISINFOA {
  LONG axMinValue;
  LONG axMaxValue;
  BYTE axAxisName[MM_MAX_AXES_NAMELEN];
}
alias tagAXISINFOA AXISINFOA;
alias tagAXISINFOA* PAXISINFOA;
alias tagAXISINFOA* LPAXISINFOA;

struct tagAXISINFOW {
  LONG axMinValue;
  LONG axMaxValue;
  WCHAR axAxisName[MM_MAX_AXES_NAMELEN];
}
alias tagAXISINFOW AXISINFOW;
alias tagAXISINFOW* PAXISINFOW;
alias tagAXISINFOW* LPAXISINFOW;

// #ifdef UNICODE
// ...
// #else
alias AXISINFOA AXISINFO;
alias PAXISINFOA PAXISINFO;
alias LPAXISINFOA LPAXISINFO;
// #endif // UNICODE

struct tagAXESLISTA {
  DWORD axlReserved;
  DWORD axlNumAxes;
  AXISINFOA axlAxisInfo[MM_MAX_NUMAXES];
}
alias tagAXESLISTA AXESLISTA;
alias tagAXESLISTA* PAXESLISTA;
alias tagAXESLISTA* LPAXESLISTA;

struct tagAXESLISTW {
  DWORD axlReserved;
  DWORD axlNumAxes;
  AXISINFOW axlAxisInfo[MM_MAX_NUMAXES];
}
alias tagAXESLISTW AXESLISTW;
alias tagAXESLISTW* PAXESLISTW;
alias tagAXESLISTW* LPAXESLISTW;

// #ifdef UNICODE
// ...
// #else
alias AXESLISTA AXESLIST;
alias PAXESLISTA PAXESLIST;
alias LPAXESLISTA LPAXESLIST;
// #endif // UNICODE

struct tagENUMLOGFONTEXDVA {
  ENUMLOGFONTEXA elfEnumLogfontEx;
  DESIGNVECTOR elfDesignVector;
}
alias tagENUMLOGFONTEXDVA ENUMLOGFONTEXDVA;
alias tagENUMLOGFONTEXDVA* PENUMLOGFONTEXDVA;
alias tagENUMLOGFONTEXDVA* LPENUMLOGFONTEXDVA;

struct tagENUMLOGFONTEXDVW {
  ENUMLOGFONTEXW elfEnumLogfontEx;
  DESIGNVECTOR elfDesignVector;
}
alias tagENUMLOGFONTEXDVW ENUMLOGFONTEXDVW;
alias tagENUMLOGFONTEXDVW* PENUMLOGFONTEXDVW;
alias tagENUMLOGFONTEXDVW* LPENUMLOGFONTEXDVW;

// #ifdef UNICODE
// ...
// #else
alias ENUMLOGFONTEXDVA ENUMLOGFONTEXDV;
alias PENUMLOGFONTEXDVA PENUMLOGFONTEXDV;
alias LPENUMLOGFONTEXDVA LPENUMLOGFONTEXDV;
// #endif // UNICODE

extern(Windows) export HFONT CreateFontIndirectExA(ENUMLOGFONTEXDVA *);
extern(Windows) export HFONT CreateFontIndirectExW(ENUMLOGFONTEXDVW *);
// #ifdef UNICODE
// #...
// #else
alias CreateFontIndirectExA CreateFontIndirectEx;
// #endif // !UNICODE

// #ifndef NOTEXTMETRIC
struct tagENUMTEXTMETRICA {
  NEWTEXTMETRICEXA etmNewTextMetricEx;
  AXESLISTA etmAxesList;
}
alias tagENUMTEXTMETRICA ENUMTEXTMETRICA;
alias tagENUMTEXTMETRICA* PENUMTEXTMETRICA;
alias tagENUMTEXTMETRICA* LPENUMTEXTMETRICA;

struct tagENUMTEXTMETRICW {
  NEWTEXTMETRICEXW etmNewTextMetricEx;
  AXESLISTW etmAxesList;
}
alias tagENUMTEXTMETRICW ENUMTEXTMETRICW;
alias tagENUMTEXTMETRICW* PENUMTEXTMETRICW;
alias tagENUMTEXTMETRICW* LPENUMTEXTMETRICW;

// #ifdef UNICODE
// ...
// #else
alias ENUMTEXTMETRICA ENUMTEXTMETRIC;
alias PENUMTEXTMETRICA PENUMTEXTMETRIC;
alias LPENUMTEXTMETRICA LPENUMTEXTMETRIC;
// #endif // UNICODE
// #endif /* NOTEXTMETRIC */

// #endif // (_WIN32_WINNT >= 0x0500)

extern(Windows) export BOOL GetViewportExtEx(HDC, LPSIZE);
extern(Windows) export BOOL GetViewportOrgEx(HDC, LPPOINT);
extern(Windows) export BOOL GetWindowExtEx(HDC, LPSIZE);
extern(Windows) export BOOL GetWindowOrgEx(HDC, LPPOINT);

extern(Windows) export int IntersectClipRect(HDC, int, int, int, int);
extern(Windows) export BOOL InvertRgn(HDC, HRGN);
extern(Windows) export BOOL LineDDA(int, int, int, int, LINEDDAPROC, LPARAM);
extern(Windows) export BOOL LineTo(HDC, int, int);
extern(Windows) export BOOL MaskBlt(HDC, int, int, int, int,
  HDC, int, int, HBITMAP, int, int, DWORD);
extern(Windows) export BOOL PlgBlt(HDC, POINT *, HDC, int, int, int,
  int, HBITMAP, int, int);

extern(Windows) export int OffsetClipRgn(HDC, int, int);
extern(Windows) export int OffsetRgn(HRGN, int, int);
extern(Windows) export BOOL PatBlt(HDC, int, int, int, int, DWORD);
extern(Windows) export BOOL Pie(HDC, int, int, int, int, int, int, int, int);
extern(Windows) export BOOL PlayMetaFile(HDC, HMETAFILE);
extern(Windows) export BOOL PaintRgn(HDC, HRGN);
extern(Windows) export BOOL PolyPolygon(HDC, POINT *, INT *, int);
extern(Windows) export BOOL PtInRegion(HRGN, int, int);
extern(Windows) export BOOL PtVisible(HDC, int, int);
extern(Windows) export BOOL RectInRegion(HRGN, RECT *);
extern(Windows) export BOOL RectVisible(HDC, RECT *);
extern(Windows) export BOOL Rectangle(HDC, int, int, int, int);
extern(Windows) export BOOL RestoreDC(HDC, int);
extern(Windows) export HDC ResetDCA(HDC, DEVMODEA *);
extern(Windows) export HDC ResetDCW(HDC, DEVMODEW *);
// #ifdef UNICODE
// #...
// #else
alias ResetDCA ResetDC;
// #endif // !UNICODE
extern(Windows) export UINT RealizePalette(HDC);
extern(Windows) export BOOL RemoveFontResourceA(LPCSTR);
extern(Windows) export BOOL RemoveFontResourceW(LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias RemoveFontResourceA RemoveFontResource;
// #endif // !UNICODE
extern(Windows) export BOOL RoundRect(HDC, int, int, int, int, int, int);
extern(Windows) export BOOL ResizePalette(HPALETTE, UINT);

extern(Windows) export int SaveDC(HDC);
extern(Windows) export int SelectClipRgn(HDC, HRGN);
extern(Windows) export int ExtSelectClipRgn(HDC, HRGN, int);
extern(Windows) export int SetMetaRgn(HDC);
extern(Windows) export HGDIOBJ SelectObject(HDC, HGDIOBJ);
extern(Windows) export HPALETTE SelectPalette(HDC, HPALETTE, BOOL);
extern(Windows) export COLORREF SetBkColor(HDC, COLORREF);

// #if (_WIN32_WINNT >= 0x0500)
extern(Windows) export COLORREF SetDCBrushColor(HDC, COLORREF);
extern(Windows) export COLORREF SetDCPenColor(HDC, COLORREF);
// #endif

extern(Windows) export int SetBkMode(HDC, int);
extern(Windows) export LONG SetBitmapBits(HBITMAP, DWORD, VOID *);

extern(Windows) export UINT SetBoundsRect(HDC, RECT *, UINT);
extern(Windows) export int SetDIBits(HDC, HBITMAP, UINT, UINT, VOID *, BITMAPINFO *, UINT);
extern(Windows) export int SetDIBitsToDevice(HDC, int, int, DWORD, DWORD, int,
  int, UINT, UINT, VOID *, BITMAPINFO *, UINT);
extern(Windows) export DWORD SetMapperFlags(HDC, DWORD);
extern(Windows) export int SetGraphicsMode(HDC hdc, int iMode);
extern(Windows) export int SetMapMode(HDC, int);

// #if(WINVER >= 0x0500)
extern(Windows) export DWORD SetLayout(HDC, DWORD);
extern(Windows) export DWORD GetLayout(HDC);
// #endif /* WINVER >= 0x0500 */

extern(Windows) export HMETAFILE SetMetaFileBitsEx(UINT, BYTE *);
extern(Windows) export UINT SetPaletteEntries(HPALETTE, UINT, UINT, PALETTEENTRY *);
extern(Windows) export COLORREF SetPixel(HDC, int, int, COLORREF);
extern(Windows) export BOOL SetPixelV(HDC, int, int, COLORREF);
extern(Windows) export BOOL SetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *);
extern(Windows) export int SetPolyFillMode(HDC, int);
extern(Windows) export BOOL StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
extern(Windows) export BOOL SetRectRgn(HRGN, int, int, int, int);
extern(Windows) export int StretchDIBits(HDC, int, int, int, int, int, int, int, int, 
  VOID *, BITMAPINFO *, UINT, DWORD);
extern(Windows) export int SetROP2(HDC, int);
extern(Windows) export int SetStretchBltMode(HDC, int);
extern(Windows) export UINT SetSystemPaletteUse(HDC, UINT);
extern(Windows) export int SetTextCharacterExtra(HDC, int);
extern(Windows) export COLORREF SetTextColor(HDC, COLORREF);
extern(Windows) export UINT SetTextAlign(HDC, UINT);
extern(Windows) export BOOL SetTextJustification(HDC, int, int);
extern(Windows) export BOOL UpdateColors(HDC);

// #if (WINVER >= 0x0400)

alias USHORT COLOR16;

struct _TRIVERTEX {
  LONG x;
  LONG y;
  COLOR16 Red;
  COLOR16 Green;
  COLOR16 Blue;
  COLOR16 Alpha;
}
alias _TRIVERTEX TRIVERTEX;
alias _TRIVERTEX* PTRIVERTEX;
alias _TRIVERTEX* LPTRIVERTEX;

struct _GRADIENT_TRIANGLE {
  ULONG Vertex1;
  ULONG Vertex2;
  ULONG Vertex3;
}
alias _GRADIENT_TRIANGLE GRADIENT_TRIANGLE;
alias _GRADIENT_TRIANGLE* PGRADIENT_TRIANGLE;
alias _GRADIENT_TRIANGLE* LPGRADIENT_TRIANGLE;

struct _GRADIENT_RECT {
  ULONG UpperLeft;
  ULONG LowerRight;
}
alias _GRADIENT_RECT GRADIENT_RECT;
alias _GRADIENT_RECT* PGRADIENT_RECT;
alias _GRADIENT_RECT* LPGRADIENT_RECT;

struct _BLENDFUNCTION {
  BYTE BlendOp;
  BYTE BlendFlags;
  BYTE SourceConstantAlpha;
  BYTE AlphaFormat;
}
alias _BLENDFUNCTION BLENDFUNCTION;
alias _BLENDFUNCTION* PBLENDFUNCTION;

enum : uint { AC_SRC_OVER = 0x00 }

enum : uint { AC_SRC_ALPHA = 0x01 }

extern(Windows) export BOOL AlphaBlend(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION);

extern(Windows) export BOOL TransparentBlt(HDC, int, int, int, int, HDC, int, int, int, int, UINT);

enum : uint { GRADIENT_FILL_RECT_H = 0x00000000 }
enum : uint { GRADIENT_FILL_RECT_V = 0x00000001 }
enum : uint { GRADIENT_FILL_TRIANGLE = 0x00000002 }
enum : uint { GRADIENT_FILL_OP_FLAG = 0x000000ff }

extern(Windows) export BOOL GradientFill(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG);

// #endif

// #ifndef NOMETAFILE

extern(Windows) export BOOL PlayMetaFileRecord(HDC, LPHANDLETABLE, LPMETARECORD, UINT);
extern(Windows) alias int function(  HDC,  HANDLETABLE *,  METARECORD *,  int,  LPARAM) MFENUMPROC;
extern(Windows) export BOOL EnumMetaFile(HDC, HMETAFILE, MFENUMPROC, LPARAM);

extern(Windows) alias int function(HDC, HANDLETABLE *,  ENHMETARECORD *, int, LPARAM) ENHMFENUMPROC;

extern(Windows) export HENHMETAFILE CloseEnhMetaFile(HDC);
extern(Windows) export HENHMETAFILE CopyEnhMetaFileA(HENHMETAFILE, LPCSTR);
extern(Windows) export HENHMETAFILE CopyEnhMetaFileW(HENHMETAFILE, LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias CopyEnhMetaFileA CopyEnhMetaFile;
// #endif // !UNICODE
extern(Windows) export HDC CreateEnhMetaFileA(HDC, LPCSTR, RECT *, LPCSTR);
extern(Windows) export HDC CreateEnhMetaFileW(HDC, LPCWSTR, RECT *, LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias CreateEnhMetaFileA CreateEnhMetaFile;
// #endif // !UNICODE
extern(Windows) export BOOL DeleteEnhMetaFile(HENHMETAFILE);
extern(Windows) export BOOL EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMFENUMPROC,
  LPVOID, RECT *);
extern(Windows) export HENHMETAFILE GetEnhMetaFileA(LPCSTR);
extern(Windows) export HENHMETAFILE GetEnhMetaFileW(LPCWSTR);
// #ifdef UNICODE
// #...
// #else
alias GetEnhMetaFileA GetEnhMetaFile;
// #endif // !UNICODE
extern(Windows) export UINT GetEnhMetaFileBits(HENHMETAFILE, UINT, LPBYTE);
extern(Windows) export UINT GetEnhMetaFileDescriptionA(HENHMETAFILE, UINT, LPSTR );
extern(Windows) export UINT GetEnhMetaFileDescriptionW(HENHMETAFILE, UINT, LPWSTR );
// #ifdef UNICODE
// #...
// #else
alias GetEnhMetaFileDescriptionA GetEnhMetaFileDescription;
// #endif // !UNICODE
extern(Windows) export UINT GetEnhMetaFileHeader(HENHMETAFILE, UINT, LPENHMETAHEADER );
extern(Windows) export UINT GetEnhMetaFilePaletteEntries(HENHMETAFILE, UINT, LPPALETTEENTRY );
extern(Windows) export UINT GetEnhMetaFilePixelFormat(HENHMETAFILE, UINT,
  PIXELFORMATDESCRIPTOR *);
extern(Windows) export UINT GetWinMetaFileBits(HENHMETAFILE, UINT, LPBYTE, INT, HDC);
extern(Windows) export BOOL PlayEnhMetaFile(HDC, HENHMETAFILE, RECT *);
extern(Windows) export BOOL PlayEnhMetaFileRecord(HDC, LPHANDLETABLE, ENHMETARECORD *, UINT);
extern(Windows) export HENHMETAFILE SetEnhMetaFileBits(UINT, BYTE *);
extern(Windows) export HENHMETAFILE SetWinMetaFileBits(UINT, BYTE *, HDC, METAFILEPICT *);
extern(Windows) export BOOL GdiComment(HDC, UINT, BYTE *);

// #endif  /* NOMETAFILE */

// #ifndef NOTEXTMETRIC

extern(Windows) export BOOL GetTextMetricsA(HDC, LPTEXTMETRICA);
extern(Windows) export BOOL GetTextMetricsW(HDC, LPTEXTMETRICW);
// #ifdef UNICODE
// #...
// #else
alias GetTextMetricsA GetTextMetrics;
// #endif // !UNICODE

// #endif

struct tagDIBSECTION {
  BITMAP dsBm;
  BITMAPINFOHEADER dsBmih;
  DWORD dsBitfields[3];
  HANDLE dshSection;
  DWORD dsOffset;
}
alias tagDIBSECTION DIBSECTION;
alias tagDIBSECTION* LPDIBSECTION;
alias tagDIBSECTION* PDIBSECTION;

extern(Windows) export BOOL AngleArc(HDC, int, int, DWORD, FLOAT, FLOAT);
extern(Windows) export BOOL PolyPolyline(HDC, POINT *, DWORD *, DWORD);
extern(Windows) export BOOL GetWorldTransform(HDC, LPXFORM);
extern(Windows) export BOOL SetWorldTransform(HDC, XFORM *);
extern(Windows) export BOOL ModifyWorldTransform(HDC, XFORM *, DWORD);
extern(Windows) export BOOL CombineTransform(LPXFORM, XFORM *, XFORM *);
extern(Windows) export HBITMAP CreateDIBSection(HDC, BITMAPINFO *, UINT, VOID **, HANDLE, DWORD);
extern(Windows) export UINT GetDIBColorTable(HDC, UINT, UINT, RGBQUAD *);
extern(Windows) export UINT SetDIBColorTable(HDC, UINT, UINT, RGBQUAD *);

enum : uint { CA_NEGATIVE = 0x0001 }
enum : uint { CA_LOG_FILTER = 0x0002 }

enum : uint { ILLUMINANT_DEVICE_DEFAULT = 0 }
enum : uint { ILLUMINANT_A = 1 }
enum : uint { ILLUMINANT_B = 2 }
enum : uint { ILLUMINANT_C = 3 }
enum : uint { ILLUMINANT_D50 = 4 }
enum : uint { ILLUMINANT_D55 = 5 }
enum : uint { ILLUMINANT_D65 = 6 }
enum : uint { ILLUMINANT_D75 = 7 }
enum : uint { ILLUMINANT_F2 = 8 }
alias ILLUMINANT_F2 ILLUMINANT_MAX_INDEX;

alias ILLUMINANT_A ILLUMINANT_TUNGSTEN;
alias ILLUMINANT_C ILLUMINANT_DAYLIGHT;
alias ILLUMINANT_F2 ILLUMINANT_FLUORESCENT;
alias ILLUMINANT_C ILLUMINANT_NTSC;

enum : WORD { RGB_GAMMA_MIN = 02500 }
enum : WORD { RGB_GAMMA_MAX = 65000 }

enum : WORD { REFERENCE_WHITE_MIN = 6000 }
enum : WORD { REFERENCE_WHITE_MAX = 10000 }
enum : WORD { REFERENCE_BLACK_MIN = 0 }
enum : WORD { REFERENCE_BLACK_MAX = 4000 }

enum : SHORT { COLOR_ADJ_MIN = -100 }
enum : SHORT { COLOR_ADJ_MAX = 100 }

struct tagCOLORADJUSTMENT {
  WORD caSize;
  WORD caFlags;
  WORD caIlluminantIndex;
  WORD caRedGamma;
  WORD caGreenGamma;
  WORD caBlueGamma;
  WORD caReferenceBlack;
  WORD caReferenceWhite;
  SHORT caContrast;
  SHORT caBrightness;
  SHORT caColorfulness;
  SHORT caRedGreenTint;
}
alias tagCOLORADJUSTMENT COLORADJUSTMENT;
alias tagCOLORADJUSTMENT* PCOLORADJUSTMENT;
alias tagCOLORADJUSTMENT* LPCOLORADJUSTMENT;

extern(Windows) export BOOL SetColorAdjustment(HDC, COLORADJUSTMENT *);
extern(Windows) export BOOL GetColorAdjustment(HDC, LPCOLORADJUSTMENT);
extern(Windows) export HPALETTE CreateHalftonePalette(HDC);

// #ifdef STRICT
extern(Windows) alias BOOL function(  HDC,  int) ABORTPROC;
// #else
// ...
// #endif

struct _DOCINFOA {
  int cbSize;
  LPCSTR lpszDocName;
  LPCSTR lpszOutput;
// #if (WINVER >= 0x0400)
  LPCSTR lpszDatatype;
  DWORD fwType;
// #endif /* WINVER */
}
alias _DOCINFOA DOCINFOA;
alias _DOCINFOA* LPDOCINFOA;

struct _DOCINFOW {
  int cbSize;
  LPCWSTR lpszDocName;
  LPCWSTR lpszOutput;
// #if (WINVER >= 0x0400)
  LPCWSTR lpszDatatype;
  DWORD fwType;
// #endif /* WINVER */
}
alias _DOCINFOW DOCINFOW;
alias _DOCINFOW* LPDOCINFOW;

// #ifdef UNICODE
// ...
// #else
alias DOCINFOA DOCINFO;
alias LPDOCINFOA LPDOCINFO;
// #endif // UNICODE

// #if(WINVER >= 0x0400)
enum : uint { DI_APPBANDING = 0x00000001 }
enum : uint { DI_ROPS_READ_DESTINATION = 0x00000002 }
// #endif /* WINVER >= 0x0400 */

extern(Windows) export int StartDocA(HDC, DOCINFOA *);
extern(Windows) export int StartDocW(HDC, DOCINFOW *);
// #ifdef UNICODE
// #...
// #else
alias StartDocA StartDoc;
// #endif // !UNICODE
extern(Windows) export int EndDoc(HDC);
extern(Windows) export int StartPage(HDC);
extern(Windows) export int EndPage(HDC);
extern(Windows) export int AbortDoc(HDC);
extern(Windows) export int SetAbortProc(HDC, ABORTPROC);

extern(Windows) export BOOL AbortPath(HDC);
extern(Windows) export BOOL ArcTo(HDC, int, int, int, int, int, int, int, int);
extern(Windows) export BOOL BeginPath(HDC);
extern(Windows) export BOOL CloseFigure(HDC);
extern(Windows) export BOOL EndPath(HDC);
extern(Windows) export BOOL FillPath(HDC);
extern(Windows) export BOOL FlattenPath(HDC);
extern(Windows) export int GetPath(HDC, LPPOINT, LPBYTE, int);
extern(Windows) export HRGN PathToRegion(HDC);
extern(Windows) export BOOL PolyDraw(HDC, POINT *, BYTE *, int);
extern(Windows) export BOOL SelectClipPath(HDC, int);
extern(Windows) export int SetArcDirection(HDC, int);
extern(Windows) export BOOL SetMiterLimit(HDC, FLOAT, PFLOAT);
extern(Windows) export BOOL StrokeAndFillPath(HDC);
extern(Windows) export BOOL StrokePath(HDC);
extern(Windows) export BOOL WidenPath(HDC);
extern(Windows) export HPEN ExtCreatePen(DWORD, DWORD, LOGBRUSH *, DWORD, DWORD *);
extern(Windows) export BOOL GetMiterLimit(HDC, PFLOAT);
extern(Windows) export int GetArcDirection(HDC);

extern(Windows) export int GetObjectA(HGDIOBJ, int, LPVOID);
extern(Windows) export int GetObjectW(HGDIOBJ, int, LPVOID);
// #ifdef UNICODE
// #...
// #else
alias GetObjectA GetObject;
// #endif // !UNICODE
extern(Windows) export BOOL MoveToEx(HDC, int, int, LPPOINT);
extern(Windows) export BOOL TextOutA(HDC, int, int, LPCSTR, int);
extern(Windows) export BOOL TextOutW(HDC, int, int, LPCWSTR, int);
// #ifdef UNICODE
// #...
// #else
alias TextOutA TextOut;
// #endif // !UNICODE
extern(Windows) export BOOL ExtTextOutA(HDC, int, int, UINT, RECT *, LPCSTR, UINT, INT *);
extern(Windows) export BOOL ExtTextOutW(HDC, int, int, UINT, RECT *, LPCWSTR, UINT, INT *);
// #ifdef UNICODE
// #...
// #else
alias ExtTextOutA ExtTextOut;
// #endif // !UNICODE
extern(Windows) export BOOL PolyTextOutA(HDC, POLYTEXTA *, int);
extern(Windows) export BOOL PolyTextOutW(HDC, POLYTEXTW *, int);
// #ifdef UNICODE
// #...
// #else
alias PolyTextOutA PolyTextOut;
// #endif // !UNICODE

extern(Windows) export HRGN CreatePolygonRgn(POINT *, int, int);
extern(Windows) export BOOL DPtoLP(HDC, LPPOINT, int);
extern(Windows) export BOOL LPtoDP(HDC, LPPOINT, int);
extern(Windows) export BOOL Polygon(HDC, POINT *, int);
extern(Windows) export BOOL Polyline(HDC, POINT *, int);

extern(Windows) export BOOL PolyBezier(HDC, POINT *, DWORD);
extern(Windows) export BOOL PolyBezierTo(HDC, POINT *, DWORD);
extern(Windows) export BOOL PolylineTo(HDC, POINT *, DWORD);

extern(Windows) export BOOL SetViewportExtEx(HDC, int, int, LPSIZE);
extern(Windows) export BOOL SetViewportOrgEx(HDC, int, int, LPPOINT);
extern(Windows) export BOOL SetWindowExtEx(HDC, int, int, LPSIZE);
extern(Windows) export BOOL SetWindowOrgEx(HDC, int, int, LPPOINT);

extern(Windows) export BOOL OffsetViewportOrgEx(HDC, int, int, LPPOINT);
extern(Windows) export BOOL OffsetWindowOrgEx(HDC, int, int, LPPOINT);
extern(Windows) export BOOL ScaleViewportExtEx(HDC, int, int, int, int, LPSIZE);
extern(Windows) export BOOL ScaleWindowExtEx(HDC, int, int, int, int, LPSIZE);
extern(Windows) export BOOL SetBitmapDimensionEx(HBITMAP, int, int, LPSIZE);
extern(Windows) export BOOL SetBrushOrgEx(HDC, int, int, LPPOINT);

extern(Windows) export int GetTextFaceA(HDC, int, LPSTR);
extern(Windows) export int GetTextFaceW(HDC, int, LPWSTR);
// #ifdef UNICODE
// #...
// #else
alias GetTextFaceA GetTextFace;
// #endif // !UNICODE

enum : uint { FONTMAPPER_MAX = 10 }

struct tagKERNINGPAIR {
  WORD wFirst;
  WORD wSecond;
  int iKernAmount;
}
alias tagKERNINGPAIR KERNINGPAIR;
alias tagKERNINGPAIR* LPKERNINGPAIR;

extern(Windows) export DWORD GetKerningPairsA(HDC, DWORD, LPKERNINGPAIR);
extern(Windows) export DWORD GetKerningPairsW(HDC, DWORD, LPKERNINGPAIR);
// #ifdef UNICODE
// #...
// #else
alias GetKerningPairsA GetKerningPairs;
// #endif // !UNICODE

extern(Windows) export BOOL GetDCOrgEx(HDC, LPPOINT);
extern(Windows) export BOOL FixBrushOrgEx(HDC, int, int, LPPOINT);
extern(Windows) export BOOL UnrealizeObject(HGDIOBJ);

extern(Windows) export BOOL GdiFlush();
extern(Windows) export DWORD GdiSetBatchLimit(DWORD);
extern(Windows) export DWORD GdiGetBatchLimit();

// #if(WINVER >= 0x0400)

enum : uint { ICM_OFF = 1 }
enum : uint { ICM_ON = 2 }
enum : uint { ICM_QUERY = 3 }
enum : uint { ICM_DONE_OUTSIDEDC = 4 }

extern(Windows) alias int function(LPSTR, LPARAM) ICMENUMPROCA;
extern(Windows) alias int function(LPWSTR, LPARAM) ICMENUMPROCW;
// #ifdef UNICODE
// #...
// #else
alias ICMENUMPROCA ICMENUMPROC;
// #endif // !UNICODE

extern(Windows) export int SetICMMode(HDC, int);
extern(Windows) export BOOL CheckColorsInGamut(HDC, LPVOID, LPVOID, DWORD);
extern(Windows) export HCOLORSPACE GetColorSpace(HDC);
extern(Windows) export BOOL GetLogColorSpaceA(HCOLORSPACE, LPLOGCOLORSPACEA, DWORD);
extern(Windows) export BOOL GetLogColorSpaceW(HCOLORSPACE, LPLOGCOLORSPACEW, DWORD);
// #ifdef UNICODE
// #...
// #else
alias GetLogColorSpaceA GetLogColorSpace;
// #endif // !UNICODE
extern(Windows) export HCOLORSPACE CreateColorSpaceA(LPLOGCOLORSPACEA);
extern(Windows) export HCOLORSPACE CreateColorSpaceW(LPLOGCOLORSPACEW);
// #ifdef UNICODE
// #...
// #else
alias CreateColorSpaceA CreateColorSpace;
// #endif // !UNICODE
extern(Windows) export HCOLORSPACE SetColorSpace(HDC, HCOLORSPACE);
extern(Windows) export BOOL DeleteColorSpace(HCOLORSPACE);
extern(Windows) export BOOL GetICMProfileA(HDC, LPDWORD, LPSTR);
extern(Windows) export BOOL GetICMProfileW(HDC, LPDWORD, LPWSTR);
// #ifdef UNICODE
// #...
// #else
alias GetICMProfileA GetICMProfile;
// #endif // !UNICODE
extern(Windows) export BOOL SetICMProfileA(HDC, LPSTR);
extern(Windows) export BOOL SetICMProfileW(HDC, LPWSTR);
// #ifdef UNICODE
// #...
// #else
alias SetICMProfileA SetICMProfile;
// #endif // !UNICODE
extern(Windows) export BOOL GetDeviceGammaRamp(HDC, LPVOID);
extern(Windows) export BOOL SetDeviceGammaRamp(HDC, LPVOID);
extern(Windows) export BOOL ColorMatchToTarget(HDC, HDC, DWORD);
extern(Windows) export int EnumICMProfilesA(HDC, ICMENUMPROCA, LPARAM);
extern(Windows) export int EnumICMProfilesW(HDC, ICMENUMPROCW, LPARAM);
// #ifdef UNICODE
// #...
// #else
alias EnumICMProfilesA EnumICMProfiles;
// #endif // !UNICODE
extern(Windows) export BOOL UpdateICMRegKeyA(DWORD, LPSTR, LPSTR, UINT);
extern(Windows) export BOOL UpdateICMRegKeyW(DWORD, LPWSTR, LPWSTR, UINT);
// #ifdef UNICODE
// #...
// #else
alias UpdateICMRegKeyA UpdateICMRegKey;
// #endif // !UNICODE
// #endif /* WINVER >= 0x0400 */

// #if (WINVER >= 0x0500)
extern(Windows) export BOOL ColorCorrectPalette(HDC, HPALETTE, DWORD, DWORD);
// #endif

// #ifndef NOMETAFILE

// #ifndef _MAC
enum : uint { ENHMETA_SIGNATURE = 0x464D4520 }
// #else
// #...
// #endif

enum : uint { ENHMETA_STOCK_OBJECT = 0x80000000 }

enum : uint { EMR_HEADER = 1 }
enum : uint { EMR_POLYBEZIER = 2 }
enum : uint { EMR_POLYGON = 3 }
enum : uint { EMR_POLYLINE = 4 }
enum : uint { EMR_POLYBEZIERTO = 5 }
enum : uint { EMR_POLYLINETO = 6 }
enum : uint { EMR_POLYPOLYLINE = 7 }
enum : uint { EMR_POLYPOLYGON = 8 }
enum : uint { EMR_SETWINDOWEXTEX = 9 }
enum : uint { EMR_SETWINDOWORGEX = 10 }
enum : uint { EMR_SETVIEWPORTEXTEX = 11 }
enum : uint { EMR_SETVIEWPORTORGEX = 12 }
enum : uint { EMR_SETBRUSHORGEX = 13 }
enum : uint { EMR_EOF = 14 }
enum : uint { EMR_SETPIXELV = 15 }
enum : uint { EMR_SETMAPPERFLAGS = 16 }
enum : uint { EMR_SETMAPMODE = 17 }
enum : uint { EMR_SETBKMODE = 18 }
enum : uint { EMR_SETPOLYFILLMODE = 19 }
enum : uint { EMR_SETROP2 = 20 }
enum : uint { EMR_SETSTRETCHBLTMODE = 21 }
enum : uint { EMR_SETTEXTALIGN = 22 }
enum : uint { EMR_SETCOLORADJUSTMENT = 23 }
enum : uint { EMR_SETTEXTCOLOR = 24 }
enum : uint { EMR_SETBKCOLOR = 25 }
enum : uint { EMR_OFFSETCLIPRGN = 26 }
enum : uint { EMR_MOVETOEX = 27 }
enum : uint { EMR_SETMETARGN = 28 }
enum : uint { EMR_EXCLUDECLIPRECT = 29 }
enum : uint { EMR_INTERSECTCLIPRECT = 30 }
enum : uint { EMR_SCALEVIEWPORTEXTEX = 31 }
enum : uint { EMR_SCALEWINDOWEXTEX = 32 }
enum : uint { EMR_SAVEDC = 33 }
enum : uint { EMR_RESTOREDC = 34 }
enum : uint { EMR_SETWORLDTRANSFORM = 35 }
enum : uint { EMR_MODIFYWORLDTRANSFORM = 36 }
enum : uint { EMR_SELECTOBJECT = 37 }
enum : uint { EMR_CREATEPEN = 38 }
enum : uint { EMR_CREATEBRUSHINDIRECT = 39 }
enum : uint { EMR_DELETEOBJECT = 40 }
enum : uint { EMR_ANGLEARC = 41 }
enum : uint { EMR_ELLIPSE = 42 }
enum : uint { EMR_RECTANGLE = 43 }
enum : uint { EMR_ROUNDRECT = 44 }
enum : uint { EMR_ARC = 45 }
enum : uint { EMR_CHORD = 46 }
enum : uint { EMR_PIE = 47 }
enum : uint { EMR_SELECTPALETTE = 48 }
enum : uint { EMR_CREATEPALETTE = 49 }
enum : uint { EMR_SETPALETTEENTRIES = 50 }
enum : uint { EMR_RESIZEPALETTE = 51 }
enum : uint { EMR_REALIZEPALETTE = 52 }
enum : uint { EMR_EXTFLOODFILL = 53 }
enum : uint { EMR_LINETO = 54 }
enum : uint { EMR_ARCTO = 55 }
enum : uint { EMR_POLYDRAW = 56 }
enum : uint { EMR_SETARCDIRECTION = 57 }
enum : uint { EMR_SETMITERLIMIT = 58 }
enum : uint { EMR_BEGINPATH = 59 }
enum : uint { EMR_ENDPATH = 60 }
enum : uint { EMR_CLOSEFIGURE = 61 }
enum : uint { EMR_FILLPATH = 62 }
enum : uint { EMR_STROKEANDFILLPATH = 63 }
enum : uint { EMR_STROKEPATH = 64 }
enum : uint { EMR_FLATTENPATH = 65 }
enum : uint { EMR_WIDENPATH = 66 }
enum : uint { EMR_SELECTCLIPPATH = 67 }
enum : uint { EMR_ABORTPATH = 68 }

enum : uint { EMR_GDICOMMENT = 70 }
enum : uint { EMR_FILLRGN = 71 }
enum : uint { EMR_FRAMERGN = 72 }
enum : uint { EMR_INVERTRGN = 73 }
enum : uint { EMR_PAINTRGN = 74 }
enum : uint { EMR_EXTSELECTCLIPRGN = 75 }
enum : uint { EMR_BITBLT = 76 }
enum : uint { EMR_STRETCHBLT = 77 }
enum : uint { EMR_MASKBLT = 78 }
enum : uint { EMR_PLGBLT = 79 }
enum : uint { EMR_SETDIBITSTODEVICE = 80 }
enum : uint { EMR_STRETCHDIBITS = 81 }
enum : uint { EMR_EXTCREATEFONTINDIRECTW = 82 }
enum : uint { EMR_EXTTEXTOUTA = 83 }
enum : uint { EMR_EXTTEXTOUTW = 84 }
enum : uint { EMR_POLYBEZIER16 = 85 }
enum : uint { EMR_POLYGON16 = 86 }
enum : uint { EMR_POLYLINE16 = 87 }
enum : uint { EMR_POLYBEZIERTO16 = 88 }
enum : uint { EMR_POLYLINETO16 = 89 }
enum : uint { EMR_POLYPOLYLINE16 = 90 }
enum : uint { EMR_POLYPOLYGON16 = 91 }
enum : uint { EMR_POLYDRAW16 = 92 }
enum : uint { EMR_CREATEMONOBRUSH = 93 }
enum : uint { EMR_CREATEDIBPATTERNBRUSHPT = 94 }
enum : uint { EMR_EXTCREATEPEN = 95 }
enum : uint { EMR_POLYTEXTOUTA = 96 }
enum : uint { EMR_POLYTEXTOUTW = 97 }

// #if(WINVER >= 0x0400)
enum : uint { EMR_SETICMMODE = 98 }
enum : uint { EMR_CREATECOLORSPACE = 99 }
enum : uint { EMR_SETCOLORSPACE = 100 }
enum : uint { EMR_DELETECOLORSPACE = 101 }
enum : uint { EMR_GLSRECORD = 102 }
enum : uint { EMR_GLSBOUNDEDRECORD = 103 }
enum : uint { EMR_PIXELFORMAT = 104 }
// #endif /* WINVER >= 0x0400 */

// #if(WINVER >= 0x0500)
enum : uint { EMR_RESERVED_105 = 105 }
enum : uint { EMR_RESERVED_106 = 106 }
enum : uint { EMR_RESERVED_107 = 107 }
enum : uint { EMR_RESERVED_108 = 108 }
enum : uint { EMR_RESERVED_109 = 109 }
enum : uint { EMR_RESERVED_110 = 110 }
enum : uint { EMR_COLORCORRECTPALETTE = 111 }
enum : uint { EMR_SETICMPROFILEA = 112 }
enum : uint { EMR_SETICMPROFILEW = 113 }
enum : uint { EMR_ALPHABLEND = 114 }
enum : uint { EMR_SETLAYOUT = 115 }
enum : uint { EMR_TRANSPARENTBLT = 116 }
enum : uint { EMR_RESERVED_117 = 117 }
enum : uint { EMR_GRADIENTFILL = 118 }
enum : uint { EMR_RESERVED_119 = 119 }
enum : uint { EMR_RESERVED_120 = 120 }
enum : uint { EMR_COLORMATCHTOTARGETW = 121 }
enum : uint { EMR_CREATECOLORSPACEW = 122 }
// #endif /* WINVER >= 0x0500 */

enum : uint { EMR_MIN = 1 }

// #if (WINVER >= 0x0500)
enum : uint { EMR_MAX = 122 }
// #elif (WINVER >= 0x0400)
// #...
// #else
// #...
// #endif

struct tagEMR {
  DWORD iType;
  DWORD nSize;

}
alias tagEMR EMR;
alias tagEMR* PEMR;

struct tagEMRTEXT {
  POINTL ptlReference;
  DWORD nChars;
  DWORD offString;
  DWORD fOptions;
  RECTL rcl;
  DWORD offDx;

}
alias tagEMRTEXT EMRTEXT;
alias tagEMRTEXT* PEMRTEXT;

struct tagABORTPATH {
  EMR emr;
}
alias tagABORTPATH EMRABORTPATH;
alias tagABORTPATH* PEMRABORTPATH;
alias tagABORTPATH EMRBEGINPATH;
alias tagABORTPATH* PEMRBEGINPATH;
alias tagABORTPATH EMRENDPATH;
alias tagABORTPATH* PEMRENDPATH;
alias tagABORTPATH EMRCLOSEFIGURE;
alias tagABORTPATH* PEMRCLOSEFIGURE;
alias tagABORTPATH EMRFLATTENPATH;
alias tagABORTPATH* PEMRFLATTENPATH;
alias tagABORTPATH EMRWIDENPATH;
alias tagABORTPATH* PEMRWIDENPATH;
alias tagABORTPATH EMRSETMETARGN;
alias tagABORTPATH* PEMRSETMETARGN;
alias tagABORTPATH EMRSAVEDC;
alias tagABORTPATH* PEMRSAVEDC;
alias tagABORTPATH EMRREALIZEPALETTE;
alias tagABORTPATH* PEMRREALIZEPALETTE;

struct tagEMRSELECTCLIPPATH {
  EMR emr;
  DWORD iMode;
}
alias tagEMRSELECTCLIPPATH EMRSELECTCLIPPATH;
alias tagEMRSELECTCLIPPATH* PEMRSELECTCLIPPATH;
alias tagEMRSELECTCLIPPATH EMRSETBKMODE;
alias tagEMRSELECTCLIPPATH* PEMRSETBKMODE;
alias tagEMRSELECTCLIPPATH EMRSETMAPMODE;
alias tagEMRSELECTCLIPPATH* PEMRSETMAPMODE;
alias tagEMRSELECTCLIPPATH EMRSETLAYOUT;
alias tagEMRSELECTCLIPPATH* PEMRSETLAYOUT;
alias tagEMRSELECTCLIPPATH EMRSETPOLYFILLMODE;
alias tagEMRSELECTCLIPPATH* PEMRSETPOLYFILLMODE;
alias tagEMRSELECTCLIPPATH EMRSETROP2;
alias tagEMRSELECTCLIPPATH* PEMRSETROP2;
alias tagEMRSELECTCLIPPATH EMRSETSTRETCHBLTMODE;
alias tagEMRSELECTCLIPPATH* PEMRSETSTRETCHBLTMODE;
alias tagEMRSELECTCLIPPATH EMRSETICMMODE;
alias tagEMRSELECTCLIPPATH* PEMRSETICMMODE;
alias tagEMRSELECTCLIPPATH EMRSETTEXTALIGN;
alias tagEMRSELECTCLIPPATH* PEMRSETTEXTALIGN;

struct tagEMRSETMITERLIMIT {
  EMR emr;
  FLOAT eMiterLimit;
}
alias tagEMRSETMITERLIMIT EMRSETMITERLIMIT;
alias tagEMRSETMITERLIMIT* PEMRSETMITERLIMIT;

struct tagEMRRESTOREDC {
  EMR emr;
  LONG iRelative;
}
alias tagEMRRESTOREDC EMRRESTOREDC;
alias tagEMRRESTOREDC* PEMRRESTOREDC;

struct tagEMRSETARCDIRECTION {
  EMR emr;
  DWORD iArcDirection;

}
alias tagEMRSETARCDIRECTION EMRSETARCDIRECTION;
alias tagEMRSETARCDIRECTION* PEMRSETARCDIRECTION;

struct tagEMRSETMAPPERFLAGS {
  EMR emr;
  DWORD dwFlags;
}
alias tagEMRSETMAPPERFLAGS EMRSETMAPPERFLAGS;
alias tagEMRSETMAPPERFLAGS* PEMRSETMAPPERFLAGS;

struct tagEMRSETTEXTCOLOR {
  EMR emr;
  COLORREF crColor;
}
alias tagEMRSETTEXTCOLOR EMRSETBKCOLOR;
alias tagEMRSETTEXTCOLOR* PEMRSETBKCOLOR;
alias tagEMRSETTEXTCOLOR EMRSETTEXTCOLOR;
alias tagEMRSETTEXTCOLOR* PEMRSETTEXTCOLOR;

struct tagEMRSELECTOBJECT {
  EMR emr;
  DWORD ihObject;
}
alias tagEMRSELECTOBJECT EMRSELECTOBJECT;
alias tagEMRSELECTOBJECT* PEMRSELECTOBJECT;
alias tagEMRSELECTOBJECT EMRDELETEOBJECT;
alias tagEMRSELECTOBJECT* PEMRDELETEOBJECT;

struct tagEMRSELECTPALETTE {
  EMR emr;
  DWORD ihPal;
}
alias tagEMRSELECTPALETTE EMRSELECTPALETTE;
alias tagEMRSELECTPALETTE* PEMRSELECTPALETTE;

struct tagEMRRESIZEPALETTE {
  EMR emr;
  DWORD ihPal;
  DWORD cEntries;
}
alias tagEMRRESIZEPALETTE EMRRESIZEPALETTE;
alias tagEMRRESIZEPALETTE* PEMRRESIZEPALETTE;

struct tagEMRSETPALETTEENTRIES {
  EMR emr;
  DWORD ihPal;
  DWORD iStart;
  DWORD cEntries;
  PALETTEENTRY aPalEntries[1];
}
alias tagEMRSETPALETTEENTRIES EMRSETPALETTEENTRIES;
alias tagEMRSETPALETTEENTRIES* PEMRSETPALETTEENTRIES;

struct tagEMRSETCOLORADJUSTMENT {
  EMR emr;
  COLORADJUSTMENT ColorAdjustment;
}
alias tagEMRSETCOLORADJUSTMENT EMRSETCOLORADJUSTMENT;
alias tagEMRSETCOLORADJUSTMENT* PEMRSETCOLORADJUSTMENT;

struct tagEMRGDICOMMENT {
  EMR emr;
  DWORD cbData;
  BYTE Data[1];
}
alias tagEMRGDICOMMENT EMRGDICOMMENT;
alias tagEMRGDICOMMENT* PEMRGDICOMMENT;

struct tagEMREOF {
  EMR emr;
  DWORD nPalEntries;
  DWORD offPalEntries;
  DWORD nSizeLast;

}
alias tagEMREOF EMREOF;
alias tagEMREOF* PEMREOF;

struct tagEMRLINETO {
  EMR emr;
  POINTL ptl;
}
alias tagEMRLINETO EMRLINETO;
alias tagEMRLINETO* PEMRLINETO;
alias tagEMRLINETO EMRMOVETOEX;
alias tagEMRLINETO* PEMRMOVETOEX;

struct tagEMROFFSETCLIPRGN {
  EMR emr;
  POINTL ptlOffset;
}
alias tagEMROFFSETCLIPRGN EMROFFSETCLIPRGN;
alias tagEMROFFSETCLIPRGN* PEMROFFSETCLIPRGN;

struct tagEMRFILLPATH {
  EMR emr;
  RECTL rclBounds;
}
alias tagEMRFILLPATH EMRFILLPATH;
alias tagEMRFILLPATH* PEMRFILLPATH;
alias tagEMRFILLPATH EMRSTROKEANDFILLPATH;
alias tagEMRFILLPATH* PEMRSTROKEANDFILLPATH;
alias tagEMRFILLPATH EMRSTROKEPATH;
alias tagEMRFILLPATH* PEMRSTROKEPATH;

struct tagEMREXCLUDECLIPRECT {
  EMR emr;
  RECTL rclClip;
}
alias tagEMREXCLUDECLIPRECT EMREXCLUDECLIPRECT;
alias tagEMREXCLUDECLIPRECT* PEMREXCLUDECLIPRECT;
alias tagEMREXCLUDECLIPRECT EMRINTERSECTCLIPRECT;
alias tagEMREXCLUDECLIPRECT* PEMRINTERSECTCLIPRECT;

struct tagEMRSETVIEWPORTORGEX {
  EMR emr;
  POINTL ptlOrigin;
}
alias tagEMRSETVIEWPORTORGEX EMRSETVIEWPORTORGEX;
alias tagEMRSETVIEWPORTORGEX* PEMRSETVIEWPORTORGEX;
alias tagEMRSETVIEWPORTORGEX EMRSETWINDOWORGEX;
alias tagEMRSETVIEWPORTORGEX* PEMRSETWINDOWORGEX;
alias tagEMRSETVIEWPORTORGEX EMRSETBRUSHORGEX;
alias tagEMRSETVIEWPORTORGEX* PEMRSETBRUSHORGEX;

struct tagEMRSETVIEWPORTEXTEX {
  EMR emr;
  SIZEL szlExtent;
}
alias tagEMRSETVIEWPORTEXTEX EMRSETVIEWPORTEXTEX;
alias tagEMRSETVIEWPORTEXTEX* PEMRSETVIEWPORTEXTEX;
alias tagEMRSETVIEWPORTEXTEX EMRSETWINDOWEXTEX;
alias tagEMRSETVIEWPORTEXTEX* PEMRSETWINDOWEXTEX;

struct tagEMRSCALEVIEWPORTEXTEX {
  EMR emr;
  LONG xNum;
  LONG xDenom;
  LONG yNum;
  LONG yDenom;
}
alias tagEMRSCALEVIEWPORTEXTEX EMRSCALEVIEWPORTEXTEX;
alias tagEMRSCALEVIEWPORTEXTEX* PEMRSCALEVIEWPORTEXTEX;
alias tagEMRSCALEVIEWPORTEXTEX EMRSCALEWINDOWEXTEX;
alias tagEMRSCALEVIEWPORTEXTEX* PEMRSCALEWINDOWEXTEX;

struct tagEMRSETWORLDTRANSFORM {
  EMR emr;
  XFORM xform;
}
alias tagEMRSETWORLDTRANSFORM EMRSETWORLDTRANSFORM;
alias tagEMRSETWORLDTRANSFORM* PEMRSETWORLDTRANSFORM;

struct tagEMRMODIFYWORLDTRANSFORM {
  EMR emr;
  XFORM xform;
  DWORD iMode;
}
alias tagEMRMODIFYWORLDTRANSFORM EMRMODIFYWORLDTRANSFORM;
alias tagEMRMODIFYWORLDTRANSFORM* PEMRMODIFYWORLDTRANSFORM;

struct tagEMRSETPIXELV {
  EMR emr;
  POINTL ptlPixel;
  COLORREF crColor;
}
alias tagEMRSETPIXELV EMRSETPIXELV;
alias tagEMRSETPIXELV* PEMRSETPIXELV;

struct tagEMREXTFLOODFILL {
  EMR emr;
  POINTL ptlStart;
  COLORREF crColor;
  DWORD iMode;
}
alias tagEMREXTFLOODFILL EMREXTFLOODFILL;
alias tagEMREXTFLOODFILL* PEMREXTFLOODFILL;

struct tagEMRELLIPSE {
  EMR emr;
  RECTL rclBox;
}
alias tagEMRELLIPSE EMRELLIPSE;
alias tagEMRELLIPSE* PEMRELLIPSE;
alias tagEMRELLIPSE EMRRECTANGLE;
alias tagEMRELLIPSE* PEMRRECTANGLE;

struct tagEMRROUNDRECT {
  EMR emr;
  RECTL rclBox;
  SIZEL szlCorner;
}
alias tagEMRROUNDRECT EMRROUNDRECT;
alias tagEMRROUNDRECT* PEMRROUNDRECT;

struct tagEMRARC {
  EMR emr;
  RECTL rclBox;
  POINTL ptlStart;
  POINTL ptlEnd;
}
alias tagEMRARC EMRARC;
alias tagEMRARC* PEMRARC;
alias tagEMRARC EMRARCTO;
alias tagEMRARC* PEMRARCTO;
alias tagEMRARC EMRCHORD;
alias tagEMRARC* PEMRCHORD;
alias tagEMRARC EMRPIE;
alias tagEMRARC* PEMRPIE;

struct tagEMRANGLEARC {
  EMR emr;
  POINTL ptlCenter;
  DWORD nRadius;
  FLOAT eStartAngle;
  FLOAT eSweepAngle;
}
alias tagEMRANGLEARC EMRANGLEARC;
alias tagEMRANGLEARC* PEMRANGLEARC;

struct tagEMRPOLYLINE {
  EMR emr;
  RECTL rclBounds;
  DWORD cptl;
  POINTL aptl[1];
}
alias tagEMRPOLYLINE EMRPOLYLINE;
alias tagEMRPOLYLINE* PEMRPOLYLINE;
alias tagEMRPOLYLINE EMRPOLYBEZIER;
alias tagEMRPOLYLINE* PEMRPOLYBEZIER;
alias tagEMRPOLYLINE EMRPOLYGON;
alias tagEMRPOLYLINE* PEMRPOLYGON;
alias tagEMRPOLYLINE EMRPOLYBEZIERTO;
alias tagEMRPOLYLINE* PEMRPOLYBEZIERTO;
alias tagEMRPOLYLINE EMRPOLYLINETO;
alias tagEMRPOLYLINE* PEMRPOLYLINETO;

struct tagEMRPOLYLINE16 {
  EMR emr;
  RECTL rclBounds;
  DWORD cpts;
  POINTS apts[1];
}
alias tagEMRPOLYLINE16 EMRPOLYLINE16;
alias tagEMRPOLYLINE16* PEMRPOLYLINE16;
alias tagEMRPOLYLINE16 EMRPOLYBEZIER16;
alias tagEMRPOLYLINE16* PEMRPOLYBEZIER16;
alias tagEMRPOLYLINE16 EMRPOLYGON16;
alias tagEMRPOLYLINE16* PEMRPOLYGON16;
alias tagEMRPOLYLINE16 EMRPOLYBEZIERTO16;
alias tagEMRPOLYLINE16* PEMRPOLYBEZIERTO16;
alias tagEMRPOLYLINE16 EMRPOLYLINETO16;
alias tagEMRPOLYLINE16* PEMRPOLYLINETO16;

struct tagEMRPOLYDRAW {
  EMR emr;
  RECTL rclBounds;
  DWORD cptl;
  POINTL aptl[1];
  BYTE abTypes[1];
}
alias tagEMRPOLYDRAW EMRPOLYDRAW;
alias tagEMRPOLYDRAW* PEMRPOLYDRAW;

struct tagEMRPOLYDRAW16 {
  EMR emr;
  RECTL rclBounds;
  DWORD cpts;
  POINTS apts[1];
  BYTE abTypes[1];
}
alias tagEMRPOLYDRAW16 EMRPOLYDRAW16;
alias tagEMRPOLYDRAW16* PEMRPOLYDRAW16;

struct tagEMRPOLYPOLYLINE {
  EMR emr;
  RECTL rclBounds;
  DWORD nPolys;
  DWORD cptl;
  DWORD aPolyCounts[1];
  POINTL aptl[1];
}
alias tagEMRPOLYPOLYLINE EMRPOLYPOLYLINE;
alias tagEMRPOLYPOLYLINE* PEMRPOLYPOLYLINE;
alias tagEMRPOLYPOLYLINE EMRPOLYPOLYGON;
alias tagEMRPOLYPOLYLINE* PEMRPOLYPOLYGON;

struct tagEMRPOLYPOLYLINE16 {
  EMR emr;
  RECTL rclBounds;
  DWORD nPolys;
  DWORD cpts;
  DWORD aPolyCounts[1];
  POINTS apts[1];
}
alias tagEMRPOLYPOLYLINE16 EMRPOLYPOLYLINE16;
alias tagEMRPOLYPOLYLINE16* PEMRPOLYPOLYLINE16;
alias tagEMRPOLYPOLYLINE16 EMRPOLYPOLYGON16;
alias tagEMRPOLYPOLYLINE16* PEMRPOLYPOLYGON16;

struct tagEMRINVERTRGN {
  EMR emr;
  RECTL rclBounds;
  DWORD cbRgnData;
  BYTE RgnData[1];
}
alias tagEMRINVERTRGN EMRINVERTRGN;
alias tagEMRINVERTRGN* PEMRINVERTRGN;
alias tagEMRINVERTRGN EMRPAINTRGN;
alias tagEMRINVERTRGN* PEMRPAINTRGN;

struct tagEMRFILLRGN {
  EMR emr;
  RECTL rclBounds;
  DWORD cbRgnData;
  DWORD ihBrush;
  BYTE RgnData[1];
}
alias tagEMRFILLRGN EMRFILLRGN;
alias tagEMRFILLRGN* PEMRFILLRGN;

struct tagEMRFRAMERGN {
  EMR emr;
  RECTL rclBounds;
  DWORD cbRgnData;
  DWORD ihBrush;
  SIZEL szlStroke;
  BYTE RgnData[1];
}
alias tagEMRFRAMERGN EMRFRAMERGN;
alias tagEMRFRAMERGN* PEMRFRAMERGN;

struct tagEMREXTSELECTCLIPRGN {
  EMR emr;
  DWORD cbRgnData;
  DWORD iMode;
  BYTE RgnData[1];
}
alias tagEMREXTSELECTCLIPRGN EMREXTSELECTCLIPRGN;
alias tagEMREXTSELECTCLIPRGN* PEMREXTSELECTCLIPRGN;

struct tagEMREXTTEXTOUTA {
  EMR emr;
  RECTL rclBounds;
  DWORD iGraphicsMode;
  FLOAT exScale;
  FLOAT eyScale;
  EMRTEXT emrtext;

}
alias tagEMREXTTEXTOUTA EMREXTTEXTOUTA;
alias tagEMREXTTEXTOUTA* PEMREXTTEXTOUTA;
alias tagEMREXTTEXTOUTA EMREXTTEXTOUTW;
alias tagEMREXTTEXTOUTA* PEMREXTTEXTOUTW;

struct tagEMRPOLYTEXTOUTA {
  EMR emr;
  RECTL rclBounds;
  DWORD iGraphicsMode;
  FLOAT exScale;
  FLOAT eyScale;
  LONG cStrings;
  EMRTEXT aemrtext[1];

}
alias tagEMRPOLYTEXTOUTA EMRPOLYTEXTOUTA;
alias tagEMRPOLYTEXTOUTA* PEMRPOLYTEXTOUTA;
alias tagEMRPOLYTEXTOUTA EMRPOLYTEXTOUTW;
alias tagEMRPOLYTEXTOUTA* PEMRPOLYTEXTOUTW;

struct tagEMRBITBLT {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG cxDest;
  LONG cyDest;
  DWORD dwRop;
  LONG xSrc;
  LONG ySrc;
  XFORM xformSrc;
  COLORREF crBkColorSrc;
  DWORD iUsageSrc;

  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
}
alias tagEMRBITBLT EMRBITBLT;
alias tagEMRBITBLT* PEMRBITBLT;

struct tagEMRSTRETCHBLT {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG cxDest;
  LONG cyDest;
  DWORD dwRop;
  LONG xSrc;
  LONG ySrc;
  XFORM xformSrc;
  COLORREF crBkColorSrc;
  DWORD iUsageSrc;

  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  LONG cxSrc;
  LONG cySrc;
}
alias tagEMRSTRETCHBLT EMRSTRETCHBLT;
alias tagEMRSTRETCHBLT* PEMRSTRETCHBLT;

struct tagEMRMASKBLT {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG cxDest;
  LONG cyDest;
  DWORD dwRop;
  LONG xSrc;
  LONG ySrc;
  XFORM xformSrc;
  COLORREF crBkColorSrc;
  DWORD iUsageSrc;

  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  LONG xMask;
  LONG yMask;
  DWORD iUsageMask;
  DWORD offBmiMask;
  DWORD cbBmiMask;
  DWORD offBitsMask;
  DWORD cbBitsMask;
}
alias tagEMRMASKBLT EMRMASKBLT;
alias tagEMRMASKBLT* PEMRMASKBLT;

struct tagEMRPLGBLT {
  EMR emr;
  RECTL rclBounds;
  POINTL aptlDest[3];
  LONG xSrc;
  LONG ySrc;
  LONG cxSrc;
  LONG cySrc;
  XFORM xformSrc;
  COLORREF crBkColorSrc;
  DWORD iUsageSrc;

  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  LONG xMask;
  LONG yMask;
  DWORD iUsageMask;
  DWORD offBmiMask;
  DWORD cbBmiMask;
  DWORD offBitsMask;
  DWORD cbBitsMask;
}
alias tagEMRPLGBLT EMRPLGBLT;
alias tagEMRPLGBLT* PEMRPLGBLT;

struct tagEMRSETDIBITSTODEVICE {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG xSrc;
  LONG ySrc;
  LONG cxSrc;
  LONG cySrc;
  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  DWORD iUsageSrc;
  DWORD iStartScan;
  DWORD cScans;
}
alias tagEMRSETDIBITSTODEVICE EMRSETDIBITSTODEVICE;
alias tagEMRSETDIBITSTODEVICE* PEMRSETDIBITSTODEVICE;

struct tagEMRSTRETCHDIBITS {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG xSrc;
  LONG ySrc;
  LONG cxSrc;
  LONG cySrc;
  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  DWORD iUsageSrc;
  DWORD dwRop;
  LONG cxDest;
  LONG cyDest;
}
alias tagEMRSTRETCHDIBITS EMRSTRETCHDIBITS;
alias tagEMRSTRETCHDIBITS* PEMRSTRETCHDIBITS;

struct tagEMREXTCREATEFONTINDIRECTW {
  EMR emr;
  DWORD ihFont;
  EXTLOGFONTW elfw;
}
alias tagEMREXTCREATEFONTINDIRECTW EMREXTCREATEFONTINDIRECTW;
alias tagEMREXTCREATEFONTINDIRECTW* PEMREXTCREATEFONTINDIRECTW;

struct tagEMRCREATEPALETTE {
  EMR emr;
  DWORD ihPal;
  LOGPALETTE lgpl;

}
alias tagEMRCREATEPALETTE EMRCREATEPALETTE;
alias tagEMRCREATEPALETTE* PEMRCREATEPALETTE;

struct tagEMRCREATEPEN {
  EMR emr;
  DWORD ihPen;
  LOGPEN lopn;
}
alias tagEMRCREATEPEN EMRCREATEPEN;
alias tagEMRCREATEPEN* PEMRCREATEPEN;

struct tagEMREXTCREATEPEN {
  EMR emr;
  DWORD ihPen;
  DWORD offBmi;
  DWORD cbBmi;

  DWORD offBits;
  DWORD cbBits;
  EXTLOGPEN elp;
}
alias tagEMREXTCREATEPEN EMREXTCREATEPEN;
alias tagEMREXTCREATEPEN* PEMREXTCREATEPEN;

struct tagEMRCREATEBRUSHINDIRECT {
  EMR emr;
  DWORD ihBrush;
  LOGBRUSH32 lb;

}
alias tagEMRCREATEBRUSHINDIRECT EMRCREATEBRUSHINDIRECT;
alias tagEMRCREATEBRUSHINDIRECT* PEMRCREATEBRUSHINDIRECT;

struct tagEMRCREATEMONOBRUSH {
  EMR emr;
  DWORD ihBrush;
  DWORD iUsage;
  DWORD offBmi;
  DWORD cbBmi;
  DWORD offBits;
  DWORD cbBits;
}
alias tagEMRCREATEMONOBRUSH EMRCREATEMONOBRUSH;
alias tagEMRCREATEMONOBRUSH* PEMRCREATEMONOBRUSH;

struct tagEMRCREATEDIBPATTERNBRUSHPT {
  EMR emr;
  DWORD ihBrush;
  DWORD iUsage;
  DWORD offBmi;
  DWORD cbBmi;

  DWORD offBits;
  DWORD cbBits;
}
alias tagEMRCREATEDIBPATTERNBRUSHPT EMRCREATEDIBPATTERNBRUSHPT;
alias tagEMRCREATEDIBPATTERNBRUSHPT* PEMRCREATEDIBPATTERNBRUSHPT;

struct tagEMRFORMAT {
  DWORD dSignature;
  DWORD nVersion;
  DWORD cbData;
  DWORD offData;

}
alias tagEMRFORMAT EMRFORMAT;
alias tagEMRFORMAT* PEMRFORMAT;

// #if(WINVER >= 0x0400)

struct tagEMRGLSRECORD {
  EMR emr;
  DWORD cbData;
  BYTE Data[1];
}
alias tagEMRGLSRECORD EMRGLSRECORD;
alias tagEMRGLSRECORD* PEMRGLSRECORD;

struct tagEMRGLSBOUNDEDRECORD {
  EMR emr;
  RECTL rclBounds;
  DWORD cbData;
  BYTE Data[1];
}
alias tagEMRGLSBOUNDEDRECORD EMRGLSBOUNDEDRECORD;
alias tagEMRGLSBOUNDEDRECORD* PEMRGLSBOUNDEDRECORD;

struct tagEMRPIXELFORMAT {
  EMR emr;
  PIXELFORMATDESCRIPTOR pfd;
}
alias tagEMRPIXELFORMAT EMRPIXELFORMAT;
alias tagEMRPIXELFORMAT* PEMRPIXELFORMAT;

struct tagEMRCREATECOLORSPACE {
  EMR emr;
  DWORD ihCS;
  LOGCOLORSPACEA lcs;
}
alias tagEMRCREATECOLORSPACE EMRCREATECOLORSPACE;
alias tagEMRCREATECOLORSPACE* PEMRCREATECOLORSPACE;

struct tagEMRSETCOLORSPACE {
  EMR emr;
  DWORD ihCS;
}
alias tagEMRSETCOLORSPACE EMRSETCOLORSPACE;
alias tagEMRSETCOLORSPACE* PEMRSETCOLORSPACE;
alias tagEMRSETCOLORSPACE EMRSELECTCOLORSPACE;
alias tagEMRSETCOLORSPACE* PEMRSELECTCOLORSPACE;
alias tagEMRSETCOLORSPACE EMRDELETECOLORSPACE;
alias tagEMRSETCOLORSPACE* PEMRDELETECOLORSPACE;

// #endif /* WINVER >= 0x0400 */

// #if(WINVER >= 0x0500)

struct tagEMREXTESCAPE {
  EMR emr;
  INT iEscape;
  INT cbEscData;
  BYTE EscData[1];
}
alias tagEMREXTESCAPE EMREXTESCAPE;
alias tagEMREXTESCAPE* PEMREXTESCAPE;
alias tagEMREXTESCAPE EMRDRAWESCAPE;
alias tagEMREXTESCAPE* PEMRDRAWESCAPE;

struct tagEMRNAMEDESCAPE {
  EMR emr;
  INT iEscape;
  INT cbDriver;
  INT cbEscData;
  BYTE EscData[1];
}
alias tagEMRNAMEDESCAPE EMRNAMEDESCAPE;
alias tagEMRNAMEDESCAPE* PEMRNAMEDESCAPE;

enum : uint { SETICMPROFILE_EMBEDED = 0x00000001 }

struct tagEMRSETICMPROFILE {
  EMR emr;
  DWORD dwFlags;
  DWORD cbName;
  DWORD cbData;
  BYTE Data[1];
}
alias tagEMRSETICMPROFILE EMRSETICMPROFILE;
alias tagEMRSETICMPROFILE* PEMRSETICMPROFILE;
alias tagEMRSETICMPROFILE EMRSETICMPROFILEA;
alias tagEMRSETICMPROFILE* PEMRSETICMPROFILEA;
alias tagEMRSETICMPROFILE EMRSETICMPROFILEW;
alias tagEMRSETICMPROFILE* PEMRSETICMPROFILEW;

enum : uint { CREATECOLORSPACE_EMBEDED = 0x00000001 }

struct tagEMRCREATECOLORSPACEW {
  EMR emr;
  DWORD ihCS;
  LOGCOLORSPACEW lcs;
  DWORD dwFlags;
  DWORD cbData;
  BYTE Data[1];
}
alias tagEMRCREATECOLORSPACEW EMRCREATECOLORSPACEW;
alias tagEMRCREATECOLORSPACEW* PEMRCREATECOLORSPACEW;

enum : uint { COLORMATCHTOTARGET_EMBEDED = 0x00000001 }

struct tagCOLORMATCHTOTARGET {
  EMR emr;
  DWORD dwAction;
  DWORD dwFlags;
  DWORD cbName;
  DWORD cbData;
  BYTE Data[1];
}
alias tagCOLORMATCHTOTARGET EMRCOLORMATCHTOTARGET;
alias tagCOLORMATCHTOTARGET* PEMRCOLORMATCHTOTARGET;

struct tagCOLORCORRECTPALETTE {
  EMR emr;
  DWORD ihPalette;
  DWORD nFirstEntry;
  DWORD nPalEntries;
  DWORD nReserved;
}
alias tagCOLORCORRECTPALETTE EMRCOLORCORRECTPALETTE;
alias tagCOLORCORRECTPALETTE* PEMRCOLORCORRECTPALETTE;

struct tagEMRALPHABLEND {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG cxDest;
  LONG cyDest;
  DWORD dwRop;
  LONG xSrc;
  LONG ySrc;
  XFORM xformSrc;
  COLORREF crBkColorSrc;
  DWORD iUsageSrc;

  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  LONG cxSrc;
  LONG cySrc;
}
alias tagEMRALPHABLEND EMRALPHABLEND;
alias tagEMRALPHABLEND* PEMRALPHABLEND;

struct tagEMRGRADIENTFILL {
  EMR emr;
  RECTL rclBounds;
  DWORD nVer;
  DWORD nTri;
  ULONG ulMode;
  TRIVERTEX Ver[1];
}
alias tagEMRGRADIENTFILL EMRGRADIENTFILL;
alias tagEMRGRADIENTFILL* PEMRGRADIENTFILL;

struct tagEMRTRANSPARENTBLT {
  EMR emr;
  RECTL rclBounds;
  LONG xDest;
  LONG yDest;
  LONG cxDest;
  LONG cyDest;
  DWORD dwRop;
  LONG xSrc;
  LONG ySrc;
  XFORM xformSrc;
  COLORREF crBkColorSrc;
  DWORD iUsageSrc;

  DWORD offBmiSrc;
  DWORD cbBmiSrc;
  DWORD offBitsSrc;
  DWORD cbBitsSrc;
  LONG cxSrc;
  LONG cySrc;
}
alias tagEMRTRANSPARENTBLT EMRTRANSPARENTBLT;
alias tagEMRTRANSPARENTBLT* PEMRTRANSPARENTBLT;

// #endif /* WINVER >= 0x0500 */

enum : uint { GDICOMMENT_IDENTIFIER = 0x43494447 }
enum : uint { GDICOMMENT_WINDOWS_METAFILE = 0x80000001 }
enum : uint { GDICOMMENT_BEGINGROUP = 0x00000002 }
enum : uint { GDICOMMENT_ENDGROUP = 0x00000003 }
enum : uint { GDICOMMENT_MULTIFORMATS = 0x40000004 }
enum : uint { EPS_SIGNATURE = 0x46535045 }
enum : uint { GDICOMMENT_UNICODE_STRING = 0x00000040 }
enum : uint { GDICOMMENT_UNICODE_END = 0x00000080 }

// #endif  /* NOMETAFILE */

extern(Windows) export BOOL wglCopyContext(HGLRC, HGLRC, UINT);
extern(Windows) export HGLRC wglCreateContext(HDC);
extern(Windows) export HGLRC wglCreateLayerContext(HDC, int);
extern(Windows) export BOOL wglDeleteContext(HGLRC);
extern(Windows) export HGLRC wglGetCurrentContext();
extern(Windows) export HDC wglGetCurrentDC();
extern(Windows) export PROC wglGetProcAddress(LPCSTR);
extern(Windows) export BOOL wglMakeCurrent(HDC, HGLRC);
extern(Windows) export BOOL wglShareLists(HGLRC, HGLRC);
extern(Windows) export BOOL wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
extern(Windows) export BOOL wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD);
// #ifdef UNICODE
// #...
// #else
alias wglUseFontBitmapsA wglUseFontBitmaps;
// #endif // !UNICODE
extern(Windows) export BOOL SwapBuffers(HDC);

struct _POINTFLOAT {
  FLOAT x;
  FLOAT y;
}
alias _POINTFLOAT POINTFLOAT;
alias _POINTFLOAT* PPOINTFLOAT;

struct _GLYPHMETRICSFLOAT {
  FLOAT gmfBlackBoxX;
  FLOAT gmfBlackBoxY;
  POINTFLOAT gmfptGlyphOrigin;
  FLOAT gmfCellIncX;
  FLOAT gmfCellIncY;
}
alias _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT;
alias _GLYPHMETRICSFLOAT* PGLYPHMETRICSFLOAT;
alias _GLYPHMETRICSFLOAT* LPGLYPHMETRICSFLOAT;

enum : uint { WGL_FONT_LINES = 0 }
enum : uint { WGL_FONT_POLYGONS = 1 }
extern(Windows) export BOOL wglUseFontOutlinesA(HDC, DWORD, DWORD, DWORD, FLOAT,
  FLOAT, int, LPGLYPHMETRICSFLOAT);
extern(Windows) export BOOL wglUseFontOutlinesW(HDC, DWORD, DWORD, DWORD, FLOAT,
  FLOAT, int, LPGLYPHMETRICSFLOAT);
// #ifdef UNICODE
// #...
// #else
alias wglUseFontOutlinesA wglUseFontOutlines;
// #endif // !UNICODE

struct tagLAYERPLANEDESCRIPTOR {
  WORD nSize;
  WORD nVersion;
  DWORD dwFlags;
  BYTE iPixelType;
  BYTE cColorBits;
  BYTE cRedBits;
  BYTE cRedShift;
  BYTE cGreenBits;
  BYTE cGreenShift;
  BYTE cBlueBits;
  BYTE cBlueShift;
  BYTE cAlphaBits;
  BYTE cAlphaShift;
  BYTE cAccumBits;
  BYTE cAccumRedBits;
  BYTE cAccumGreenBits;
  BYTE cAccumBlueBits;
  BYTE cAccumAlphaBits;
  BYTE cDepthBits;
  BYTE cStencilBits;
  BYTE cAuxBuffers;
  BYTE iLayerPlane;
  BYTE bReserved;
  COLORREF crTransparent;
}
alias tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR;
alias tagLAYERPLANEDESCRIPTOR* PLAYERPLANEDESCRIPTOR;
alias tagLAYERPLANEDESCRIPTOR* LPLAYERPLANEDESCRIPTOR;

enum : uint { LPD_DOUBLEBUFFER = 0x00000001 }
enum : uint { LPD_STEREO = 0x00000002 }
enum : uint { LPD_SUPPORT_GDI = 0x00000010 }
enum : uint { LPD_SUPPORT_OPENGL = 0x00000020 }
enum : uint { LPD_SHARE_DEPTH = 0x00000040 }
enum : uint { LPD_SHARE_STENCIL = 0x00000080 }
enum : uint { LPD_SHARE_ACCUM = 0x00000100 }
enum : uint { LPD_SWAP_EXCHANGE = 0x00000200 }
enum : uint { LPD_SWAP_COPY = 0x00000400 }
enum : uint { LPD_TRANSPARENT = 0x00001000 }

enum : uint { LPD_TYPE_RGBA = 0 }
enum : uint { LPD_TYPE_COLORINDEX = 1 }

enum : uint { WGL_SWAP_MAIN_PLANE = 0x00000001 }
enum : uint { WGL_SWAP_OVERLAY1 = 0x00000002 }
enum : uint { WGL_SWAP_OVERLAY2 = 0x00000004 }
enum : uint { WGL_SWAP_OVERLAY3 = 0x00000008 }
enum : uint { WGL_SWAP_OVERLAY4 = 0x00000010 }
enum : uint { WGL_SWAP_OVERLAY5 = 0x00000020 }
enum : uint { WGL_SWAP_OVERLAY6 = 0x00000040 }
enum : uint { WGL_SWAP_OVERLAY7 = 0x00000080 }
enum : uint { WGL_SWAP_OVERLAY8 = 0x00000100 }
enum : uint { WGL_SWAP_OVERLAY9 = 0x00000200 }
enum : uint { WGL_SWAP_OVERLAY10 = 0x00000400 }
enum : uint { WGL_SWAP_OVERLAY11 = 0x00000800 }
enum : uint { WGL_SWAP_OVERLAY12 = 0x00001000 }
enum : uint { WGL_SWAP_OVERLAY13 = 0x00002000 }
enum : uint { WGL_SWAP_OVERLAY14 = 0x00004000 }
enum : uint { WGL_SWAP_OVERLAY15 = 0x00008000 }
enum : uint { WGL_SWAP_UNDERLAY1 = 0x00010000 }
enum : uint { WGL_SWAP_UNDERLAY2 = 0x00020000 }
enum : uint { WGL_SWAP_UNDERLAY3 = 0x00040000 }
enum : uint { WGL_SWAP_UNDERLAY4 = 0x00080000 }
enum : uint { WGL_SWAP_UNDERLAY5 = 0x00100000 }
enum : uint { WGL_SWAP_UNDERLAY6 = 0x00200000 }
enum : uint { WGL_SWAP_UNDERLAY7 = 0x00400000 }
enum : uint { WGL_SWAP_UNDERLAY8 = 0x00800000 }
enum : uint { WGL_SWAP_UNDERLAY9 = 0x01000000 }
enum : uint { WGL_SWAP_UNDERLAY10 = 0x02000000 }
enum : uint { WGL_SWAP_UNDERLAY11 = 0x04000000 }
enum : uint { WGL_SWAP_UNDERLAY12 = 0x08000000 }
enum : uint { WGL_SWAP_UNDERLAY13 = 0x10000000 }
enum : uint { WGL_SWAP_UNDERLAY14 = 0x20000000 }
enum : uint { WGL_SWAP_UNDERLAY15 = 0x40000000 }

extern(Windows) export BOOL wglDescribeLayerPlane(HDC, int, int, UINT,
  LPLAYERPLANEDESCRIPTOR);
extern(Windows) export int wglSetLayerPaletteEntries(HDC, int, int, int,
  COLORREF *);
extern(Windows) export int wglGetLayerPaletteEntries(HDC, int, int, int,
  COLORREF *);
extern(Windows) export BOOL wglRealizeLayerPalette(HDC, int, BOOL);
extern(Windows) export BOOL wglSwapLayerBuffers(HDC, UINT);

// #if (WINVER >= 0x0500)

struct _WGLSWAP {
  HDC hdc;
  UINT uiFlags;
}
alias _WGLSWAP WGLSWAP;
alias _WGLSWAP* PWGLSWAP;
alias _WGLSWAP* LPWGLSWAP;

enum : uint { WGL_SWAPMULTIPLE_MAX = 16 }

extern(Windows) export DWORD wglSwapMultipleBuffers(UINT, WGLSWAP *);

// #endif // (WINVER >= 0x0500)

// #endif /* NOGDI */

// #ifdef __cplusplus
// }
// #endif

// #endif /* _WINGDI_ */

