PageRenderTime 131ms CodeModel.GetById 20ms app.highlight 94ms RepoModel.GetById 1ms app.codeStats 2ms

/binding/win32/wingdi.d

http://github.com/wilkie/djehuty
D | 5612 lines | 4450 code | 885 blank | 277 comment | 72 complexity | f3a6255c8f1fbd462b2ff68ba5d6885c MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*
   2 * wingdi.d
   3 *
   4 * This module binds wingdi.h to D. The original copyright notice is
   5 * preserved below.
   6 *
   7 * Author: Dave Wilkinson
   8 * Originated: November 24th, 2009
   9 *
  10 */
  11
  12module binding.win32.wingdi;
  13
  14import binding.win32.windef;
  15import binding.win32.winnt;
  16import binding.win32.winuser;
  17
  18import binding.c;
  19
  20extern(System):
  21
  22// The original copyright from WinGDI.h:
  23
  24/**************************************************************************
  25*                                                                         *
  26* wingdi.h -- GDI procedure declarations, constant definitions and macros *
  27*                                                                         *
  28* Copyright (c) Microsoft Corp. All rights reserved.                      *
  29*                                                                         *
  30**************************************************************************/
  31
  32/* Binary raster ops */
  33const auto R2_BLACK            = 1;   /*  0       */
  34const auto R2_NOTMERGEPEN      = 2;   /* DPon     */
  35const auto R2_MASKNOTPEN       = 3;   /* DPna     */
  36const auto R2_NOTCOPYPEN       = 4;   /* PN       */
  37const auto R2_MASKPENNOT       = 5;   /* PDna     */
  38const auto R2_NOT              = 6;   /* Dn       */
  39const auto R2_XORPEN           = 7;   /* DPx      */
  40const auto R2_NOTMASKPEN       = 8;   /* DPan     */
  41const auto R2_MASKPEN          = 9;   /* DPa      */
  42const auto R2_NOTXORPEN        = 10;  /* DPxn     */
  43const auto R2_NOP              = 11;  /* D        */
  44const auto R2_MERGENOTPEN      = 12;  /* DPno     */
  45const auto R2_COPYPEN          = 13;  /* P        */
  46const auto R2_MERGEPENNOT      = 14;  /* PDno     */
  47const auto R2_MERGEPEN         = 15;  /* DPo      */
  48const auto R2_WHITE            = 16;  /*  1       */
  49const auto R2_LAST             = 16;
  50
  51/* Ternary raster operations */
  52const auto SRCCOPY             = cast(DWORD)0x00CC0020; /* dest = source                   */
  53const auto SRCPAINT            = cast(DWORD)0x00EE0086; /* dest = source OR dest           */
  54const auto SRCAND              = cast(DWORD)0x008800C6; /* dest = source AND dest          */
  55const auto SRCINVERT           = cast(DWORD)0x00660046; /* dest = source XOR dest          */
  56const auto SRCERASE            = cast(DWORD)0x00440328; /* dest = source AND (NOT dest )   */
  57const auto NOTSRCCOPY          = cast(DWORD)0x00330008; /* dest = (NOT source)             */
  58const auto NOTSRCERASE         = cast(DWORD)0x001100A6; /* dest = (NOT src) AND (NOT dest) */
  59const auto MERGECOPY           = cast(DWORD)0x00C000CA; /* dest = (source AND pattern)     */
  60const auto MERGEPAINT          = cast(DWORD)0x00BB0226; /* dest = (NOT source) OR dest     */
  61const auto PATCOPY             = cast(DWORD)0x00F00021; /* dest = pattern                  */
  62const auto PATPAINT            = cast(DWORD)0x00FB0A09; /* dest = DPSnoo                   */
  63const auto PATINVERT           = cast(DWORD)0x005A0049; /* dest = pattern XOR dest         */
  64const auto DSTINVERT           = cast(DWORD)0x00550009; /* dest = (NOT dest)               */
  65const auto BLACKNESS           = cast(DWORD)0x00000042; /* dest = BLACK                    */
  66const auto WHITENESS           = cast(DWORD)0x00FF0062; /* dest = WHITE                    */
  67
  68const auto NOMIRRORBITMAP      = cast(DWORD)0x80000000; /* Do not Mirror the bitmap in this call */
  69const auto CAPTUREBLT          = cast(DWORD)0x40000000; /* Include layered windows */
  70
  71/* Quaternary raster codes */
  72template MAKEROP4(uint fore, uint back) {
  73	const uint MAKEROP4 = cast(uint)((((back) << 8) & 0xFF000000) | (fore));
  74}
  75
  76const auto GDI_ERROR = (0xFFFFFFFFL);
  77
  78const auto HGDI_ERROR = cast(HANDLE)(-1);
  79
  80/* Region Flags */
  81const auto ERROR				= 0;
  82const auto NULLREGION			= 1;
  83const auto SIMPLEREGION			= 2;
  84const auto COMPLEXREGION		= 3;
  85const auto RGN_ERROR 			= ERROR;
  86
  87/* CombineRgn() Styles */
  88const auto RGN_AND             = 1;
  89const auto RGN_OR              = 2;
  90const auto RGN_XOR             = 3;
  91const auto RGN_DIFF            = 4;
  92const auto RGN_COPY            = 5;
  93const auto RGN_MIN             = RGN_AND;
  94const auto RGN_MAX             = RGN_COPY;
  95
  96/* StretchBlt() Modes */
  97const auto BLACKONWHITE                 = 1;
  98const auto WHITEONBLACK                 = 2;
  99const auto COLORONCOLOR                 = 3;
 100const auto HALFTONE                     = 4;
 101const auto MAXSTRETCHBLTMODE            = 4;
 102
 103/* New StretchBlt() Modes */
 104const auto STRETCH_ANDSCANS    = BLACKONWHITE;
 105const auto STRETCH_ORSCANS     = WHITEONBLACK;
 106const auto STRETCH_DELETESCANS = COLORONCOLOR;
 107const auto STRETCH_HALFTONE    = HALFTONE;
 108
 109/* PolyFill() Modes */
 110const auto ALTERNATE                    = 1;
 111const auto WINDING                      = 2;
 112const auto POLYFILL_LAST                = 2;
 113
 114/* Layout Orientation Options */
 115const auto LAYOUT_RTL                         = 0x00000001; // Right to left
 116const auto LAYOUT_BTT                         = 0x00000002; // Bottom to top
 117const auto LAYOUT_VBH                         = 0x00000004; // Vertical before horizontal
 118const auto LAYOUT_ORIENTATIONMASK             = (LAYOUT_RTL | LAYOUT_BTT | LAYOUT_VBH);
 119const auto LAYOUT_BITMAPORIENTATIONPRESERVED  = 0x00000008;
 120
 121/* Text Alignment Options */
 122const auto TA_NOUPDATECP                = 0;
 123const auto TA_UPDATECP                  = 1;
 124
 125const auto TA_LEFT                      = 0;
 126const auto TA_RIGHT                     = 2;
 127const auto TA_CENTER                    = 6;
 128
 129const auto TA_TOP                       = 0;
 130const auto TA_BOTTOM                    = 8;
 131const auto TA_BASELINE                  = 24;
 132
 133const auto TA_RTLREADING                = 256;
 134const auto TA_MASK       = (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING);
 135
 136const auto VTA_BASELINE = TA_BASELINE;
 137const auto VTA_LEFT     = TA_BOTTOM;
 138const auto VTA_RIGHT    = TA_TOP;
 139const auto VTA_CENTER   = TA_CENTER;
 140const auto VTA_BOTTOM   = TA_RIGHT;
 141const auto VTA_TOP      = TA_LEFT;
 142
 143const auto ETO_OPAQUE                   = 0x0002;
 144const auto ETO_CLIPPED                  = 0x0004;
 145
 146const auto ETO_GLYPH_INDEX              = 0x0010;
 147const auto ETO_RTLREADING               = 0x0080;
 148const auto ETO_NUMERICSLOCAL            = 0x0400;
 149const auto ETO_NUMERICSLATIN            = 0x0800;
 150const auto ETO_IGNORELANGUAGE           = 0x1000;
 151
 152const auto ETO_PDY                      = 0x2000;
 153const auto ETO_REVERSE_INDEX_MAP        = 0x10000;
 154
 155const auto ASPECT_FILTERING             = 0x0001;
 156
 157/* Bounds Accumulation APIs */
 158
 159const auto DCB_RESET       = 0x0001;
 160const auto DCB_ACCUMULATE  = 0x0002;
 161const auto DCB_DIRTY       = DCB_ACCUMULATE;
 162const auto DCB_SET         = (DCB_RESET | DCB_ACCUMULATE);
 163const auto DCB_ENABLE      = 0x0004;
 164const auto DCB_DISABLE     = 0x0008;
 165
 166/* Metafile Functions */
 167const auto META_SETBKCOLOR              = 0x0201;
 168const auto META_SETBKMODE               = 0x0102;
 169const auto META_SETMAPMODE              = 0x0103;
 170const auto META_SETROP2                 = 0x0104;
 171const auto META_SETRELABS               = 0x0105;
 172const auto META_SETPOLYFILLMODE         = 0x0106;
 173const auto META_SETSTRETCHBLTMODE       = 0x0107;
 174const auto META_SETTEXTCHAREXTRA        = 0x0108;
 175const auto META_SETTEXTCOLOR            = 0x0209;
 176const auto META_SETTEXTJUSTIFICATION    = 0x020A;
 177const auto META_SETWINDOWORG            = 0x020B;
 178const auto META_SETWINDOWEXT            = 0x020C;
 179const auto META_SETVIEWPORTORG          = 0x020D;
 180const auto META_SETVIEWPORTEXT          = 0x020E;
 181const auto META_OFFSETWINDOWORG         = 0x020F;
 182const auto META_SCALEWINDOWEXT          = 0x0410;
 183const auto META_OFFSETVIEWPORTORG       = 0x0211;
 184const auto META_SCALEVIEWPORTEXT        = 0x0412;
 185const auto META_LINETO                  = 0x0213;
 186const auto META_MOVETO                  = 0x0214;
 187const auto META_EXCLUDECLIPRECT         = 0x0415;
 188const auto META_INTERSECTCLIPRECT       = 0x0416;
 189const auto META_ARC                     = 0x0817;
 190const auto META_ELLIPSE                 = 0x0418;
 191const auto META_FLOODFILL               = 0x0419;
 192const auto META_PIE                     = 0x081A;
 193const auto META_RECTANGLE               = 0x041B;
 194const auto META_ROUNDRECT               = 0x061C;
 195const auto META_PATBLT                  = 0x061D;
 196const auto META_SAVEDC                  = 0x001E;
 197const auto META_SETPIXEL                = 0x041F;
 198const auto META_OFFSETCLIPRGN           = 0x0220;
 199const auto META_TEXTOUT                 = 0x0521;
 200const auto META_BITBLT                  = 0x0922;
 201const auto META_STRETCHBLT              = 0x0B23;
 202const auto META_POLYGON                 = 0x0324;
 203const auto META_POLYLINE                = 0x0325;
 204const auto META_ESCAPE                  = 0x0626;
 205const auto META_RESTOREDC               = 0x0127;
 206const auto META_FILLREGION              = 0x0228;
 207const auto META_FRAMEREGION             = 0x0429;
 208const auto META_INVERTREGION            = 0x012A;
 209const auto META_PAINTREGION             = 0x012B;
 210const auto META_SELECTCLIPREGION        = 0x012C;
 211const auto META_SELECTOBJECT            = 0x012D;
 212const auto META_SETTEXTALIGN            = 0x012E;
 213const auto META_CHORD                   = 0x0830;
 214const auto META_SETMAPPERFLAGS          = 0x0231;
 215const auto META_EXTTEXTOUT              = 0x0a32;
 216const auto META_SETDIBTODEV             = 0x0d33;
 217const auto META_SELECTPALETTE           = 0x0234;
 218const auto META_REALIZEPALETTE          = 0x0035;
 219const auto META_ANIMATEPALETTE          = 0x0436;
 220const auto META_SETPALENTRIES           = 0x0037;
 221const auto META_POLYPOLYGON             = 0x0538;
 222const auto META_RESIZEPALETTE           = 0x0139;
 223const auto META_DIBBITBLT               = 0x0940;
 224const auto META_DIBSTRETCHBLT           = 0x0b41;
 225const auto META_DIBCREATEPATTERNBRUSH   = 0x0142;
 226const auto META_STRETCHDIB              = 0x0f43;
 227const auto META_EXTFLOODFILL            = 0x0548;
 228
 229const auto META_SETLAYOUT               = 0x0149;
 230
 231const auto META_DELETEOBJECT            = 0x01f0;
 232const auto META_CREATEPALETTE           = 0x00f7;
 233const auto META_CREATEPATTERNBRUSH      = 0x01F9;
 234const auto META_CREATEPENINDIRECT       = 0x02FA;
 235const auto META_CREATEFONTINDIRECT      = 0x02FB;
 236const auto META_CREATEBRUSHINDIRECT     = 0x02FC;
 237const auto META_CREATEREGION            = 0x06FF;
 238
 239struct DRAWPATRECT {
 240	POINT ptPosition;
 241	POINT ptSize;
 242	WORD wStyle;
 243	WORD wPattern;
 244}
 245
 246typedef DRAWPATRECT* PDRAWPATRECT;
 247
 248/* GDI Escapes */
 249const auto NEWFRAME                     = 1;
 250const auto ABORTDOC                     = 2;
 251const auto NEXTBAND                     = 3;
 252const auto SETCOLORTABLE                = 4;
 253const auto GETCOLORTABLE                = 5;
 254const auto FLUSHOUTPUT                  = 6;
 255const auto DRAFTMODE                    = 7;
 256const auto QUERYESCSUPPORT              = 8;
 257const auto SETABORTPROC                 = 9;
 258const auto STARTDOC                     = 10;
 259const auto ENDDOC                       = 11;
 260const auto GETPHYSPAGESIZE              = 12;
 261const auto GETPRINTINGOFFSET            = 13;
 262const auto GETSCALINGFACTOR             = 14;
 263const auto MFCOMMENT                    = 15;
 264const auto GETPENWIDTH                  = 16;
 265const auto SETCOPYCOUNT                 = 17;
 266const auto SELECTPAPERSOURCE            = 18;
 267const auto DEVICEDATA                   = 19;
 268const auto PASSTHROUGH                  = 19;
 269const auto GETTECHNOLGY                 = 20;
 270const auto GETTECHNOLOGY                = 20;
 271const auto SETLINECAP                   = 21;
 272const auto SETLINEJOIN                  = 22;
 273const auto SETMITERLIMIT                = 23;
 274const auto BANDINFO                     = 24;
 275const auto DRAWPATTERNRECT              = 25;
 276const auto GETVECTORPENSIZE             = 26;
 277const auto GETVECTORBRUSHSIZE           = 27;
 278const auto ENABLEDUPLEX                 = 28;
 279const auto GETSETPAPERBINS              = 29;
 280const auto GETSETPRINTORIENT            = 30;
 281const auto ENUMPAPERBINS                = 31;
 282const auto SETDIBSCALING                = 32;
 283const auto EPSPRINTING                  = 33;
 284const auto ENUMPAPERMETRICS             = 34;
 285const auto GETSETPAPERMETRICS           = 35;
 286const auto POSTSCRIPT_DATA              = 37;
 287const auto POSTSCRIPT_IGNORE            = 38;
 288const auto MOUSETRAILS                  = 39;
 289const auto GETDEVICEUNITS               = 42;
 290
 291const auto GETEXTENDEDTEXTMETRICS       = 256;
 292const auto GETEXTENTTABLE               = 257;
 293const auto GETPAIRKERNTABLE             = 258;
 294const auto GETTRACKKERNTABLE            = 259;
 295const auto EXTTEXTOUT                   = 512;
 296const auto GETFACENAME                  = 513;
 297const auto DOWNLOADFACE                 = 514;
 298const auto ENABLERELATIVEWIDTHS         = 768;
 299const auto ENABLEPAIRKERNING            = 769;
 300const auto SETKERNTRACK                 = 770;
 301const auto SETALLJUSTVALUES             = 771;
 302const auto SETCHARSET                   = 772;
 303
 304const auto STRETCHBLT                   = 2048;
 305const auto METAFILE_DRIVER              = 2049;
 306const auto GETSETSCREENPARAMS           = 3072;
 307const auto QUERYDIBSUPPORT              = 3073;
 308const auto BEGIN_PATH                   = 4096;
 309const auto CLIP_TO_PATH                 = 4097;
 310const auto END_PATH                     = 4098;
 311const auto EXT_DEVICE_CAPS              = 4099;
 312const auto RESTORE_CTM                  = 4100;
 313const auto SAVE_CTM                     = 4101;
 314const auto SET_ARC_DIRECTION            = 4102;
 315const auto SET_BACKGROUND_COLOR         = 4103;
 316const auto SET_POLY_MODE                = 4104;
 317const auto SET_SCREEN_ANGLE             = 4105;
 318const auto SET_SPREAD                   = 4106;
 319const auto TRANSFORM_CTM                = 4107;
 320const auto SET_CLIP_BOX                 = 4108;
 321const auto SET_BOUNDS                   = 4109;
 322const auto SET_MIRROR_MODE              = 4110;
 323const auto OPENCHANNEL                  = 4110;
 324const auto DOWNLOADHEADER               = 4111;
 325const auto CLOSECHANNEL                 = 4112;
 326const auto POSTSCRIPT_PASSTHROUGH       = 4115;
 327const auto ENCAPSULATED_POSTSCRIPT      = 4116;
 328
 329const auto POSTSCRIPT_IDENTIFY          = 4117;   /* new escape for NT5 pscript driver */
 330const auto POSTSCRIPT_INJECTION         = 4118;   /* new escape for NT5 pscript driver */
 331
 332const auto CHECKJPEGFORMAT              = 4119;
 333const auto CHECKPNGFORMAT               = 4120;
 334
 335const auto GET_PS_FEATURESETTING        = 4121;   /* new escape for NT5 pscript driver */
 336
 337const auto GDIPLUS_TS_QUERYVER          = 4122;   /* private escape */
 338const auto GDIPLUS_TS_RECORD            = 4123;   /* private escape */
 339
 340/*
 341 * Return Values for MILCORE_TS_QUERYVER
 342 */
 343
 344const auto MILCORE_TS_QUERYVER_RESULT_FALSE = 0x0;
 345const auto MILCORE_TS_QUERYVER_RESULT_TRUE  = 0x7FFFFFFF;
 346
 347const auto SPCLPASSTHROUGH2             = 4568;   /* new escape for NT5 pscript driver */
 348
 349/*
 350 * Parameters for POSTSCRIPT_IDENTIFY escape
 351 */
 352
 353const auto PSIDENT_GDICENTRIC    = 0;
 354const auto PSIDENT_PSCENTRIC     = 1;
 355
 356/*
 357 * Header structure for the input buffer to POSTSCRIPT_INJECTION escape
 358 */
 359
 360struct PSINJECTDATA {
 361
 362    DWORD   DataBytes;      /* number of raw data bytes (NOT including this header) */
 363    WORD    InjectionPoint; /* injection point */
 364    WORD    PageNumber;     /* page number to apply the injection */
 365
 366    /* Followed by raw data to be injected */
 367
 368}
 369
 370typedef PSINJECTDATA* PPSINJECTDATA;
 371
 372/*
 373 * Constants for PSINJECTDATA.InjectionPoint field
 374 */
 375
 376const auto PSINJECT_BEGINSTREAM                = 1;
 377const auto PSINJECT_PSADOBE                    = 2;
 378const auto PSINJECT_PAGESATEND                 = 3;
 379const auto PSINJECT_PAGES                      = 4;
 380
 381const auto PSINJECT_DOCNEEDEDRES               = 5;
 382const auto PSINJECT_DOCSUPPLIEDRES             = 6;
 383const auto PSINJECT_PAGEORDER                  = 7;
 384const auto PSINJECT_ORIENTATION                = 8;
 385const auto PSINJECT_BOUNDINGBOX                = 9;
 386const auto PSINJECT_DOCUMENTPROCESSCOLORS      = 10;
 387
 388const auto PSINJECT_COMMENTS                   = 11;
 389const auto PSINJECT_BEGINDEFAULTS              = 12;
 390const auto PSINJECT_ENDDEFAULTS                = 13;
 391const auto PSINJECT_BEGINPROLOG                = 14;
 392const auto PSINJECT_ENDPROLOG                  = 15;
 393const auto PSINJECT_BEGINSETUP                 = 16;
 394const auto PSINJECT_ENDSETUP                   = 17;
 395const auto PSINJECT_TRAILER                    = 18;
 396const auto PSINJECT_EOF                        = 19;
 397const auto PSINJECT_ENDSTREAM                  = 20;
 398const auto PSINJECT_DOCUMENTPROCESSCOLORSATEND = 21;
 399
 400const auto PSINJECT_PAGENUMBER                 = 100;
 401const auto PSINJECT_BEGINPAGESETUP             = 101;
 402const auto PSINJECT_ENDPAGESETUP               = 102;
 403const auto PSINJECT_PAGETRAILER                = 103;
 404const auto PSINJECT_PLATECOLOR                 = 104;
 405
 406const auto PSINJECT_SHOWPAGE                   = 105;
 407const auto PSINJECT_PAGEBBOX                   = 106;
 408const auto PSINJECT_ENDPAGECOMMENTS            = 107;
 409
 410const auto PSINJECT_VMSAVE                     = 200;
 411const auto PSINJECT_VMRESTORE                  = 201;
 412
 413/*
 414 * Parameter for GET_PS_FEATURESETTING escape
 415 */
 416
 417const auto FEATURESETTING_NUP                  = 0;
 418const auto FEATURESETTING_OUTPUT               = 1;
 419const auto FEATURESETTING_PSLEVEL              = 2;
 420const auto FEATURESETTING_CUSTPAPER            = 3;
 421const auto FEATURESETTING_MIRROR               = 4;
 422const auto FEATURESETTING_NEGATIVE             = 5;
 423const auto FEATURESETTING_PROTOCOL             = 6;
 424
 425//
 426// The range of selectors between FEATURESETTING_PRIVATE_BEGIN and
 427// FEATURESETTING_PRIVATE_END is reserved by Microsoft for private use
 428//
 429const auto FEATURESETTING_PRIVATE_BEGIN = 0x1000;
 430const auto FEATURESETTING_PRIVATE_END   = 0x1FFF;
 431
 432/*
 433 * Information about output options
 434 */
 435
 436struct PSFEATURE_OUTPUT {
 437    BOOL bPageIndependent;
 438    BOOL bSetPageDevice;
 439}
 440
 441typedef PSFEATURE_OUTPUT* PPSFEATURE_OUTPUT;
 442
 443/*
 444 * Information about custom paper size
 445 */
 446
 447struct PSFEATURE_CUSTPAPER {
 448	LONG lOrientation;
 449	LONG lWidth;
 450	LONG lHeight;
 451	LONG lWidthOffset;
 452	LONG lHeightOffset;
 453
 454}
 455
 456typedef PSFEATURE_CUSTPAPER* PPSFEATURE_CUSTPAPER;
 457
 458/* Value returned for FEATURESETTING_PROTOCOL */
 459const auto PSPROTOCOL_ASCII             = 0;
 460const auto PSPROTOCOL_BCP               = 1;
 461const auto PSPROTOCOL_TBCP              = 2;
 462const auto PSPROTOCOL_BINARY            = 3;
 463
 464/* Flag returned from QUERYDIBSUPPORT */
 465const auto QDI_SETDIBITS                = 1;
 466const auto QDI_GETDIBITS                = 2;
 467const auto QDI_DIBTOSCREEN              = 4;
 468const auto QDI_STRETCHDIB               = 8;
 469
 470/* Spooler Error Codes */
 471const auto SP_NOTREPORTED               = 0x4000;
 472const auto SP_ERROR                     = (-1);
 473const auto SP_APPABORT                  = (-2);
 474const auto SP_USERABORT                 = (-3);
 475const auto SP_OUTOFDISK                 = (-4);
 476const auto SP_OUTOFMEMORY               = (-5);
 477
 478const auto PR_JOBSTATUS                 = 0x0000;
 479
 480/* Object Definitions for EnumObjects() */
 481const auto OBJ_PEN             = 1;
 482const auto OBJ_BRUSH           = 2;
 483const auto OBJ_DC              = 3;
 484const auto OBJ_METADC          = 4;
 485const auto OBJ_PAL             = 5;
 486const auto OBJ_FONT            = 6;
 487const auto OBJ_BITMAP          = 7;
 488const auto OBJ_REGION          = 8;
 489const auto OBJ_METAFILE        = 9;
 490const auto OBJ_MEMDC           = 10;
 491const auto OBJ_EXTPEN          = 11;
 492const auto OBJ_ENHMETADC       = 12;
 493const auto OBJ_ENHMETAFILE     = 13;
 494const auto OBJ_COLORSPACE      = 14;
 495
 496const auto GDI_OBJ_LAST        = OBJ_COLORSPACE;
 497
 498/* xform stuff */
 499const auto MWT_IDENTITY        = 1;
 500const auto MWT_LEFTMULTIPLY    = 2;
 501const auto MWT_RIGHTMULTIPLY   = 3;
 502
 503const auto MWT_MIN             = MWT_IDENTITY;
 504const auto MWT_MAX             = MWT_RIGHTMULTIPLY;
 505
 506const auto _XFORM_ = 0;
 507struct XFORM {
 508	FLOAT   eM11;
 509	FLOAT   eM12;
 510	FLOAT   eM21;
 511	FLOAT   eM22;
 512	FLOAT   eDx;
 513	FLOAT   eDy;
 514}
 515
 516typedef XFORM* PXFORM;
 517typedef XFORM* LPXFORM;
 518
 519/* Bitmap Header Definition */
 520struct BITMAP {
 521	LONG        bmType;
 522	LONG        bmWidth;
 523	LONG        bmHeight;
 524	LONG        bmWidthBytes;
 525	WORD        bmPlanes;
 526	WORD        bmBitsPixel;
 527	LPVOID      bmBits;
 528}
 529
 530typedef BITMAP* PBITMAP;
 531typedef BITMAP* NPBITMAP;
 532typedef BITMAP* LPBITMAP;
 533
 534align(1) struct RGBTRIPLE {
 535	BYTE    rgbtBlue;
 536	BYTE    rgbtGreen;
 537	BYTE    rgbtRed;
 538} 
 539
 540typedef RGBTRIPLE* PRGBTRIPLE;
 541typedef RGBTRIPLE* NPRGBTRIPLE;
 542typedef RGBTRIPLE* LPRGBTRIPLE;
 543
 544struct RGBQUAD {
 545	BYTE    rgbBlue;
 546	BYTE    rgbGreen;
 547	BYTE    rgbRed;
 548	BYTE    rgbReserved;
 549}
 550typedef RGBQUAD* LPRGBQUAD;
 551
 552/* Image Color Matching color definitions */
 553
 554const auto CS_ENABLE                       = 0x00000001;
 555const auto CS_DISABLE                      = 0x00000002;
 556const auto CS_DELETE_TRANSFORM             = 0x00000003;
 557
 558/* Logcolorspace signature */
 559
 560const auto LCS_SIGNATURE           = "PSOC"c;
 561
 562/* Logcolorspace lcsType values */
 563
 564const auto LCS_sRGB                = "sRGB"c;
 565const auto LCS_WINDOWS_COLOR_SPACE = "Win "c;  // Windows default color space
 566
 567typedef LONG LCSCSTYPE;
 568const auto LCS_CALIBRATED_RGB              = 0x00000000;
 569
 570typedef LONG LCSGAMUTMATCH;
 571const auto LCS_GM_BUSINESS                 = 0x00000001;
 572const auto LCS_GM_GRAPHICS                 = 0x00000002;
 573const auto LCS_GM_IMAGES                   = 0x00000004;
 574const auto LCS_GM_ABS_COLORIMETRIC         = 0x00000008;
 575
 576/* ICM Defines for results from CheckColorInGamut() */
 577const auto CM_OUT_OF_GAMUT                 = 255;
 578const auto CM_IN_GAMUT                     = 0;
 579
 580/* UpdateICMRegKey Constants               */
 581const auto ICM_ADDPROFILE                  = 1;
 582const auto ICM_DELETEPROFILE               = 2;
 583const auto ICM_QUERYPROFILE                = 3;
 584const auto ICM_SETDEFAULTPROFILE           = 4;
 585const auto ICM_REGISTERICMATCHER           = 5;
 586const auto ICM_UNREGISTERICMATCHER         = 6;
 587const auto ICM_QUERYMATCH                  = 7;
 588
 589/* Macros to retrieve CMYK values from a COLORREF */
 590template GetKValue(COLORREF cmyk) {
 591	const BYTE GetKValue = cast(BYTE)(cmyk);
 592}
 593
 594template GetYValue(COLORREF cmyk) {
 595	const BYTE GetYValue = cast(BYTE)(cmyk >> 8);
 596}
 597
 598template GetYValue(COLORREF cmyk) {
 599	const BYTE GetMValue = cast(BYTE)(cmyk >> 16);
 600}
 601
 602template GetYValue(COLORREF cmyk) {
 603	const BYTE GetCValue = cast(BYTE)(cmyk >> 24);
 604}
 605
 606template CMYK(BYTE c, BYTE m, BYTE y, BYTE k) {
 607	const COLORREF CMYK = cast(COLORREF)(cast(uint)k | (cast(uint)y) << 8 | (cast(uint)m) << 16 | (cast(uint)c) << 24);
 608}
 609
 610typedef Clong_t FXPT16DOT16;
 611typedef Clong_t* LPFXPT16DOT16;
 612typedef Clong_t FXPT2DOT30;
 613typedef Clong_t* LPFXPT2DOT30;
 614
 615/* ICM Color Definitions */
 616// The following two structures are used for defining RGB's in terms of CIEXYZ.
 617
 618struct CIEXYZ {
 619	FXPT2DOT30 ciexyzX;
 620	FXPT2DOT30 ciexyzY;
 621	FXPT2DOT30 ciexyzZ;
 622}
 623
 624typedef CIEXYZ* LPCIEXYZ;
 625
 626struct CIEXYZTRIPLE {
 627	CIEXYZ  ciexyzRed;
 628	CIEXYZ  ciexyzGreen;
 629	CIEXYZ  ciexyzBlue;
 630}
 631
 632typedef CIEXYZTRIPLE* LPCIEXYZTRIPLE;
 633
 634// The next structures the logical color space. Unlike pens and brushes,
 635// but like palettes, there is only one way to create a LogColorSpace.
 636// A pointer to it must be passed, its elements can't be pushed as
 637// arguments.
 638
 639struct LOGCOLORSPACEA {
 640	DWORD lcsSignature;
 641	DWORD lcsVersion;
 642    DWORD lcsSize;
 643    LCSCSTYPE lcsCSType;
 644    LCSGAMUTMATCH lcsIntent;
 645    CIEXYZTRIPLE lcsEndpoints;
 646    DWORD lcsGammaRed;
 647    DWORD lcsGammaGreen;
 648    DWORD lcsGammaBlue;
 649    CHAR   lcsFilename[MAX_PATH];
 650}
 651
 652typedef LOGCOLORSPACEA* LPLOGCOLORSPACEA;
 653
 654struct LOGCOLORSPACEW {
 655    DWORD lcsSignature;
 656    DWORD lcsVersion;
 657    DWORD lcsSize;
 658    LCSCSTYPE lcsCSType;
 659    LCSGAMUTMATCH lcsIntent;
 660    CIEXYZTRIPLE lcsEndpoints;
 661    DWORD lcsGammaRed;
 662    DWORD lcsGammaGreen;
 663    DWORD lcsGammaBlue;
 664    WCHAR  lcsFilename[MAX_PATH];
 665}
 666
 667typedef LOGCOLORSPACEW* LPLOGCOLORSPACEW;
 668
 669version(UNICODE) {
 670	typedef LOGCOLORSPACEW LOGCOLORSPACE;
 671	typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE;
 672}
 673else {
 674	typedef LOGCOLORSPACEA LOGCOLORSPACE;
 675	typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE;
 676}
 677
 678/* structures for defining DIBs */
 679struct BITMAPCOREHEADER {
 680	DWORD   bcSize;                 /* used to get to color table */
 681	WORD    bcWidth;
 682	WORD    bcHeight;
 683	WORD    bcPlanes;
 684	WORD    bcBitCount;
 685} 
 686
 687typedef BITMAPCOREHEADER* LPBITMAPCOREHEADER;
 688typedef BITMAPCOREHEADER* PBITMAPCOREHEADER;
 689
 690struct BITMAPINFOHEADER{
 691	DWORD      biSize;
 692	LONG       biWidth;
 693	LONG       biHeight;
 694	WORD       biPlanes;
 695	WORD       biBitCount;
 696	DWORD      biCompression;
 697	DWORD      biSizeImage;
 698	LONG       biXPelsPerMeter;
 699	LONG       biYPelsPerMeter;
 700	DWORD      biClrUsed;
 701	DWORD      biClrImportant;
 702} 
 703
 704typedef BITMAPINFOHEADER* LPBITMAPINFOHEADER;
 705typedef BITMAPINFOHEADER* PBITMAPINFOHEADER;
 706
 707struct BITMAPV4HEADER {
 708	DWORD        bV4Size;
 709	LONG         bV4Width;
 710	LONG         bV4Height;
 711	WORD         bV4Planes;
 712	WORD         bV4BitCount;
 713	DWORD        bV4V4Compression;
 714	DWORD        bV4SizeImage;
 715	LONG         bV4XPelsPerMeter;
 716	LONG         bV4YPelsPerMeter;
 717	DWORD        bV4ClrUsed;
 718	DWORD        bV4ClrImportant;
 719	DWORD        bV4RedMask;
 720	DWORD        bV4GreenMask;
 721	DWORD        bV4BlueMask;
 722	DWORD        bV4AlphaMask;
 723	DWORD        bV4CSType;
 724	CIEXYZTRIPLE bV4Endpoints;
 725	DWORD        bV4GammaRed;
 726	DWORD        bV4GammaGreen;
 727	DWORD        bV4GammaBlue;
 728}
 729
 730typedef BITMAPV4HEADER* LPBITMAPV4HEADER;
 731typedef BITMAPV4HEADER* PBITMAPV4HEADER;
 732
 733struct BITMAPV5HEADER {
 734	DWORD        bV5Size;
 735	LONG         bV5Width;
 736	LONG         bV5Height;
 737	WORD         bV5Planes;
 738	WORD         bV5BitCount;
 739	DWORD        bV5Compression;
 740	DWORD        bV5SizeImage;
 741	LONG         bV5XPelsPerMeter;
 742	LONG         bV5YPelsPerMeter;
 743	DWORD        bV5ClrUsed;
 744	DWORD        bV5ClrImportant;
 745	DWORD        bV5RedMask;
 746	DWORD        bV5GreenMask;
 747	DWORD        bV5BlueMask;
 748	DWORD        bV5AlphaMask;
 749	DWORD        bV5CSType;
 750	CIEXYZTRIPLE bV5Endpoints;
 751	DWORD        bV5GammaRed;
 752	DWORD        bV5GammaGreen;
 753	DWORD        bV5GammaBlue;
 754	DWORD        bV5Intent;
 755	DWORD        bV5ProfileData;
 756	DWORD        bV5ProfileSize;
 757	DWORD        bV5Reserved;
 758}
 759
 760typedef BITMAPV5HEADER* LPBITMAPV5HEADER;
 761typedef BITMAPV5HEADER* PBITMAPV5HEADER;
 762
 763// Values for bV5CSType
 764const auto PROFILE_LINKED          = "LINK"c;
 765const auto PROFILE_EMBEDDED        = "MBED"c;
 766
 767/* constants for the biCompression field */
 768const auto BI_RGB        = 0;
 769const auto BI_RLE8       = 1;
 770const auto BI_RLE4       = 2;
 771const auto BI_BITFIELDS  = 3;
 772const auto BI_JPEG       = 4;
 773const auto BI_PNG        = 5;
 774
 775struct BITMAPINFO {
 776	BITMAPINFOHEADER    bmiHeader;
 777	RGBQUAD             bmiColors[1];
 778}
 779
 780typedef BITMAPINFO* LPBITMAPINFO;
 781typedef BITMAPINFO* PBITMAPINFO;
 782
 783struct BITMAPCOREINFO {
 784	BITMAPCOREHEADER    bmciHeader;
 785	RGBTRIPLE           bmciColors[1];
 786}
 787
 788typedef BITMAPCOREINFO* LPBITMAPCOREINFO;
 789typedef BITMAPCOREINFO* PBITMAPCOREINFO;
 790
 791align(2) struct BITMAPFILEHEADER {
 792	WORD    bfType;
 793	DWORD   bfSize;
 794	WORD    bfReserved1;
 795	WORD    bfReserved2;
 796	DWORD   bfOffBits;
 797}
 798typedef BITMAPFILEHEADER* LPBITMAPFILEHEADER;
 799typedef BITMAPFILEHEADER* PBITMAPFILEHEADER;
 800
 801POINTS* MAKEPOINTS(ref DWORD val) {
 802	return cast(POINTS*)(&val);
 803}
 804
 805struct FONTSIGNATURE {
 806	DWORD fsUsb[4];
 807	DWORD fsCsb[2];
 808}
 809
 810typedef FONTSIGNATURE* LPFONTSIGNATURE;
 811typedef FONTSIGNATURE* PFONTSIGNATURE;
 812
 813struct CHARSETINFO {
 814	UINT ciCharset;
 815	UINT ciACP;
 816	FONTSIGNATURE fs;
 817}
 818
 819typedef CHARSETINFO* NPCHARSETINFO;
 820typedef CHARSETINFO* LPCHARSETINFO;
 821typedef CHARSETINFO* PCHARSETINFO;
 822
 823const auto TCI_SRCCHARSET  = 1;
 824const auto TCI_SRCCODEPAGE = 2;
 825const auto TCI_SRCFONTSIG  = 3;
 826
 827const auto TCI_SRCLOCALE   = 0x1000;
 828
 829struct LOCALESIGNATURE {
 830	DWORD lsUsb[4];
 831	DWORD lsCsbDefault[2];
 832	DWORD lsCsbSupported[2];
 833}
 834
 835typedef LOCALESIGNATURE* LPLOCALESIGNATURE;
 836typedef LOCALESIGNATURE* PLOCALESIGNATURE;
 837
 838/* Clipboard Metafile Picture Structure */
 839struct HANDLETABLE {
 840	HGDIOBJ     objectHandle[1];
 841}
 842
 843typedef HANDLETABLE* PHANDLETABLE;
 844typedef HANDLETABLE* LPHANDLETABLE;
 845
 846struct METARECORD {
 847	DWORD       rdSize;
 848	WORD        rdFunction;
 849	WORD        rdParm[1];
 850}
 851typedef METARECORD* PMETARECORD;
 852typedef METARECORD* LPMETARECORD;
 853
 854struct METAFILEPICT {
 855	LONG        mm;
 856	LONG        xExt;
 857	LONG        yExt;
 858	HMETAFILE   hMF;
 859}
 860
 861typedef METAFILEPICT* LPMETAFILEPICT;
 862
 863align(2) struct METAHEADER {
 864	WORD        mtType;
 865	WORD        mtHeaderSize;
 866	WORD        mtVersion;
 867	DWORD       mtSize;
 868	WORD        mtNoObjects;
 869	DWORD       mtMaxRecord;
 870	WORD        mtNoParameters;
 871}
 872
 873typedef METAHEADER* PMETAHEADER;
 874typedef METAHEADER* LPMETAHEADER;
 875
 876/* Enhanced Metafile structures */
 877struct ENHMETARECORD {
 878	DWORD   iType;              // Record type EMR_XXX
 879	DWORD   nSize;              // Record size in bytes
 880	DWORD   dParm[1];           // Parameters
 881}
 882
 883typedef ENHMETARECORD* PENHMETARECORD;
 884typedef ENHMETARECORD* LPENHMETARECORD;
 885
 886struct ENHMETAHEADER {
 887	DWORD   iType;              // Record typeEMR_HEADER
 888	DWORD   nSize;              // Record size in bytes.  This may be greater
 889	                            // than the sizeof(ENHMETAHEADER).
 890	RECTL   rclBounds;          // Inclusive-inclusive bounds in device units
 891	RECTL   rclFrame;           // Inclusive-inclusive Picture Frame of metafile in .01 mm units
 892	DWORD   dSignature;         // Signature.  Must be ENHMETA_SIGNATURE.
 893	DWORD   nVersion;           // Version number
 894	DWORD   nBytes;             // Size of the metafile in bytes
 895	DWORD   nRecords;           // Number of records in the metafile
 896	WORD    nHandles;           // Number of handles in the handle table
 897	                            // Handle index zero is reserved.
 898	WORD    sReserved;          // Reserved.  Must be zero.
 899	DWORD   nDescription;       // Number of chars in the unicode description string
 900	                            // This is 0 if there is no description string
 901	DWORD   offDescription;     // Offset to the metafile description record.
 902	                            // This is 0 if there is no description string
 903	DWORD   nPalEntries;        // Number of entries in the metafile palette.
 904	SIZEL   szlDevice;          // Size of the reference device in pels
 905	SIZEL   szlMillimeters;     // Size of the reference device in millimeters
 906	DWORD   cbPixelFormat;      // Size of PIXELFORMATDESCRIPTOR information
 907	                            // This is 0 if no pixel format is set
 908	DWORD   offPixelFormat;     // Offset to PIXELFORMATDESCRIPTOR
 909	                            // This is 0 if no pixel format is set
 910	DWORD   bOpenGL;            // TRUE if OpenGL commands are present in
 911	                            // the metafile, otherwise FALSE
 912	SIZEL   szlMicrometers;     // Size of the reference device in micrometers
 913}
 914
 915typedef ENHMETAHEADER* PENHMETAHEADER;
 916typedef ENHMETAHEADER* LPENHMETAHEADER;
 917
 918/* tmPitchAndFamily flags */
 919const auto TMPF_FIXED_PITCH	= 0x01;
 920const auto TMPF_VECTOR		= 0x02;
 921const auto TMPF_DEVICE		= 0x08;
 922const auto TMPF_TRUETYPE	= 0x04;
 923
 924//
 925// BCHAR definition for APPs
 926//
 927version(UNICODE) {
 928	typedef WCHAR BCHAR;
 929}
 930else {
 931	typedef BYTE BCHAR;
 932}
 933
 934align(4) struct TEXTMETRICA {
 935    LONG        tmHeight;
 936    LONG        tmAscent;
 937    LONG        tmDescent;
 938    LONG        tmInternalLeading;
 939    LONG        tmExternalLeading;
 940    LONG        tmAveCharWidth;
 941    LONG        tmMaxCharWidth;
 942    LONG        tmWeight;
 943    LONG        tmOverhang;
 944    LONG        tmDigitizedAspectX;
 945    LONG        tmDigitizedAspectY;
 946    BYTE        tmFirstChar;
 947    BYTE        tmLastChar;
 948    BYTE        tmDefaultChar;
 949    BYTE        tmBreakChar;
 950    BYTE        tmItalic;
 951    BYTE        tmUnderlined;
 952    BYTE        tmStruckOut;
 953    BYTE        tmPitchAndFamily;
 954    BYTE        tmCharSet;
 955}
 956
 957typedef TEXTMETRICA* PTEXTMETRICA;
 958typedef TEXTMETRICA* NPTEXTMETRICA;
 959typedef TEXTMETRICA* LPTEXTMETRICA;
 960
 961align(4) struct TEXTMETRICW {
 962    LONG        tmHeight;
 963    LONG        tmAscent;
 964    LONG        tmDescent;
 965    LONG        tmInternalLeading;
 966    LONG        tmExternalLeading;
 967    LONG        tmAveCharWidth;
 968    LONG        tmMaxCharWidth;
 969    LONG        tmWeight;
 970    LONG        tmOverhang;
 971    LONG        tmDigitizedAspectX;
 972    LONG        tmDigitizedAspectY;
 973    WCHAR       tmFirstChar;
 974    WCHAR       tmLastChar;
 975    WCHAR       tmDefaultChar;
 976    WCHAR       tmBreakChar;
 977    BYTE        tmItalic;
 978    BYTE        tmUnderlined;
 979    BYTE        tmStruckOut;
 980    BYTE        tmPitchAndFamily;
 981    BYTE        tmCharSet;
 982}
 983
 984typedef TEXTMETRICW* PTEXTMETRICW;
 985typedef TEXTMETRICW* NPTEXTMETRICW;
 986typedef TEXTMETRICW* LPTEXTMETRICW;
 987
 988version(UNICODE) {
 989	typedef TEXTMETRICW TEXTMETRIC;
 990	typedef PTEXTMETRICW PTEXTMETRIC;
 991	typedef NPTEXTMETRICW NPTEXTMETRIC;
 992	typedef LPTEXTMETRICW LPTEXTMETRIC;
 993}
 994else {
 995	typedef TEXTMETRICA TEXTMETRIC;
 996	typedef PTEXTMETRICA PTEXTMETRIC;
 997	typedef NPTEXTMETRICA NPTEXTMETRIC;
 998	typedef LPTEXTMETRICA LPTEXTMETRIC;
 999}
1000
1001/* ntmFlags field flags */
1002const auto NTM_REGULAR     = 0x00000040;
1003const auto NTM_BOLD        = 0x00000020;
1004const auto NTM_ITALIC      = 0x00000001;
1005
1006/* new in NT 5.0 */
1007
1008const auto NTM_NONNEGATIVE_AC  = 0x00010000;
1009const auto NTM_PS_OPENTYPE     = 0x00020000;
1010const auto NTM_TT_OPENTYPE     = 0x00040000;
1011const auto NTM_MULTIPLEMASTER  = 0x00080000;
1012const auto NTM_TYPE1           = 0x00100000;
1013const auto NTM_DSIG            = 0x00200000;
1014
1015align(4) struct NEWTEXTMETRICA {
1016	LONG        tmHeight;
1017	LONG        tmAscent;
1018	LONG        tmDescent;
1019	LONG        tmInternalLeading;
1020	LONG        tmExternalLeading;
1021	LONG        tmAveCharWidth;
1022	LONG        tmMaxCharWidth;
1023	LONG        tmWeight;
1024	LONG        tmOverhang;
1025	LONG        tmDigitizedAspectX;
1026	LONG        tmDigitizedAspectY;
1027	BYTE        tmFirstChar;
1028	BYTE        tmLastChar;
1029	BYTE        tmDefaultChar;
1030	BYTE        tmBreakChar;
1031	BYTE        tmItalic;
1032	BYTE        tmUnderlined;
1033	BYTE        tmStruckOut;
1034	BYTE        tmPitchAndFamily;
1035	BYTE        tmCharSet;
1036	DWORD   ntmFlags;
1037	UINT    ntmSizeEM;
1038	UINT    ntmCellHeight;
1039	UINT    ntmAvgWidth;
1040}
1041
1042typedef NEWTEXTMETRICA* PNEWTEXTMETRICA;
1043typedef NEWTEXTMETRICA* NPNEWTEXTMETRICA;
1044typedef NEWTEXTMETRICA* LPNEWTEXTMETRICA;
1045
1046struct NEWTEXTMETRICW {
1047	LONG        tmHeight;
1048	LONG        tmAscent;
1049	LONG        tmDescent;
1050	LONG        tmInternalLeading;
1051	LONG        tmExternalLeading;
1052	LONG        tmAveCharWidth;
1053	LONG        tmMaxCharWidth;
1054	LONG        tmWeight;
1055	LONG        tmOverhang;
1056	LONG        tmDigitizedAspectX;
1057	LONG        tmDigitizedAspectY;
1058	WCHAR       tmFirstChar;
1059	WCHAR       tmLastChar;
1060	WCHAR       tmDefaultChar;
1061	WCHAR       tmBreakChar;
1062	BYTE        tmItalic;
1063	BYTE        tmUnderlined;
1064	BYTE        tmStruckOut;
1065	BYTE        tmPitchAndFamily;
1066	BYTE        tmCharSet;
1067	DWORD   ntmFlags;
1068	UINT    ntmSizeEM;
1069	UINT    ntmCellHeight;
1070	UINT    ntmAvgWidth;
1071}
1072
1073typedef NEWTEXTMETRICW* PNEWTEXTMETRICW;
1074typedef NEWTEXTMETRICW* NPNEWTEXTMETRICW;
1075typedef NEWTEXTMETRICW* LPNEWTEXTMETRICW;
1076
1077version(UNICODE) {
1078	typedef NEWTEXTMETRICW NEWTEXTMETRIC;
1079	typedef PNEWTEXTMETRICW PNEWTEXTMETRIC;
1080	typedef NPNEWTEXTMETRICW NPNEWTEXTMETRIC;
1081	typedef LPNEWTEXTMETRICW LPNEWTEXTMETRIC;
1082}
1083else {
1084	typedef NEWTEXTMETRICA NEWTEXTMETRIC;
1085	typedef PNEWTEXTMETRICA PNEWTEXTMETRIC;
1086	typedef NPNEWTEXTMETRICA NPNEWTEXTMETRIC;
1087	typedef LPNEWTEXTMETRICA LPNEWTEXTMETRIC;
1088}
1089
1090struct NEWTEXTMETRICEXA {
1091    NEWTEXTMETRICA  ntmTm;
1092    FONTSIGNATURE   ntmFontSig;
1093}
1094
1095struct NEWTEXTMETRICEXW {
1096    NEWTEXTMETRICW  ntmTm;
1097    FONTSIGNATURE   ntmFontSig;
1098}
1099
1100version(UNICODE) {
1101	typedef NEWTEXTMETRICEXW NEWTEXTMETRICEX;
1102}
1103else {
1104	typedef NEWTEXTMETRICEXA NEWTEXTMETRICEX;
1105}
1106
1107/* GDI Logical Objects: */
1108
1109/* Pel Array */
1110struct PELARRAY {
1111    LONG        paXCount;
1112    LONG        paYCount;
1113    LONG        paXExt;
1114    LONG        paYExt;
1115    BYTE        paRGBs;
1116}
1117
1118typedef PELARRAY* PPELARRAY;
1119typedef PELARRAY* NPPELARRAY;
1120typedef PELARRAY* LPPELARRAY;
1121
1122/* Logical Brush (or Pattern) */
1123struct LOGBRUSH {
1124    UINT        lbStyle;
1125    COLORREF    lbColor;
1126    ULONG_PTR    lbHatch;    // Sundown: lbHatch could hold a HANDLE
1127} 
1128
1129typedef LOGBRUSH* PLOGBRUSH;
1130typedef LOGBRUSH* NPLOGBRUSH;
1131typedef LOGBRUSH* LPLOGBRUSH;
1132
1133struct LOGBRUSH32 {
1134	UINT        lbStyle;
1135	COLORREF    lbColor;
1136	ULONG       lbHatch;
1137}
1138
1139typedef LOGBRUSH32* PLOGBRUSH32;
1140typedef LOGBRUSH32* NPLOGBRUSH32;
1141typedef LOGBRUSH32* LPLOGBRUSH32;
1142
1143typedef LOGBRUSH            PATTERN;
1144typedef PATTERN             *PPATTERN;
1145typedef PATTERN *NPPATTERN;
1146typedef PATTERN *LPPATTERN;
1147
1148/* Logical Pen */
1149struct LOGPEN {
1150	UINT        lopnStyle;
1151	POINT       lopnWidth;
1152	COLORREF    lopnColor;
1153}
1154
1155typedef LOGPEN* PLOGPEN;
1156typedef LOGPEN* NPLOGPEN;
1157typedef LOGPEN* LPLOGPEN;
1158
1159struct EXTLOGPEN {
1160	DWORD       elpPenStyle;
1161	DWORD       elpWidth;
1162	UINT        elpBrushStyle;
1163	COLORREF    elpColor;
1164	ULONG_PTR   elpHatch;     //Sundown: elpHatch could take a HANDLE
1165	DWORD       elpNumEntries;
1166	DWORD[1]    elpStyleEntry;
1167}
1168
1169typedef EXTLOGPEN* PEXTLOGPEN;
1170typedef EXTLOGPEN* NPEXTLOGPEN;
1171typedef EXTLOGPEN* LPEXTLOGPEN;
1172
1173struct PALETTEENTRY {
1174	BYTE        peRed;
1175	BYTE        peGreen;
1176	BYTE        peBlue;
1177	BYTE        peFlags;
1178}
1179
1180typedef PALETTEENTRY* PPALETTEENTRY;
1181typedef PALETTEENTRY* LPPALETTEENTRY;
1182
1183/* Logical Palette */
1184struct LOGPALETTE {
1185    WORD        palVersion;
1186    WORD        palNumEntries;
1187	PALETTEENTRY[1]        palPalEntry;
1188}
1189
1190typedef LOGPALETTE* PLOGPALETTE;
1191typedef LOGPALETTE* NPLOGPALETTE;
1192typedef LOGPALETTE* LPLOGPALETTE;
1193
1194/* Logical Font */
1195const auto LF_FACESIZE         = 32;
1196
1197struct LOGFONTA {
1198	LONG      lfHeight;
1199	LONG      lfWidth;
1200	LONG      lfEscapement;
1201	LONG      lfOrientation;
1202	LONG      lfWeight;
1203	BYTE      lfItalic;
1204	BYTE      lfUnderline;
1205	BYTE      lfStrikeOut;
1206	BYTE      lfCharSet;
1207	BYTE      lfOutPrecision;
1208	BYTE      lfClipPrecision;
1209	BYTE      lfQuality;
1210	BYTE      lfPitchAndFamily;
1211	CHAR      lfFaceName[LF_FACESIZE];
1212}
1213
1214typedef LOGFONTA* PLOGFONTA;
1215typedef LOGFONTA* NPLOGFONTA;
1216typedef LOGFONTA* LPLOGFONTA;
1217
1218struct LOGFONTW {
1219	LONG      lfHeight;
1220	LONG      lfWidth;
1221	LONG      lfEscapement;
1222	LONG      lfOrientation;
1223	LONG      lfWeight;
1224	BYTE      lfItalic;
1225	BYTE      lfUnderline;
1226	BYTE      lfStrikeOut;
1227	BYTE      lfCharSet;
1228	BYTE      lfOutPrecision;
1229	BYTE      lfClipPrecision;
1230	BYTE      lfQuality;
1231	BYTE      lfPitchAndFamily;
1232	WCHAR     lfFaceName[LF_FACESIZE];
1233}
1234
1235typedef LOGFONTW* PLOGFONTW;
1236typedef LOGFONTW* NPLOGFONTW;
1237typedef LOGFONTW* LPLOGFONTW;
1238
1239version(UNICODE) {
1240	typedef LOGFONTW LOGFONT;
1241	typedef PLOGFONTW PLOGFONT;
1242	typedef NPLOGFONTW NPLOGFONT;
1243	typedef LPLOGFONTW LPLOGFONT;
1244}
1245else {
1246	typedef LOGFONTA LOGFONT;
1247	typedef PLOGFONTA PLOGFONT;
1248	typedef NPLOGFONTA NPLOGFONT;
1249	typedef LPLOGFONTA LPLOGFONT;
1250}
1251
1252const auto LF_FULLFACESIZE     = 64;
1253
1254/* Structure passed to FONTENUMPROC */
1255struct ENUMLOGFONTA {
1256    LOGFONTA elfLogFont;
1257    BYTE     elfFullName[LF_FULLFACESIZE];
1258    BYTE     elfStyle[LF_FACESIZE];
1259}
1260
1261typedef ENUMLOGFONTA* LPENUMLOGFONTA;
1262
1263/* Structure passed to FONTENUMPROC */
1264struct ENUMLOGFONTW {
1265    LOGFONTW elfLogFont;
1266    WCHAR[LF_FULLFACESIZE]    elfFullName;
1267    WCHAR[LF_FACESIZE]    elfStyle;
1268}
1269
1270typedef ENUMLOGFONTW* LPENUMLOGFONTW;
1271
1272version(UNICODE) {
1273	typedef ENUMLOGFONTW ENUMLOGFONT;
1274	typedef LPENUMLOGFONTW LPENUMLOGFONT;
1275}
1276else {
1277	typedef ENUMLOGFONTA ENUMLOGFONT;
1278	typedef LPENUMLOGFONTA LPENUMLOGFONT;
1279}
1280
1281struct ENUMLOGFONTEXA {
1282    LOGFONTA    elfLogFont;
1283    BYTE        elfFullName[LF_FULLFACESIZE];
1284    BYTE        elfStyle[LF_FACESIZE];
1285    BYTE        elfScript[LF_FACESIZE];
1286}
1287
1288typedef ENUMLOGFONTEXA* LPENUMLOGFONTEXA;
1289
1290struct ENUMLOGFONTEXW {
1291    LOGFONTW    elfLogFont;
1292    WCHAR[LF_FULLFACESIZE]       elfFullName;
1293    WCHAR[LF_FACESIZE]       elfStyle;
1294    WCHAR[LF_FACESIZE]       elfScript;
1295}
1296
1297typedef ENUMLOGFONTEXW* LPENUMLOGFONTEXW;
1298
1299version(UNICODE) {
1300	typedef ENUMLOGFONTEXW ENUMLOGFONTEX;
1301	typedef LPENUMLOGFONTEXW LPENUMLOGFONTEX;
1302}
1303else {
1304	typedef ENUMLOGFONTEXA ENUMLOGFONTEX;
1305	typedef LPENUMLOGFONTEXA LPENUMLOGFONTEX;
1306}
1307
1308const auto OUT_DEFAULT_PRECIS          = 0;
1309const auto OUT_STRING_PRECIS           = 1;
1310const auto OUT_CHARACTER_PRECIS        = 2;
1311const auto OUT_STROKE_PRECIS           = 3;
1312const auto OUT_TT_PRECIS               = 4;
1313const auto OUT_DEVICE_PRECIS           = 5;
1314const auto OUT_RASTER_PRECIS           = 6;
1315const auto OUT_TT_ONLY_PRECIS          = 7;
1316const auto OUT_OUTLINE_PRECIS          = 8;
1317const auto OUT_SCREEN_OUTLINE_PRECIS   = 9;
1318const auto OUT_PS_ONLY_PRECIS          = 10;
1319
1320const auto CLIP_DEFAULT_PRECIS     = 0;
1321const auto CLIP_CHARACTER_PRECIS   = 1;
1322const auto CLIP_STROKE_PRECIS      = 2;
1323const auto CLIP_MASK               = 0xf;
1324const auto CLIP_LH_ANGLES          = (1<<4);
1325const auto CLIP_TT_ALWAYS          = (2<<4);
1326
1327const auto CLIP_DFA_DISABLE        = (4<<4);
1328
1329const auto CLIP_EMBEDDED           = (8<<4);
1330
1331const auto DEFAULT_QUALITY         = 0;
1332const auto DRAFT_QUALITY           = 1;
1333const auto PROOF_QUALITY           = 2;
1334
1335const auto NONANTIALIASED_QUALITY  = 3;
1336const auto ANTIALIASED_QUALITY     = 4;
1337
1338const auto CLEARTYPE_QUALITY         = 5;
1339const auto CLEARTYPE_NATURAL_QUALITY       = 6;
1340
1341const auto DEFAULT_PITCH           = 0;
1342const auto FIXED_PITCH             = 1;
1343const auto VARIABLE_PITCH          = 2;
1344
1345const auto MONO_FONT               = 8;
1346
1347const auto ANSI_CHARSET            = 0;
1348const auto DEFAULT_CHARSET         = 1;
1349const auto SYMBOL_CHARSET          = 2;
1350const auto SHIFTJIS_CHARSET        = 128;
1351const auto HANGEUL_CHARSET         = 129;
1352const auto HANGUL_CHARSET          = 129;
1353const auto GB2312_CHARSET          = 134;
1354const auto CHINESEBIG5_CHARSET     = 136;
1355const auto OEM_CHARSET             = 255;
1356
1357const auto JOHAB_CHARSET           = 130;
1358const auto HEBREW_CHARSET          = 177;
1359const auto ARABIC_CHARSET          = 178;
1360const auto GREEK_CHARSET           = 161;
1361const auto TURKISH_CHARSET         = 162;
1362const auto VIETNAMESE_CHARSET      = 163;
1363const auto THAI_CHARSET            = 222;
1364const auto EASTEUROPE_CHARSET      = 238;
1365const auto RUSSIAN_CHARSET         = 204;
1366
1367const auto MAC_CHARSET             = 77;
1368const auto BALTIC_CHARSET          = 186;
1369
1370const auto FS_LATIN1               = 0x00000001;
1371const auto FS_LATIN2               = 0x00000002;
1372const auto FS_CYRILLIC             = 0x00000004;
1373const auto FS_GREEK                = 0x00000008;
1374const auto FS_TURKISH              = 0x00000010;
1375const auto FS_HEBREW               = 0x00000020;
1376const auto FS_ARABIC               = 0x00000040;
1377const auto FS_BALTIC               = 0x00000080;
1378const auto FS_VIETNAMESE           = 0x00000100;
1379const auto FS_THAI                 = 0x00010000;
1380const auto FS_JISJAPAN             = 0x00020000;
1381const auto FS_CHINESESIMP          = 0x00040000;
1382const auto FS_WANSUNG              = 0x00080000;
1383const auto FS_CHINESETRAD          = 0x00100000;
1384const auto FS_JOHAB                = 0x00200000;
1385const auto FS_SYMBOL               = 0x80000000;
1386
1387/* Font Families */
1388const auto FF_DONTCARE         = (0<<4);  /* Don't care or don't know. */
1389const auto FF_ROMAN            = (1<<4);  /* Variable stroke width, serifed. */
1390                                    /* Times Roman, Century Schoolbook, etc. */
1391const auto FF_SWISS            = (2<<4);  /* Variable stroke width, sans-serifed. */
1392                                    /* Helvetica, Swiss, etc. */
1393const auto FF_MODERN           = (3<<4);  /* Constant stroke width, serifed or sans-serifed. */
1394                                    /* Pica, Elite, Courier, etc. */
1395const auto FF_SCRIPT           = (4<<4);  /* Cursive, etc. */
1396const auto FF_DECORATIVE       = (5<<4);  /* Old English, etc. */
1397
1398/* Font Weights */
1399const auto FW_DONTCARE         = 0;
1400const auto FW_THIN             = 100;
1401const auto FW_EXTRALIGHT       = 200;
1402const auto FW_LIGHT            = 300;
1403const auto FW_NORMAL           = 400;
1404const auto FW_MEDIUM           = 500;
1405const auto FW_SEMIBOLD         = 600;
1406const auto FW_BOLD             = 700;
1407const auto FW_EXTRABOLD        = 800;
1408const auto FW_HEAVY            = 900;
1409
1410const auto FW_ULTRALIGHT       = FW_EXTRALIGHT;
1411const auto FW_REGULAR          = FW_NORMAL;
1412const auto FW_DEMIBOLD         = FW_SEMIBOLD;
1413const auto FW_ULTRABOLD        = FW_EXTRABOLD;
1414const auto FW_BLACK            = FW_HEAVY;
1415
1416const auto PANOSE_COUNT               = 10;
1417const auto PAN_FAMILYTYPE_INDEX        = 0;
1418const auto PAN_SERIFSTYLE_INDEX        = 1;
1419const auto PAN_WEIGHT_INDEX            = 2;
1420const auto PAN_PROPORTION_INDEX        = 3;
1421const auto PAN_CONTRAST_INDEX          = 4;
1422const auto PAN_STROKEVARIATION_INDEX   = 5;
1423const auto PAN_ARMSTYLE_INDEX          = 6;
1424const auto PAN_LETTERFORM_INDEX        = 7;
1425const auto PAN_MIDLINE_INDEX           = 8;
1426const auto PAN_XHEIGHT_INDEX           = 9;
1427
1428const auto PAN_CULTURE_LATIN           = 0;
1429
1430struct PANOSE {
1431	BYTE    bFamilyType;
1432	BYTE    bSerifStyle;
1433	BYTE    bWeight;
1434	BYTE    bProportion;
1435	BYTE    bContrast;
1436	BYTE    bStrokeVariation;
1437	BYTE    bArmStyle;
1438	BYTE    bLetterform;
1439	BYTE    bMidline;
1440	BYTE    bXHeight;
1441}
1442
1443typedef PANOSE* LPPANOSE;
1444
1445const auto PAN_ANY                         = 0; /* Any                            */
1446const auto PAN_NO_FIT                      = 1; /* No Fit                         */
1447
1448const auto PAN_FAMILY_TEXT_DISPLAY         = 2; /* Text and Display               */
1449const auto PAN_FAMILY_SCRIPT               = 3; /* Script                         */
1450const auto PAN_FAMILY_DECORATIVE           = 4; /* Decorative                     */
1451const auto PAN_FAMILY_PICTORIAL            = 5; /* Pictorial                      */
1452
1453const auto PAN_SERIF_COVE                  = 2; /* Cove                           */
1454const auto PAN_SERIF_OBTUSE_COVE           = 3; /* Obtuse Cove                    */
1455const auto PAN_SERIF_SQUARE_COVE           = 4; /* Square Cove                    */
1456const auto PAN_SERIF_OBTUSE_SQUARE_COVE    = 5; /* Obtuse Square Cove             */
1457const auto PAN_SERIF_SQUARE                = 6; /* Square                         */
1458const auto PAN_SERIF_THIN                  = 7; /* Thin                           */
1459const auto PAN_SERIF_BONE                  = 8; /* Bone                           */
1460const auto PAN_SERIF_EXAGGERATED           = 9; /* Exaggerated                    */
1461const auto PAN_SERIF_TRIANGLE             = 10; /* Triangle                       */
1462const auto PAN_SERIF_NORMAL_SANS          = 11; /* Normal Sans                    */
1463const auto PAN_SERIF_OBTUSE_SANS          = 12; /* Obtuse Sans                    */
1464const auto PAN_SERIF_PERP_SANS            = 13; /* Prep Sans                      */
1465const auto PAN_SERIF_FLARED               = 14; /* Flared                         */
1466const auto PAN_SERIF_ROUNDED              = 15; /* Rounded                        */
1467
1468const auto PAN_WEIGHT_VERY_LIGHT           = 2; /* Very Light                     */
1469const auto PAN_WEIGHT_LIGHT                = 3; /* Light                          */
1470const auto PAN_WEIGHT_THIN                 = 4; /* Thin                           */
1471const auto PAN_WEIGHT_BOOK                 = 5; /* Book                           */
1472const auto PAN_WEIGHT_MEDIUM               = 6; /* Medium                         */
1473const auto PAN_WEIGHT_DEMI                 = 7; /* Demi                           */
1474const auto PAN_WEIGHT_BOLD                 = 8; /* Bold                           */
1475const auto PAN_WEIGHT_HEAVY                = 9; /* Heavy                          */
1476const auto PAN_WEIGHT_BLACK               = 10; /* Black                          */
1477const auto PAN_WEIGHT_NORD                = 11; /* Nord                           */
1478
1479const auto PAN_PROP_OLD_STYLE              = 2; /* Old Style                      */
1480const auto PAN_PROP_MODERN                 = 3; /* Modern                         */
1481const auto PAN_PROP_EVEN_WIDTH             = 4; /* Even Width                     */
1482const auto PAN_PROP_EXPANDED               = 5; /* Expanded                       */
1483const auto PAN_PROP_CONDENSED              = 6; /* Condensed                      */
1484const auto PAN_PROP_VERY_EXPANDED          = 7; /* Very Expanded                  */
1485const auto PAN_PROP_VERY_CONDENSED         = 8; /* Very Condensed                 */
1486const auto PAN_PROP_MONOSPACED             = 9; /* Monospaced                     */
1487
1488const auto PAN_CONTRAST_NONE               = 2; /* None                           */
1489const auto PAN_CONTRAST_VERY_LOW           = 3; /* Very Low                       */
1490const auto PAN_CONTRAST_LOW                = 4; /* Low                            */
1491const auto PAN_CONTRAST_MEDIUM_LOW         = 5; /* Medium Low                     */
1492const auto PAN_CONTRAST_MEDIUM             = 6; /* Medium                         */
1493const auto PAN_CONTRAST_MEDIUM_HIGH        = 7; /* Mediim High                    */
1494const auto PAN_CONTRAST_HIGH               = 8; /* High                           */
1495const auto PAN_CONTRAST_VERY_HIGH          = 9; /* Very High                      */
1496
1497const auto PAN_STROKE_GRADUAL_DIAG         = 2; /* Gradual/Diagonal               */
1498const auto PAN_STROKE_GRADUAL_TRAN         = 3; /* Gradual/Transitional           */
1499const auto PAN_STROKE_GRADUAL_VERT         = 4; /* Gradual/Vertical               */
1500const auto PAN_STROKE_GRADUAL_HORZ         = 5; /* Gradual/Horizontal             */
1501const auto PAN_STROKE_RAPID_VERT           = 6; /* Rapid/Vertical                 */
1502const auto PAN_STROKE_RAPID_HORZ           = 7; /* Rapid/Horizontal               */
1503const auto PAN_STROKE_INSTANT_VERT         = 8; /* Instant/Vertical               */
1504
1505const auto PAN_STRAIGHT_ARMS_HORZ          = 2; /* Straight Arms/Horizontal       */
1506const auto PAN_STRAIGHT_ARMS_WEDGE         = 3; /* Straight Arms/Wedge            */
1507const auto PAN_STRAIGHT_ARMS_VERT          = 4; /* Straight Arms/Vertical         */
1508const auto PAN_STRAIGHT_ARMS_SINGLE_SERIF  = 5; /* Straight Arms/Single-Serif     */
1509const auto PAN_STRAIGHT_ARMS_DOUBLE_SERIF  = 6; /* Straight Arms/Double-Serif     */
1510const auto PAN_BENT_ARMS_HORZ              = 7; /* Non-Straight Arms/Horizontal   */
1511const auto PAN_BENT_ARMS_WEDGE             = 8; /* Non-Straight Arms/Wedge        */
1512const auto PAN_BENT_ARMS_VERT              = 9; /* Non-Straight Arms/Vertical     */
1513const auto PAN_BENT_ARMS_SINGLE_SERIF     = 10; /* Non-Straight Arms/Single-Serif */
1514const auto PAN_BENT_ARMS_DOUBLE_SERIF     = 11; /* Non-Straight Arms/Double-Serif */
1515
1516const auto PA

Large files files are truncated, but you can click here to view the full file