go-tg-screenshot-bot

Форк
0
1971 строка · 51.4 Кб
1
// Copyright 2010 The win Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4

5
// +build windows
6

7
package win
8

9
import (
10
	"syscall"
11
	"unsafe"
12

13
	"golang.org/x/sys/windows"
14
)
15

16
// GetDeviceCaps index constants
17
const (
18
	DRIVERVERSION   = 0
19
	TECHNOLOGY      = 2
20
	HORZSIZE        = 4
21
	VERTSIZE        = 6
22
	HORZRES         = 8
23
	VERTRES         = 10
24
	LOGPIXELSX      = 88
25
	LOGPIXELSY      = 90
26
	BITSPIXEL       = 12
27
	PLANES          = 14
28
	NUMBRUSHES      = 16
29
	NUMPENS         = 18
30
	NUMFONTS        = 22
31
	NUMCOLORS       = 24
32
	NUMMARKERS      = 20
33
	ASPECTX         = 40
34
	ASPECTY         = 42
35
	ASPECTXY        = 44
36
	PDEVICESIZE     = 26
37
	CLIPCAPS        = 36
38
	SIZEPALETTE     = 104
39
	NUMRESERVED     = 106
40
	COLORRES        = 108
41
	PHYSICALWIDTH   = 110
42
	PHYSICALHEIGHT  = 111
43
	PHYSICALOFFSETX = 112
44
	PHYSICALOFFSETY = 113
45
	SCALINGFACTORX  = 114
46
	SCALINGFACTORY  = 115
47
	VREFRESH        = 116
48
	DESKTOPHORZRES  = 118
49
	DESKTOPVERTRES  = 117
50
	BLTALIGNMENT    = 119
51
	SHADEBLENDCAPS  = 120
52
	COLORMGMTCAPS   = 121
53
	RASTERCAPS      = 38
54
	CURVECAPS       = 28
55
	LINECAPS        = 30
56
	POLYGONALCAPS   = 32
57
	TEXTCAPS        = 34
58
)
59

60
// GetDeviceCaps TECHNOLOGY constants
61
const (
62
	DT_PLOTTER    = 0
63
	DT_RASDISPLAY = 1
64
	DT_RASPRINTER = 2
65
	DT_RASCAMERA  = 3
66
	DT_CHARSTREAM = 4
67
	DT_METAFILE   = 5
68
	DT_DISPFILE   = 6
69
)
70

71
// GetDeviceCaps SHADEBLENDCAPS constants
72
const (
73
	SB_NONE          = 0x00
74
	SB_CONST_ALPHA   = 0x01
75
	SB_PIXEL_ALPHA   = 0x02
76
	SB_PREMULT_ALPHA = 0x04
77
	SB_GRAD_RECT     = 0x10
78
	SB_GRAD_TRI      = 0x20
79
)
80

81
// GetDeviceCaps COLORMGMTCAPS constants
82
const (
83
	CM_NONE       = 0x00
84
	CM_DEVICE_ICM = 0x01
85
	CM_GAMMA_RAMP = 0x02
86
	CM_CMYK_COLOR = 0x04
87
)
88

89
// GetDeviceCaps RASTERCAPS constants
90
const (
91
	RC_BANDING      = 2
92
	RC_BITBLT       = 1
93
	RC_BITMAP64     = 8
94
	RC_DI_BITMAP    = 128
95
	RC_DIBTODEV     = 512
96
	RC_FLOODFILL    = 4096
97
	RC_GDI20_OUTPUT = 16
98
	RC_PALETTE      = 256
99
	RC_SCALING      = 4
100
	RC_STRETCHBLT   = 2048
101
	RC_STRETCHDIB   = 8192
102
	RC_DEVBITS      = 0x8000
103
	RC_OP_DX_OUTPUT = 0x4000
104
)
105

106
// GetDeviceCaps CURVECAPS constants
107
const (
108
	CC_NONE       = 0
109
	CC_CIRCLES    = 1
110
	CC_PIE        = 2
111
	CC_CHORD      = 4
112
	CC_ELLIPSES   = 8
113
	CC_WIDE       = 16
114
	CC_STYLED     = 32
115
	CC_WIDESTYLED = 64
116
	CC_INTERIORS  = 128
117
	CC_ROUNDRECT  = 256
118
)
119

120
// GetDeviceCaps LINECAPS constants
121
const (
122
	LC_NONE       = 0
123
	LC_POLYLINE   = 2
124
	LC_MARKER     = 4
125
	LC_POLYMARKER = 8
126
	LC_WIDE       = 16
127
	LC_STYLED     = 32
128
	LC_WIDESTYLED = 64
129
	LC_INTERIORS  = 128
130
)
131

132
// GetDeviceCaps POLYGONALCAPS constants
133
const (
134
	PC_NONE        = 0
135
	PC_POLYGON     = 1
136
	PC_POLYPOLYGON = 256
137
	PC_PATHS       = 512
138
	PC_RECTANGLE   = 2
139
	PC_WINDPOLYGON = 4
140
	PC_SCANLINE    = 8
141
	PC_TRAPEZOID   = 4
142
	PC_WIDE        = 16
143
	PC_STYLED      = 32
144
	PC_WIDESTYLED  = 64
145
	PC_INTERIORS   = 128
146
)
147

148
// GetDeviceCaps TEXTCAPS constants
149
const (
150
	TC_OP_CHARACTER = 1
151
	TC_OP_STROKE    = 2
152
	TC_CP_STROKE    = 4
153
	TC_CR_90        = 8
154
	TC_CR_ANY       = 16
155
	TC_SF_X_YINDEP  = 32
156
	TC_SA_DOUBLE    = 64
157
	TC_SA_INTEGER   = 128
158
	TC_SA_CONTIN    = 256
159
	TC_EA_DOUBLE    = 512
160
	TC_IA_ABLE      = 1024
161
	TC_UA_ABLE      = 2048
162
	TC_SO_ABLE      = 4096
163
	TC_RA_ABLE      = 8192
164
	TC_VA_ABLE      = 16384
165
	TC_RESERVED     = 32768
166
	TC_SCROLLBLT    = 65536
167
)
168

169
// Brush styles
170
const (
171
	BS_SOLID         = 0
172
	BS_NULL          = 1
173
	BS_HOLLOW        = BS_NULL
174
	BS_HATCHED       = 2
175
	BS_PATTERN       = 3
176
	BS_INDEXED       = 4
177
	BS_DIBPATTERN    = 5
178
	BS_DIBPATTERNPT  = 6
179
	BS_PATTERN8X8    = 7
180
	BS_DIBPATTERN8X8 = 8
181
	BS_MONOPATTERN   = 9
182
)
183

184
// Hatch styles
185
const (
186
	HS_HORIZONTAL = 0
187
	HS_VERTICAL   = 1
188
	HS_FDIAGONAL  = 2
189
	HS_BDIAGONAL  = 3
190
	HS_CROSS      = 4
191
	HS_DIAGCROSS  = 5
192
)
193

194
// Pen types
195
const (
196
	PS_COSMETIC  = 0x00000000
197
	PS_GEOMETRIC = 0x00010000
198
	PS_TYPE_MASK = 0x000F0000
199
)
200

201
// Pen styles
202
const (
203
	PS_SOLID       = 0
204
	PS_DASH        = 1
205
	PS_DOT         = 2
206
	PS_DASHDOT     = 3
207
	PS_DASHDOTDOT  = 4
208
	PS_NULL        = 5
209
	PS_INSIDEFRAME = 6
210
	PS_USERSTYLE   = 7
211
	PS_ALTERNATE   = 8
212
	PS_STYLE_MASK  = 0x0000000F
213
)
214

215
// Pen cap types
216
const (
217
	PS_ENDCAP_ROUND  = 0x00000000
218
	PS_ENDCAP_SQUARE = 0x00000100
219
	PS_ENDCAP_FLAT   = 0x00000200
220
	PS_ENDCAP_MASK   = 0x00000F00
221
)
222

223
// Pen join types
224
const (
225
	PS_JOIN_ROUND = 0x00000000
226
	PS_JOIN_BEVEL = 0x00001000
227
	PS_JOIN_MITER = 0x00002000
228
	PS_JOIN_MASK  = 0x0000F000
229
)
230

231
// Print constants
232
const (
233
	PRF_NONCLIENT  = 0x00000002
234
	PRF_CLIENT     = 0x00000004
235
	PRF_ERASEBKGND = 0x00000008
236
	PRF_CHILDREN   = 0x00000010
237
	PRF_OWNED      = 0x00000020
238
)
239

240
// Stock logical objects
241
const (
242
	WHITE_BRUSH         = 0
243
	LTGRAY_BRUSH        = 1
244
	GRAY_BRUSH          = 2
245
	DKGRAY_BRUSH        = 3
246
	BLACK_BRUSH         = 4
247
	NULL_BRUSH          = 5
248
	HOLLOW_BRUSH        = NULL_BRUSH
249
	WHITE_PEN           = 6
250
	BLACK_PEN           = 7
251
	NULL_PEN            = 8
252
	OEM_FIXED_FONT      = 10
253
	ANSI_FIXED_FONT     = 11
254
	ANSI_VAR_FONT       = 12
255
	SYSTEM_FONT         = 13
256
	DEVICE_DEFAULT_FONT = 14
257
	DEFAULT_PALETTE     = 15
258
	SYSTEM_FIXED_FONT   = 16
259
	DEFAULT_GUI_FONT    = 17
260
	DC_BRUSH            = 18
261
	DC_PEN              = 19
262
)
263

264
const LF_FACESIZE = 32
265

266
// Font weight constants
267
const (
268
	FW_DONTCARE   = 0
269
	FW_THIN       = 100
270
	FW_EXTRALIGHT = 200
271
	FW_ULTRALIGHT = FW_EXTRALIGHT
272
	FW_LIGHT      = 300
273
	FW_NORMAL     = 400
274
	FW_REGULAR    = 400
275
	FW_MEDIUM     = 500
276
	FW_SEMIBOLD   = 600
277
	FW_DEMIBOLD   = FW_SEMIBOLD
278
	FW_BOLD       = 700
279
	FW_EXTRABOLD  = 800
280
	FW_ULTRABOLD  = FW_EXTRABOLD
281
	FW_HEAVY      = 900
282
	FW_BLACK      = FW_HEAVY
283
)
284

285
// Charset constants
286
const (
287
	ANSI_CHARSET        = 0
288
	DEFAULT_CHARSET     = 1
289
	SYMBOL_CHARSET      = 2
290
	SHIFTJIS_CHARSET    = 128
291
	HANGEUL_CHARSET     = 129
292
	HANGUL_CHARSET      = 129
293
	GB2312_CHARSET      = 134
294
	CHINESEBIG5_CHARSET = 136
295
	GREEK_CHARSET       = 161
296
	TURKISH_CHARSET     = 162
297
	HEBREW_CHARSET      = 177
298
	ARABIC_CHARSET      = 178
299
	BALTIC_CHARSET      = 186
300
	RUSSIAN_CHARSET     = 204
301
	THAI_CHARSET        = 222
302
	EASTEUROPE_CHARSET  = 238
303
	OEM_CHARSET         = 255
304
	JOHAB_CHARSET       = 130
305
	VIETNAMESE_CHARSET  = 163
306
	MAC_CHARSET         = 77
307
)
308

309
// Font output precision constants
310
const (
311
	OUT_DEFAULT_PRECIS   = 0
312
	OUT_STRING_PRECIS    = 1
313
	OUT_CHARACTER_PRECIS = 2
314
	OUT_STROKE_PRECIS    = 3
315
	OUT_TT_PRECIS        = 4
316
	OUT_DEVICE_PRECIS    = 5
317
	OUT_RASTER_PRECIS    = 6
318
	OUT_TT_ONLY_PRECIS   = 7
319
	OUT_OUTLINE_PRECIS   = 8
320
	OUT_PS_ONLY_PRECIS   = 10
321
)
322

323
// Font clipping precision constants
324
const (
325
	CLIP_DEFAULT_PRECIS   = 0
326
	CLIP_CHARACTER_PRECIS = 1
327
	CLIP_STROKE_PRECIS    = 2
328
	CLIP_MASK             = 15
329
	CLIP_LH_ANGLES        = 16
330
	CLIP_TT_ALWAYS        = 32
331
	CLIP_EMBEDDED         = 128
332
)
333

334
// Font output quality constants
335
const (
336
	DEFAULT_QUALITY        = 0
337
	DRAFT_QUALITY          = 1
338
	PROOF_QUALITY          = 2
339
	NONANTIALIASED_QUALITY = 3
340
	ANTIALIASED_QUALITY    = 4
341
	CLEARTYPE_QUALITY      = 5
342
)
343

344
// Font pitch constants
345
const (
346
	DEFAULT_PITCH  = 0
347
	FIXED_PITCH    = 1
348
	VARIABLE_PITCH = 2
349
)
350

351
// Font family constants
352
const (
353
	FF_DECORATIVE = 80
354
	FF_DONTCARE   = 0
355
	FF_MODERN     = 48
356
	FF_ROMAN      = 16
357
	FF_SCRIPT     = 64
358
	FF_SWISS      = 32
359
)
360

361
// DeviceCapabilities capabilities
362
const (
363
	DC_FIELDS            = 1
364
	DC_PAPERS            = 2
365
	DC_PAPERSIZE         = 3
366
	DC_MINEXTENT         = 4
367
	DC_MAXEXTENT         = 5
368
	DC_BINS              = 6
369
	DC_DUPLEX            = 7
370
	DC_SIZE              = 8
371
	DC_EXTRA             = 9
372
	DC_VERSION           = 10
373
	DC_DRIVER            = 11
374
	DC_BINNAMES          = 12
375
	DC_ENUMRESOLUTIONS   = 13
376
	DC_FILEDEPENDENCIES  = 14
377
	DC_TRUETYPE          = 15
378
	DC_PAPERNAMES        = 16
379
	DC_ORIENTATION       = 17
380
	DC_COPIES            = 18
381
	DC_BINADJUST         = 19
382
	DC_EMF_COMPLIANT     = 20
383
	DC_DATATYPE_PRODUCED = 21
384
	DC_COLLATE           = 22
385
	DC_MANUFACTURER      = 23
386
	DC_MODEL             = 24
387
	DC_PERSONALITY       = 25
388
	DC_PRINTRATE         = 26
389
	DC_PRINTRATEUNIT     = 27
390
	DC_PRINTERMEM        = 28
391
	DC_MEDIAREADY        = 29
392
	DC_STAPLE            = 30
393
	DC_PRINTRATEPPM      = 31
394
	DC_COLORDEVICE       = 32
395
	DC_NUP               = 33
396
	DC_MEDIATYPENAMES    = 34
397
	DC_MEDIATYPES        = 35
398
)
399

400
const (
401
	CCHDEVICENAME = 32
402
	CCHFORMNAME   = 32
403
)
404

405
const (
406
	DM_UPDATE      = 1
407
	DM_COPY        = 2
408
	DM_PROMPT      = 4
409
	DM_MODIFY      = 8
410
	DM_IN_BUFFER   = DM_MODIFY
411
	DM_IN_PROMPT   = DM_PROMPT
412
	DM_OUT_BUFFER  = DM_COPY
413
	DM_OUT_DEFAULT = DM_UPDATE
414
)
415

416
// DEVMODE field selection bits
417
const (
418
	DM_ORIENTATION        = 0x00000001
419
	DM_PAPERSIZE          = 0x00000002
420
	DM_PAPERLENGTH        = 0x00000004
421
	DM_PAPERWIDTH         = 0x00000008
422
	DM_SCALE              = 0x00000010
423
	DM_POSITION           = 0x00000020
424
	DM_NUP                = 0x00000040
425
	DM_DISPLAYORIENTATION = 0x00000080
426
	DM_COPIES             = 0x00000100
427
	DM_DEFAULTSOURCE      = 0x00000200
428
	DM_PRINTQUALITY       = 0x00000400
429
	DM_COLOR              = 0x00000800
430
	DM_DUPLEX             = 0x00001000
431
	DM_YRESOLUTION        = 0x00002000
432
	DM_TTOPTION           = 0x00004000
433
	DM_COLLATE            = 0x00008000
434
	DM_FORMNAME           = 0x00010000
435
	DM_LOGPIXELS          = 0x00020000
436
	DM_BITSPERPEL         = 0x00040000
437
	DM_PELSWIDTH          = 0x00080000
438
	DM_PELSHEIGHT         = 0x00100000
439
	DM_DISPLAYFLAGS       = 0x00200000
440
	DM_DISPLAYFREQUENCY   = 0x00400000
441
	DM_ICMMETHOD          = 0x00800000
442
	DM_ICMINTENT          = 0x01000000
443
	DM_MEDIATYPE          = 0x02000000
444
	DM_DITHERTYPE         = 0x04000000
445
	DM_PANNINGWIDTH       = 0x08000000
446
	DM_PANNINGHEIGHT      = 0x10000000
447
	DM_DISPLAYFIXEDOUTPUT = 0x20000000
448
)
449

450
// Orientation constants
451
const (
452
	DMORIENT_PORTRAIT  = 1
453
	DMORIENT_LANDSCAPE = 2
454
)
455

456
// Paper sizes
457
const (
458
	DMPAPER_FIRST                         = DMPAPER_LETTER
459
	DMPAPER_LETTER                        = 1   /* Letter 8 1/2 x 11 in               */
460
	DMPAPER_LETTERSMALL                   = 2   /* Letter Small 8 1/2 x 11 in         */
461
	DMPAPER_TABLOID                       = 3   /* Tabloid 11 x 17 in                 */
462
	DMPAPER_LEDGER                        = 4   /* Ledger 17 x 11 in                  */
463
	DMPAPER_LEGAL                         = 5   /* Legal 8 1/2 x 14 in                */
464
	DMPAPER_STATEMENT                     = 6   /* Statement 5 1/2 x 8 1/2 in         */
465
	DMPAPER_EXECUTIVE                     = 7   /* Executive 7 1/4 x 10 1/2 in        */
466
	DMPAPER_A3                            = 8   /* A3 297 x 420 mm                    */
467
	DMPAPER_A4                            = 9   /* A4 210 x 297 mm                    */
468
	DMPAPER_A4SMALL                       = 10  /* A4 Small 210 x 297 mm              */
469
	DMPAPER_A5                            = 11  /* A5 148 x 210 mm                    */
470
	DMPAPER_B4                            = 12  /* B4 (JIS) 250 x 354                 */
471
	DMPAPER_B5                            = 13  /* B5 (JIS) 182 x 257 mm              */
472
	DMPAPER_FOLIO                         = 14  /* Folio 8 1/2 x 13 in                */
473
	DMPAPER_QUARTO                        = 15  /* Quarto 215 x 275 mm                */
474
	DMPAPER_10X14                         = 16  /* 10x14 in                           */
475
	DMPAPER_11X17                         = 17  /* 11x17 in                           */
476
	DMPAPER_NOTE                          = 18  /* Note 8 1/2 x 11 in                 */
477
	DMPAPER_ENV_9                         = 19  /* Envelope #9 3 7/8 x 8 7/8          */
478
	DMPAPER_ENV_10                        = 20  /* Envelope #10 4 1/8 x 9 1/2         */
479
	DMPAPER_ENV_11                        = 21  /* Envelope #11 4 1/2 x 10 3/8        */
480
	DMPAPER_ENV_12                        = 22  /* Envelope #12 4 \276 x 11           */
481
	DMPAPER_ENV_14                        = 23  /* Envelope #14 5 x 11 1/2            */
482
	DMPAPER_CSHEET                        = 24  /* C size sheet                       */
483
	DMPAPER_DSHEET                        = 25  /* D size sheet                       */
484
	DMPAPER_ESHEET                        = 26  /* E size sheet                       */
485
	DMPAPER_ENV_DL                        = 27  /* Envelope DL 110 x 220mm            */
486
	DMPAPER_ENV_C5                        = 28  /* Envelope C5 162 x 229 mm           */
487
	DMPAPER_ENV_C3                        = 29  /* Envelope C3  324 x 458 mm          */
488
	DMPAPER_ENV_C4                        = 30  /* Envelope C4  229 x 324 mm          */
489
	DMPAPER_ENV_C6                        = 31  /* Envelope C6  114 x 162 mm          */
490
	DMPAPER_ENV_C65                       = 32  /* Envelope C65 114 x 229 mm          */
491
	DMPAPER_ENV_B4                        = 33  /* Envelope B4  250 x 353 mm          */
492
	DMPAPER_ENV_B5                        = 34  /* Envelope B5  176 x 250 mm          */
493
	DMPAPER_ENV_B6                        = 35  /* Envelope B6  176 x 125 mm          */
494
	DMPAPER_ENV_ITALY                     = 36  /* Envelope 110 x 230 mm              */
495
	DMPAPER_ENV_MONARCH                   = 37  /* Envelope Monarch 3.875 x 7.5 in    */
496
	DMPAPER_ENV_PERSONAL                  = 38  /* 6 3/4 Envelope 3 5/8 x 6 1/2 in    */
497
	DMPAPER_FANFOLD_US                    = 39  /* US Std Fanfold 14 7/8 x 11 in      */
498
	DMPAPER_FANFOLD_STD_GERMAN            = 40  /* German Std Fanfold 8 1/2 x 12 in   */
499
	DMPAPER_FANFOLD_LGL_GERMAN            = 41  /* German Legal Fanfold 8 1/2 x 13 in */
500
	DMPAPER_ISO_B4                        = 42  /* B4 (ISO) 250 x 353 mm              */
501
	DMPAPER_JAPANESE_POSTCARD             = 43  /* Japanese Postcard 100 x 148 mm     */
502
	DMPAPER_9X11                          = 44  /* 9 x 11 in                          */
503
	DMPAPER_10X11                         = 45  /* 10 x 11 in                         */
504
	DMPAPER_15X11                         = 46  /* 15 x 11 in                         */
505
	DMPAPER_ENV_INVITE                    = 47  /* Envelope Invite 220 x 220 mm       */
506
	DMPAPER_RESERVED_48                   = 48  /* RESERVED--DO NOT USE               */
507
	DMPAPER_RESERVED_49                   = 49  /* RESERVED--DO NOT USE               */
508
	DMPAPER_LETTER_EXTRA                  = 50  /* Letter Extra 9 \275 x 12 in        */
509
	DMPAPER_LEGAL_EXTRA                   = 51  /* Legal Extra 9 \275 x 15 in         */
510
	DMPAPER_TABLOID_EXTRA                 = 52  /* Tabloid Extra 11.69 x 18 in        */
511
	DMPAPER_A4_EXTRA                      = 53  /* A4 Extra 9.27 x 12.69 in           */
512
	DMPAPER_LETTER_TRANSVERSE             = 54  /* Letter Transverse 8 \275 x 11 in   */
513
	DMPAPER_A4_TRANSVERSE                 = 55  /* A4 Transverse 210 x 297 mm         */
514
	DMPAPER_LETTER_EXTRA_TRANSVERSE       = 56  /* Letter Extra Transverse 9\275 x 12 in */
515
	DMPAPER_A_PLUS                        = 57  /* SuperA/SuperA/A4 227 x 356 mm      */
516
	DMPAPER_B_PLUS                        = 58  /* SuperB/SuperB/A3 305 x 487 mm      */
517
	DMPAPER_LETTER_PLUS                   = 59  /* Letter Plus 8.5 x 12.69 in         */
518
	DMPAPER_A4_PLUS                       = 60  /* A4 Plus 210 x 330 mm               */
519
	DMPAPER_A5_TRANSVERSE                 = 61  /* A5 Transverse 148 x 210 mm         */
520
	DMPAPER_B5_TRANSVERSE                 = 62  /* B5 (JIS) Transverse 182 x 257 mm   */
521
	DMPAPER_A3_EXTRA                      = 63  /* A3 Extra 322 x 445 mm              */
522
	DMPAPER_A5_EXTRA                      = 64  /* A5 Extra 174 x 235 mm              */
523
	DMPAPER_B5_EXTRA                      = 65  /* B5 (ISO) Extra 201 x 276 mm        */
524
	DMPAPER_A2                            = 66  /* A2 420 x 594 mm                    */
525
	DMPAPER_A3_TRANSVERSE                 = 67  /* A3 Transverse 297 x 420 mm         */
526
	DMPAPER_A3_EXTRA_TRANSVERSE           = 68  /* A3 Extra Transverse 322 x 445 mm   */
527
	DMPAPER_DBL_JAPANESE_POSTCARD         = 69  /* Japanese Double Postcard 200 x 148 mm */
528
	DMPAPER_A6                            = 70  /* A6 105 x 148 mm                 */
529
	DMPAPER_JENV_KAKU2                    = 71  /* Japanese Envelope Kaku #2       */
530
	DMPAPER_JENV_KAKU3                    = 72  /* Japanese Envelope Kaku #3       */
531
	DMPAPER_JENV_CHOU3                    = 73  /* Japanese Envelope Chou #3       */
532
	DMPAPER_JENV_CHOU4                    = 74  /* Japanese Envelope Chou #4       */
533
	DMPAPER_LETTER_ROTATED                = 75  /* Letter Rotated 11 x 8 1/2 11 in */
534
	DMPAPER_A3_ROTATED                    = 76  /* A3 Rotated 420 x 297 mm         */
535
	DMPAPER_A4_ROTATED                    = 77  /* A4 Rotated 297 x 210 mm         */
536
	DMPAPER_A5_ROTATED                    = 78  /* A5 Rotated 210 x 148 mm         */
537
	DMPAPER_B4_JIS_ROTATED                = 79  /* B4 (JIS) Rotated 364 x 257 mm   */
538
	DMPAPER_B5_JIS_ROTATED                = 80  /* B5 (JIS) Rotated 257 x 182 mm   */
539
	DMPAPER_JAPANESE_POSTCARD_ROTATED     = 81  /* Japanese Postcard Rotated 148 x 100 mm */
540
	DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82  /* Double Japanese Postcard Rotated 148 x 200 mm */
541
	DMPAPER_A6_ROTATED                    = 83  /* A6 Rotated 148 x 105 mm         */
542
	DMPAPER_JENV_KAKU2_ROTATED            = 84  /* Japanese Envelope Kaku #2 Rotated */
543
	DMPAPER_JENV_KAKU3_ROTATED            = 85  /* Japanese Envelope Kaku #3 Rotated */
544
	DMPAPER_JENV_CHOU3_ROTATED            = 86  /* Japanese Envelope Chou #3 Rotated */
545
	DMPAPER_JENV_CHOU4_ROTATED            = 87  /* Japanese Envelope Chou #4 Rotated */
546
	DMPAPER_B6_JIS                        = 88  /* B6 (JIS) 128 x 182 mm           */
547
	DMPAPER_B6_JIS_ROTATED                = 89  /* B6 (JIS) Rotated 182 x 128 mm   */
548
	DMPAPER_12X11                         = 90  /* 12 x 11 in                      */
549
	DMPAPER_JENV_YOU4                     = 91  /* Japanese Envelope You #4        */
550
	DMPAPER_JENV_YOU4_ROTATED             = 92  /* Japanese Envelope You #4 Rotated*/
551
	DMPAPER_P16K                          = 93  /* PRC 16K 146 x 215 mm            */
552
	DMPAPER_P32K                          = 94  /* PRC 32K 97 x 151 mm             */
553
	DMPAPER_P32KBIG                       = 95  /* PRC 32K(Big) 97 x 151 mm        */
554
	DMPAPER_PENV_1                        = 96  /* PRC Envelope #1 102 x 165 mm    */
555
	DMPAPER_PENV_2                        = 97  /* PRC Envelope #2 102 x 176 mm    */
556
	DMPAPER_PENV_3                        = 98  /* PRC Envelope #3 125 x 176 mm    */
557
	DMPAPER_PENV_4                        = 99  /* PRC Envelope #4 110 x 208 mm    */
558
	DMPAPER_PENV_5                        = 100 /* PRC Envelope #5 110 x 220 mm    */
559
	DMPAPER_PENV_6                        = 101 /* PRC Envelope #6 120 x 230 mm    */
560
	DMPAPER_PENV_7                        = 102 /* PRC Envelope #7 160 x 230 mm    */
561
	DMPAPER_PENV_8                        = 103 /* PRC Envelope #8 120 x 309 mm    */
562
	DMPAPER_PENV_9                        = 104 /* PRC Envelope #9 229 x 324 mm    */
563
	DMPAPER_PENV_10                       = 105 /* PRC Envelope #10 324 x 458 mm   */
564
	DMPAPER_P16K_ROTATED                  = 106 /* PRC 16K Rotated                 */
565
	DMPAPER_P32K_ROTATED                  = 107 /* PRC 32K Rotated                 */
566
	DMPAPER_P32KBIG_ROTATED               = 108 /* PRC 32K(Big) Rotated            */
567
	DMPAPER_PENV_1_ROTATED                = 109 /* PRC Envelope #1 Rotated 165 x 102 mm */
568
	DMPAPER_PENV_2_ROTATED                = 110 /* PRC Envelope #2 Rotated 176 x 102 mm */
569
	DMPAPER_PENV_3_ROTATED                = 111 /* PRC Envelope #3 Rotated 176 x 125 mm */
570
	DMPAPER_PENV_4_ROTATED                = 112 /* PRC Envelope #4 Rotated 208 x 110 mm */
571
	DMPAPER_PENV_5_ROTATED                = 113 /* PRC Envelope #5 Rotated 220 x 110 mm */
572
	DMPAPER_PENV_6_ROTATED                = 114 /* PRC Envelope #6 Rotated 230 x 120 mm */
573
	DMPAPER_PENV_7_ROTATED                = 115 /* PRC Envelope #7 Rotated 230 x 160 mm */
574
	DMPAPER_PENV_8_ROTATED                = 116 /* PRC Envelope #8 Rotated 309 x 120 mm */
575
	DMPAPER_PENV_9_ROTATED                = 117 /* PRC Envelope #9 Rotated 324 x 229 mm */
576
	DMPAPER_PENV_10_ROTATED               = 118 /* PRC Envelope #10 Rotated 458 x 324 mm */
577
	DMPAPER_LAST                          = DMPAPER_PENV_10_ROTATED
578
	DMPAPER_USER                          = 256
579
)
580

581
// Bin constants
582
const (
583
	DMBIN_FIRST         = DMBIN_UPPER
584
	DMBIN_UPPER         = 1
585
	DMBIN_ONLYONE       = 1
586
	DMBIN_LOWER         = 2
587
	DMBIN_MIDDLE        = 3
588
	DMBIN_MANUAL        = 4
589
	DMBIN_ENVELOPE      = 5
590
	DMBIN_ENVMANUAL     = 6
591
	DMBIN_AUTO          = 7
592
	DMBIN_TRACTOR       = 8
593
	DMBIN_SMALLFMT      = 9
594
	DMBIN_LARGEFMT      = 10
595
	DMBIN_LARGECAPACITY = 11
596
	DMBIN_CASSETTE      = 14
597
	DMBIN_FORMSOURCE    = 15
598
	DMBIN_LAST          = DMBIN_FORMSOURCE
599
	DMBIN_USER          = 256
600
)
601

602
// Quality constants
603
const (
604
	DMRES_DRAFT  = -1
605
	DMRES_LOW    = -2
606
	DMRES_MEDIUM = -3
607
	DMRES_HIGH   = -4
608
)
609

610
// Color/monochrome constants
611
const (
612
	DMCOLOR_MONOCHROME = 1
613
	DMCOLOR_COLOR      = 2
614
)
615

616
// Duplex constants
617
const (
618
	DMDUP_SIMPLEX    = 1
619
	DMDUP_VERTICAL   = 2
620
	DMDUP_HORIZONTAL = 3
621
)
622

623
// TrueType constants
624
const (
625
	DMTT_BITMAP           = 1
626
	DMTT_DOWNLOAD         = 2
627
	DMTT_SUBDEV           = 3
628
	DMTT_DOWNLOAD_OUTLINE = 4
629
)
630

631
// Collation constants
632
const (
633
	DMCOLLATE_FALSE = 0
634
	DMCOLLATE_TRUE  = 1
635
)
636

637
// Background modes
638
const (
639
	TRANSPARENT = 1
640
	OPAQUE      = 2
641
)
642

643
// Ternary raster operations
644
const (
645
	SRCCOPY        = 0x00CC0020
646
	SRCPAINT       = 0x00EE0086
647
	SRCAND         = 0x008800C6
648
	SRCINVERT      = 0x00660046
649
	SRCERASE       = 0x00440328
650
	NOTSRCCOPY     = 0x00330008
651
	NOTSRCERASE    = 0x001100A6
652
	MERGECOPY      = 0x00C000CA
653
	MERGEPAINT     = 0x00BB0226
654
	PATCOPY        = 0x00F00021
655
	PATPAINT       = 0x00FB0A09
656
	PATINVERT      = 0x005A0049
657
	DSTINVERT      = 0x00550009
658
	BLACKNESS      = 0x00000042
659
	WHITENESS      = 0x00FF0062
660
	NOMIRRORBITMAP = 0x80000000
661
	CAPTUREBLT     = 0x40000000
662
)
663

664
// StretchBlt modes
665
const (
666
	BLACKONWHITE        = 1
667
	WHITEONBLACK        = 2
668
	COLORONCOLOR        = 3
669
	HALFTONE            = 4
670
	MAXSTRETCHBLTMODE   = 4
671
	STRETCH_ANDSCANS    = BLACKONWHITE
672
	STRETCH_ORSCANS     = WHITEONBLACK
673
	STRETCH_DELETESCANS = COLORONCOLOR
674
	STRETCH_HALFTONE    = HALFTONE
675
)
676

677
// Bitmap compression constants
678
const (
679
	BI_RGB       = 0
680
	BI_RLE8      = 1
681
	BI_RLE4      = 2
682
	BI_BITFIELDS = 3
683
	BI_JPEG      = 4
684
	BI_PNG       = 5
685
)
686

687
// Bitmap color table usage
688
const (
689
	DIB_RGB_COLORS = 0
690
	DIB_PAL_COLORS = 1
691
)
692

693
const CBM_INIT = 4
694

695
const (
696
	CLR_INVALID = 0xFFFFFFFF
697
	CLR_NONE    = CLR_INVALID
698
	CLR_DEFAULT = 0xFF000000
699
)
700

701
const (
702
	/* pixel types */
703
	PFD_TYPE_RGBA       = 0
704
	PFD_TYPE_COLORINDEX = 1
705

706
	/* layer types */
707
	PFD_MAIN_PLANE     = 0
708
	PFD_OVERLAY_PLANE  = 1
709
	PFD_UNDERLAY_PLANE = (-1)
710

711
	/* PIXELFORMATDESCRIPTOR flags */
712
	PFD_DOUBLEBUFFER        = 0x00000001
713
	PFD_STEREO              = 0x00000002
714
	PFD_DRAW_TO_WINDOW      = 0x00000004
715
	PFD_DRAW_TO_BITMAP      = 0x00000008
716
	PFD_SUPPORT_GDI         = 0x00000010
717
	PFD_SUPPORT_OPENGL      = 0x00000020
718
	PFD_GENERIC_FORMAT      = 0x00000040
719
	PFD_NEED_PALETTE        = 0x00000080
720
	PFD_NEED_SYSTEM_PALETTE = 0x00000100
721
	PFD_SWAP_EXCHANGE       = 0x00000200
722
	PFD_SWAP_COPY           = 0x00000400
723
	PFD_SWAP_LAYER_BUFFERS  = 0x00000800
724
	PFD_GENERIC_ACCELERATED = 0x00001000
725
	PFD_SUPPORT_DIRECTDRAW  = 0x00002000
726

727
	/* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
728
	PFD_DEPTH_DONTCARE        = 0x20000000
729
	PFD_DOUBLEBUFFER_DONTCARE = 0x40000000
730
	PFD_STEREO_DONTCARE       = 0x80000000
731
)
732

733
// GradientFill constants
734
const (
735
	GRADIENT_FILL_RECT_H   = 0x00
736
	GRADIENT_FILL_RECT_V   = 0x01
737
	GRADIENT_FILL_TRIANGLE = 0x02
738
)
739

740
// Region Combine Modes
741
const (
742
	RGN_AND  = 1
743
	RGN_OR   = 2
744
	RGN_XOR  = 3
745
	RGN_DIFF = 4
746
	RGN_COPY = 5
747
)
748

749
// Region Types
750
const (
751
	REGIONERROR   = 0
752
	NULLREGION    = 1
753
	SIMPLEREGION  = 2
754
	COMPLEXREGION = 3
755
)
756

757
// AlphaBlend operations
758
const (
759
	AC_SRC_ALPHA = 0x1
760
)
761

762
// AddFontResourceEx flags
763
const (
764
	FR_PRIVATE  = 0x10
765
	FR_NOT_ENUM = 0x20
766
)
767

768
func RGB(r, g, b byte) COLORREF {
769
	return COLORREF(r) | (COLORREF(g) << 8) | (COLORREF(b) << 16)
770
}
771

772
type (
773
	COLORREF     uint32
774
	HBITMAP      HGDIOBJ
775
	HBRUSH       HGDIOBJ
776
	HDC          HANDLE
777
	HFONT        HGDIOBJ
778
	HGDIOBJ      HANDLE
779
	HENHMETAFILE HANDLE
780
	HPALETTE     HGDIOBJ
781
	HPEN         HGDIOBJ
782
	HRGN         HGDIOBJ
783
	CLIPFORMAT   uint16
784
)
785

786
type PIXELFORMATDESCRIPTOR struct {
787
	NSize           uint16
788
	NVersion        uint16
789
	DwFlags         uint32
790
	IPixelType      byte
791
	CColorBits      byte
792
	CRedBits        byte
793
	CRedShift       byte
794
	CGreenBits      byte
795
	CGreenShift     byte
796
	CBlueBits       byte
797
	CBlueShift      byte
798
	CAlphaBits      byte
799
	CAlphaShift     byte
800
	CAccumBits      byte
801
	CAccumRedBits   byte
802
	CAccumGreenBits byte
803
	CAccumBlueBits  byte
804
	CAccumAlphaBits byte
805
	CDepthBits      byte
806
	CStencilBits    byte
807
	CAuxBuffers     byte
808
	ILayerType      byte
809
	BReserved       byte
810
	DwLayerMask     uint32
811
	DwVisibleMask   uint32
812
	DwDamageMask    uint32
813
}
814

815
type LOGFONT struct {
816
	LfHeight         int32
817
	LfWidth          int32
818
	LfEscapement     int32
819
	LfOrientation    int32
820
	LfWeight         int32
821
	LfItalic         byte
822
	LfUnderline      byte
823
	LfStrikeOut      byte
824
	LfCharSet        byte
825
	LfOutPrecision   byte
826
	LfClipPrecision  byte
827
	LfQuality        byte
828
	LfPitchAndFamily byte
829
	LfFaceName       [LF_FACESIZE]uint16
830
}
831

832
type TEXTMETRIC struct {
833
	TmHeight           int32
834
	TmAscent           int32
835
	TmDescent          int32
836
	TmInternalLeading  int32
837
	TmExternalLeading  int32
838
	TmAveCharWidth     int32
839
	TmMaxCharWidth     int32
840
	TmWeight           int32
841
	TmOverhang         int32
842
	TmDigitizedAspectX int32
843
	TmDigitizedAspectY int32
844
	TmFirstChar        uint16
845
	TmLastChar         uint16
846
	TmDefaultChar      uint16
847
	TmBreakChar        uint16
848
	TmItalic           byte
849
	TmUnderlined       byte
850
	TmStruckOut        byte
851
	TmPitchAndFamily   byte
852
	TmCharSet          byte
853
}
854

855
type DEVMODE struct {
856
	DmDeviceName       [CCHDEVICENAME]uint16
857
	DmSpecVersion      uint16
858
	DmDriverVersion    uint16
859
	DmSize             uint16
860
	DmDriverExtra      uint16
861
	DmFields           uint32
862
	DmOrientation      int16
863
	DmPaperSize        int16
864
	DmPaperLength      int16
865
	DmPaperWidth       int16
866
	DmScale            int16
867
	DmCopies           int16
868
	DmDefaultSource    int16
869
	DmPrintQuality     int16
870
	DmColor            int16
871
	DmDuplex           int16
872
	DmYResolution      int16
873
	DmTTOption         int16
874
	DmCollate          int16
875
	DmFormName         [CCHFORMNAME]uint16
876
	DmLogPixels        uint16
877
	DmBitsPerPel       uint32
878
	DmPelsWidth        uint32
879
	DmPelsHeight       uint32
880
	DmDisplayFlags     uint32
881
	DmDisplayFrequency uint32
882
	DmICMMethod        uint32
883
	DmICMIntent        uint32
884
	DmMediaType        uint32
885
	DmDitherType       uint32
886
	DmReserved1        uint32
887
	DmReserved2        uint32
888
	DmPanningWidth     uint32
889
	DmPanningHeight    uint32
890
}
891

892
type POINT struct {
893
	X, Y int32
894
}
895

896
type RECT struct {
897
	Left, Top, Right, Bottom int32
898
}
899

900
type SIZE struct {
901
	CX, CY int32
902
}
903

904
type DOCINFO struct {
905
	CbSize       int32
906
	LpszDocName  *uint16
907
	LpszOutput   *uint16
908
	LpszDatatype *uint16
909
	FwType       uint32
910
}
911

912
type LOGBRUSH struct {
913
	LbStyle uint32
914
	LbColor COLORREF
915
	LbHatch uintptr
916
}
917

918
type CIEXYZ struct {
919
	CiexyzX, CiexyzY, CiexyzZ int32 // FXPT2DOT30
920
}
921

922
type CIEXYZTRIPLE struct {
923
	CiexyzRed, CiexyzGreen, CiexyzBlue CIEXYZ
924
}
925

926
type BITMAPINFOHEADER struct {
927
	BiSize          uint32
928
	BiWidth         int32
929
	BiHeight        int32
930
	BiPlanes        uint16
931
	BiBitCount      uint16
932
	BiCompression   uint32
933
	BiSizeImage     uint32
934
	BiXPelsPerMeter int32
935
	BiYPelsPerMeter int32
936
	BiClrUsed       uint32
937
	BiClrImportant  uint32
938
}
939

940
type BITMAPV4HEADER struct {
941
	BITMAPINFOHEADER
942
	BV4RedMask    uint32
943
	BV4GreenMask  uint32
944
	BV4BlueMask   uint32
945
	BV4AlphaMask  uint32
946
	BV4CSType     uint32
947
	BV4Endpoints  CIEXYZTRIPLE
948
	BV4GammaRed   uint32
949
	BV4GammaGreen uint32
950
	BV4GammaBlue  uint32
951
}
952

953
type BITMAPV5HEADER struct {
954
	BITMAPV4HEADER
955
	BV5Intent      uint32
956
	BV5ProfileData uint32
957
	BV5ProfileSize uint32
958
	BV5Reserved    uint32
959
}
960

961
type RGBQUAD struct {
962
	RgbBlue     byte
963
	RgbGreen    byte
964
	RgbRed      byte
965
	RgbReserved byte
966
}
967

968
type BITMAPINFO struct {
969
	BmiHeader BITMAPINFOHEADER
970
	BmiColors *RGBQUAD
971
}
972

973
type BITMAP struct {
974
	BmType       int32
975
	BmWidth      int32
976
	BmHeight     int32
977
	BmWidthBytes int32
978
	BmPlanes     uint16
979
	BmBitsPixel  uint16
980
	BmBits       unsafe.Pointer
981
}
982

983
type DIBSECTION struct {
984
	DsBm        BITMAP
985
	DsBmih      BITMAPINFOHEADER
986
	DsBitfields [3]uint32
987
	DshSection  HANDLE
988
	DsOffset    uint32
989
}
990

991
type ENHMETAHEADER struct {
992
	IType          uint32
993
	NSize          uint32
994
	RclBounds      RECT
995
	RclFrame       RECT
996
	DSignature     uint32
997
	NVersion       uint32
998
	NBytes         uint32
999
	NRecords       uint32
1000
	NHandles       uint16
1001
	SReserved      uint16
1002
	NDescription   uint32
1003
	OffDescription uint32
1004
	NPalEntries    uint32
1005
	SzlDevice      SIZE
1006
	SzlMillimeters SIZE
1007
	CbPixelFormat  uint32
1008
	OffPixelFormat uint32
1009
	BOpenGL        uint32
1010
	SzlMicrometers SIZE
1011
}
1012

1013
type TRIVERTEX struct {
1014
	X     int32
1015
	Y     int32
1016
	Red   uint16
1017
	Green uint16
1018
	Blue  uint16
1019
	Alpha uint16
1020
}
1021

1022
type GRADIENT_RECT struct {
1023
	UpperLeft  uint32
1024
	LowerRight uint32
1025
}
1026

1027
type GRADIENT_TRIANGLE struct {
1028
	Vertex1 uint32
1029
	Vertex2 uint32
1030
	Vertex3 uint32
1031
}
1032

1033
type BLENDFUNCTION struct {
1034
	BlendOp             byte
1035
	BlendFlags          byte
1036
	SourceConstantAlpha byte
1037
	AlphaFormat         byte
1038
}
1039

1040
var (
1041
	// Library
1042
	libgdi32   *windows.LazyDLL
1043
	libmsimg32 *windows.LazyDLL
1044

1045
	// Functions
1046
	abortDoc                *windows.LazyProc
1047
	addFontResourceEx       *windows.LazyProc
1048
	addFontMemResourceEx    *windows.LazyProc
1049
	alphaBlend              *windows.LazyProc
1050
	bitBlt                  *windows.LazyProc
1051
	choosePixelFormat       *windows.LazyProc
1052
	closeEnhMetaFile        *windows.LazyProc
1053
	combineRgn              *windows.LazyProc
1054
	copyEnhMetaFile         *windows.LazyProc
1055
	createBitmap            *windows.LazyProc
1056
	createCompatibleBitmap  *windows.LazyProc
1057
	createBrushIndirect     *windows.LazyProc
1058
	createCompatibleDC      *windows.LazyProc
1059
	createDC                *windows.LazyProc
1060
	createDIBSection        *windows.LazyProc
1061
	createFontIndirect      *windows.LazyProc
1062
	createEnhMetaFile       *windows.LazyProc
1063
	createIC                *windows.LazyProc
1064
	createPatternBrush      *windows.LazyProc
1065
	createRectRgn           *windows.LazyProc
1066
	deleteDC                *windows.LazyProc
1067
	deleteEnhMetaFile       *windows.LazyProc
1068
	deleteObject            *windows.LazyProc
1069
	ellipse                 *windows.LazyProc
1070
	endDoc                  *windows.LazyProc
1071
	endPage                 *windows.LazyProc
1072
	excludeClipRect         *windows.LazyProc
1073
	extCreatePen            *windows.LazyProc
1074
	fillRgn                 *windows.LazyProc
1075
	gdiFlush                *windows.LazyProc
1076
	getBkColor              *windows.LazyProc
1077
	getDeviceCaps           *windows.LazyProc
1078
	getDIBits               *windows.LazyProc
1079
	getEnhMetaFile          *windows.LazyProc
1080
	getEnhMetaFileHeader    *windows.LazyProc
1081
	getObject               *windows.LazyProc
1082
	getPixel                *windows.LazyProc
1083
	getRgnBox               *windows.LazyProc
1084
	getStockObject          *windows.LazyProc
1085
	getTextColor            *windows.LazyProc
1086
	getTextExtentExPoint    *windows.LazyProc
1087
	getTextExtentPoint32    *windows.LazyProc
1088
	getTextMetrics          *windows.LazyProc
1089
	getViewportOrgEx        *windows.LazyProc
1090
	gradientFill            *windows.LazyProc
1091
	intersectClipRect       *windows.LazyProc
1092
	lineTo                  *windows.LazyProc
1093
	moveToEx                *windows.LazyProc
1094
	playEnhMetaFile         *windows.LazyProc
1095
	polyline                *windows.LazyProc
1096
	rectangle               *windows.LazyProc
1097
	removeFontResourceEx    *windows.LazyProc
1098
	removeFontMemResourceEx *windows.LazyProc
1099
	resetDC                 *windows.LazyProc
1100
	restoreDC               *windows.LazyProc
1101
	roundRect               *windows.LazyProc
1102
	selectObject            *windows.LazyProc
1103
	setBkColor              *windows.LazyProc
1104
	setBkMode               *windows.LazyProc
1105
	setBrushOrgEx           *windows.LazyProc
1106
	setDIBits               *windows.LazyProc
1107
	setPixel                *windows.LazyProc
1108
	setPixelFormat          *windows.LazyProc
1109
	setStretchBltMode       *windows.LazyProc
1110
	setTextColor            *windows.LazyProc
1111
	setViewportOrgEx        *windows.LazyProc
1112
	saveDC                  *windows.LazyProc
1113
	startDoc                *windows.LazyProc
1114
	startPage               *windows.LazyProc
1115
	stretchBlt              *windows.LazyProc
1116
	swapBuffers             *windows.LazyProc
1117
	textOut                 *windows.LazyProc
1118
	transparentBlt          *windows.LazyProc
1119
)
1120

1121
func init() {
1122
	// Library
1123
	libgdi32 = windows.NewLazySystemDLL("gdi32.dll")
1124
	libmsimg32 = windows.NewLazySystemDLL("msimg32.dll")
1125

1126
	// Functions
1127
	abortDoc = libgdi32.NewProc("AbortDoc")
1128
	addFontResourceEx = libgdi32.NewProc("AddFontResourceExW")
1129
	addFontMemResourceEx = libgdi32.NewProc("AddFontMemResourceEx")
1130
	bitBlt = libgdi32.NewProc("BitBlt")
1131
	choosePixelFormat = libgdi32.NewProc("ChoosePixelFormat")
1132
	closeEnhMetaFile = libgdi32.NewProc("CloseEnhMetaFile")
1133
	combineRgn = libgdi32.NewProc("CombineRgn")
1134
	copyEnhMetaFile = libgdi32.NewProc("CopyEnhMetaFileW")
1135
	createBitmap = libgdi32.NewProc("CreateBitmap")
1136
	createCompatibleBitmap = libgdi32.NewProc("CreateCompatibleBitmap")
1137
	createBrushIndirect = libgdi32.NewProc("CreateBrushIndirect")
1138
	createCompatibleDC = libgdi32.NewProc("CreateCompatibleDC")
1139
	createDC = libgdi32.NewProc("CreateDCW")
1140
	createDIBSection = libgdi32.NewProc("CreateDIBSection")
1141
	createEnhMetaFile = libgdi32.NewProc("CreateEnhMetaFileW")
1142
	createFontIndirect = libgdi32.NewProc("CreateFontIndirectW")
1143
	createIC = libgdi32.NewProc("CreateICW")
1144
	createPatternBrush = libgdi32.NewProc("CreatePatternBrush")
1145
	createRectRgn = libgdi32.NewProc("CreateRectRgn")
1146
	deleteDC = libgdi32.NewProc("DeleteDC")
1147
	deleteEnhMetaFile = libgdi32.NewProc("DeleteEnhMetaFile")
1148
	deleteObject = libgdi32.NewProc("DeleteObject")
1149
	ellipse = libgdi32.NewProc("Ellipse")
1150
	endDoc = libgdi32.NewProc("EndDoc")
1151
	endPage = libgdi32.NewProc("EndPage")
1152
	excludeClipRect = libgdi32.NewProc("ExcludeClipRect")
1153
	extCreatePen = libgdi32.NewProc("ExtCreatePen")
1154
	fillRgn = libgdi32.NewProc("FillRgn")
1155
	gdiFlush = libgdi32.NewProc("GdiFlush")
1156
	getBkColor = libgdi32.NewProc("GetBkColor")
1157
	getDeviceCaps = libgdi32.NewProc("GetDeviceCaps")
1158
	getDIBits = libgdi32.NewProc("GetDIBits")
1159
	getEnhMetaFile = libgdi32.NewProc("GetEnhMetaFileW")
1160
	getEnhMetaFileHeader = libgdi32.NewProc("GetEnhMetaFileHeader")
1161
	getObject = libgdi32.NewProc("GetObjectW")
1162
	getPixel = libgdi32.NewProc("GetPixel")
1163
	getRgnBox = libgdi32.NewProc("GetRgnBox")
1164
	getStockObject = libgdi32.NewProc("GetStockObject")
1165
	getTextColor = libgdi32.NewProc("GetTextColor")
1166
	getTextExtentExPoint = libgdi32.NewProc("GetTextExtentExPointW")
1167
	getTextExtentPoint32 = libgdi32.NewProc("GetTextExtentPoint32W")
1168
	getTextMetrics = libgdi32.NewProc("GetTextMetricsW")
1169
	getViewportOrgEx = libgdi32.NewProc("GetViewportOrgEx")
1170
	intersectClipRect = libgdi32.NewProc("IntersectClipRect")
1171
	lineTo = libgdi32.NewProc("LineTo")
1172
	moveToEx = libgdi32.NewProc("MoveToEx")
1173
	playEnhMetaFile = libgdi32.NewProc("PlayEnhMetaFile")
1174
	polyline = libgdi32.NewProc("Polyline")
1175
	rectangle = libgdi32.NewProc("Rectangle")
1176
	removeFontResourceEx = libgdi32.NewProc("RemoveFontResourceExW")
1177
	removeFontMemResourceEx = libgdi32.NewProc("RemoveFontMemResourceEx")
1178
	resetDC = libgdi32.NewProc("ResetDCW")
1179
	restoreDC = libgdi32.NewProc("RestoreDC")
1180
	roundRect = libgdi32.NewProc("RoundRect")
1181
	saveDC = libgdi32.NewProc("SaveDC")
1182
	selectObject = libgdi32.NewProc("SelectObject")
1183
	setBkColor = libgdi32.NewProc("SetBkColor")
1184
	setBkMode = libgdi32.NewProc("SetBkMode")
1185
	setBrushOrgEx = libgdi32.NewProc("SetBrushOrgEx")
1186
	setDIBits = libgdi32.NewProc("SetDIBits")
1187
	setPixel = libgdi32.NewProc("SetPixel")
1188
	setPixelFormat = libgdi32.NewProc("SetPixelFormat")
1189
	setStretchBltMode = libgdi32.NewProc("SetStretchBltMode")
1190
	setTextColor = libgdi32.NewProc("SetTextColor")
1191
	setViewportOrgEx = libgdi32.NewProc("SetViewportOrgEx")
1192
	startDoc = libgdi32.NewProc("StartDocW")
1193
	startPage = libgdi32.NewProc("StartPage")
1194
	stretchBlt = libgdi32.NewProc("StretchBlt")
1195
	swapBuffers = libgdi32.NewProc("SwapBuffers")
1196
	textOut = libgdi32.NewProc("TextOutW")
1197

1198
	alphaBlend = libmsimg32.NewProc("AlphaBlend")
1199
	gradientFill = libmsimg32.NewProc("GradientFill")
1200
	transparentBlt = libmsimg32.NewProc("TransparentBlt")
1201
}
1202

1203
func AbortDoc(hdc HDC) int32 {
1204
	ret, _, _ := syscall.Syscall(abortDoc.Addr(), 1,
1205
		uintptr(hdc),
1206
		0,
1207
		0)
1208

1209
	return int32(ret)
1210
}
1211

1212
func AddFontResourceEx(lpszFilename *uint16, fl uint32, pdv unsafe.Pointer) int32 {
1213
	ret, _, _ := syscall.Syscall(addFontResourceEx.Addr(), 3,
1214
		uintptr(unsafe.Pointer(lpszFilename)),
1215
		uintptr(fl),
1216
		uintptr(pdv))
1217

1218
	return int32(ret)
1219
}
1220

1221
func AddFontMemResourceEx(pFileView uintptr, cjSize uint32, pvReserved unsafe.Pointer, pNumFonts *uint32) HANDLE {
1222
	ret, _, _ := syscall.Syscall6(addFontMemResourceEx.Addr(), 4,
1223
		pFileView,
1224
		uintptr(cjSize),
1225
		uintptr(pvReserved),
1226
		uintptr(unsafe.Pointer(pNumFonts)),
1227
		0,
1228
		0)
1229

1230
	return HANDLE(ret)
1231
}
1232

1233
func AlphaBlend(hdcDest HDC, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest int32, hdcSrc HDC, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc int32, ftn BLENDFUNCTION) bool {
1234
	ret, _, _ := syscall.Syscall12(alphaBlend.Addr(), 11,
1235
		uintptr(hdcDest),
1236
		uintptr(nXOriginDest),
1237
		uintptr(nYOriginDest),
1238
		uintptr(nWidthDest),
1239
		uintptr(nHeightDest),
1240
		uintptr(hdcSrc),
1241
		uintptr(nXOriginSrc),
1242
		uintptr(nYOriginSrc),
1243
		uintptr(nWidthSrc),
1244
		uintptr(nHeightSrc),
1245
		uintptr(*(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&ftn))))),
1246
		0)
1247

1248
	return ret != 0
1249
}
1250

1251
func BitBlt(hdcDest HDC, nXDest, nYDest, nWidth, nHeight int32, hdcSrc HDC, nXSrc, nYSrc int32, dwRop uint32) bool {
1252
	ret, _, _ := syscall.Syscall9(bitBlt.Addr(), 9,
1253
		uintptr(hdcDest),
1254
		uintptr(nXDest),
1255
		uintptr(nYDest),
1256
		uintptr(nWidth),
1257
		uintptr(nHeight),
1258
		uintptr(hdcSrc),
1259
		uintptr(nXSrc),
1260
		uintptr(nYSrc),
1261
		uintptr(dwRop))
1262

1263
	return ret != 0
1264
}
1265

1266
func ChoosePixelFormat(hdc HDC, ppfd *PIXELFORMATDESCRIPTOR) int32 {
1267
	ret, _, _ := syscall.Syscall(choosePixelFormat.Addr(), 2,
1268
		uintptr(hdc),
1269
		uintptr(unsafe.Pointer(ppfd)),
1270
		0)
1271

1272
	return int32(ret)
1273
}
1274

1275
func CloseEnhMetaFile(hdc HDC) HENHMETAFILE {
1276
	ret, _, _ := syscall.Syscall(closeEnhMetaFile.Addr(), 1,
1277
		uintptr(hdc),
1278
		0,
1279
		0)
1280

1281
	return HENHMETAFILE(ret)
1282
}
1283

1284
func CombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2 HRGN, fnCombineMode int32) int32 {
1285
	ret, _, _ := syscall.Syscall6(combineRgn.Addr(), 4,
1286
		uintptr(hrgnDest),
1287
		uintptr(hrgnSrc1),
1288
		uintptr(hrgnSrc2),
1289
		uintptr(fnCombineMode),
1290
		0,
1291
		0)
1292

1293
	return int32(ret)
1294
}
1295

1296
func CopyEnhMetaFile(hemfSrc HENHMETAFILE, lpszFile *uint16) HENHMETAFILE {
1297
	ret, _, _ := syscall.Syscall(copyEnhMetaFile.Addr(), 2,
1298
		uintptr(hemfSrc),
1299
		uintptr(unsafe.Pointer(lpszFile)),
1300
		0)
1301

1302
	return HENHMETAFILE(ret)
1303
}
1304

1305
func CreateBitmap(nWidth, nHeight int32, cPlanes, cBitsPerPel uint32, lpvBits unsafe.Pointer) HBITMAP {
1306
	ret, _, _ := syscall.Syscall6(createBitmap.Addr(), 5,
1307
		uintptr(nWidth),
1308
		uintptr(nHeight),
1309
		uintptr(cPlanes),
1310
		uintptr(cBitsPerPel),
1311
		uintptr(lpvBits),
1312
		0)
1313

1314
	return HBITMAP(ret)
1315
}
1316

1317
func CreateCompatibleBitmap(hdc HDC, nWidth, nHeight int32) HBITMAP {
1318
	ret, _, _ := syscall.Syscall(createCompatibleBitmap.Addr(), 3,
1319
		uintptr(hdc),
1320
		uintptr(nWidth),
1321
		uintptr(nHeight))
1322

1323
	return HBITMAP(ret)
1324
}
1325

1326
func CreateBrushIndirect(lplb *LOGBRUSH) HBRUSH {
1327
	ret, _, _ := syscall.Syscall(createBrushIndirect.Addr(), 1,
1328
		uintptr(unsafe.Pointer(lplb)),
1329
		0,
1330
		0)
1331

1332
	return HBRUSH(ret)
1333
}
1334

1335
func CreateCompatibleDC(hdc HDC) HDC {
1336
	ret, _, _ := syscall.Syscall(createCompatibleDC.Addr(), 1,
1337
		uintptr(hdc),
1338
		0,
1339
		0)
1340

1341
	return HDC(ret)
1342
}
1343

1344
func CreateDC(lpszDriver, lpszDevice, lpszOutput *uint16, lpInitData *DEVMODE) HDC {
1345
	ret, _, _ := syscall.Syscall6(createDC.Addr(), 4,
1346
		uintptr(unsafe.Pointer(lpszDriver)),
1347
		uintptr(unsafe.Pointer(lpszDevice)),
1348
		uintptr(unsafe.Pointer(lpszOutput)),
1349
		uintptr(unsafe.Pointer(lpInitData)),
1350
		0,
1351
		0)
1352

1353
	return HDC(ret)
1354
}
1355

1356
func CreateDIBSection(hdc HDC, pbmih *BITMAPINFOHEADER, iUsage uint32, ppvBits *unsafe.Pointer, hSection HANDLE, dwOffset uint32) HBITMAP {
1357
	ret, _, _ := syscall.Syscall6(createDIBSection.Addr(), 6,
1358
		uintptr(hdc),
1359
		uintptr(unsafe.Pointer(pbmih)),
1360
		uintptr(iUsage),
1361
		uintptr(unsafe.Pointer(ppvBits)),
1362
		uintptr(hSection),
1363
		uintptr(dwOffset))
1364

1365
	return HBITMAP(ret)
1366
}
1367

1368
func CreateEnhMetaFile(hdcRef HDC, lpFilename *uint16, lpRect *RECT, lpDescription *uint16) HDC {
1369
	ret, _, _ := syscall.Syscall6(createEnhMetaFile.Addr(), 4,
1370
		uintptr(hdcRef),
1371
		uintptr(unsafe.Pointer(lpFilename)),
1372
		uintptr(unsafe.Pointer(lpRect)),
1373
		uintptr(unsafe.Pointer(lpDescription)),
1374
		0,
1375
		0)
1376

1377
	return HDC(ret)
1378
}
1379

1380
func CreateFontIndirect(lplf *LOGFONT) HFONT {
1381
	ret, _, _ := syscall.Syscall(createFontIndirect.Addr(), 1,
1382
		uintptr(unsafe.Pointer(lplf)),
1383
		0,
1384
		0)
1385

1386
	return HFONT(ret)
1387
}
1388

1389
func CreateIC(lpszDriver, lpszDevice, lpszOutput *uint16, lpdvmInit *DEVMODE) HDC {
1390
	ret, _, _ := syscall.Syscall6(createIC.Addr(), 4,
1391
		uintptr(unsafe.Pointer(lpszDriver)),
1392
		uintptr(unsafe.Pointer(lpszDevice)),
1393
		uintptr(unsafe.Pointer(lpszOutput)),
1394
		uintptr(unsafe.Pointer(lpdvmInit)),
1395
		0,
1396
		0)
1397

1398
	return HDC(ret)
1399
}
1400

1401
func CreatePatternBrush(hbmp HBITMAP) HBRUSH {
1402
	ret, _, _ := syscall.Syscall(createPatternBrush.Addr(), 1,
1403
		uintptr(hbmp),
1404
		0,
1405
		0)
1406

1407
	return HBRUSH(ret)
1408
}
1409

1410
func CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect int32) HRGN {
1411
	ret, _, _ := syscall.Syscall6(createRectRgn.Addr(), 4,
1412
		uintptr(nLeftRect),
1413
		uintptr(nTopRect),
1414
		uintptr(nRightRect),
1415
		uintptr(nBottomRect),
1416
		0,
1417
		0)
1418

1419
	return HRGN(ret)
1420
}
1421

1422
func DeleteDC(hdc HDC) bool {
1423
	ret, _, _ := syscall.Syscall(deleteDC.Addr(), 1,
1424
		uintptr(hdc),
1425
		0,
1426
		0)
1427

1428
	return ret != 0
1429
}
1430

1431
func DeleteEnhMetaFile(hemf HENHMETAFILE) bool {
1432
	ret, _, _ := syscall.Syscall(deleteEnhMetaFile.Addr(), 1,
1433
		uintptr(hemf),
1434
		0,
1435
		0)
1436

1437
	return ret != 0
1438
}
1439

1440
func DeleteObject(hObject HGDIOBJ) bool {
1441
	ret, _, _ := syscall.Syscall(deleteObject.Addr(), 1,
1442
		uintptr(hObject),
1443
		0,
1444
		0)
1445

1446
	return ret != 0
1447
}
1448

1449
func Ellipse(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect int32) bool {
1450
	ret, _, _ := syscall.Syscall6(ellipse.Addr(), 5,
1451
		uintptr(hdc),
1452
		uintptr(nLeftRect),
1453
		uintptr(nTopRect),
1454
		uintptr(nRightRect),
1455
		uintptr(nBottomRect),
1456
		0)
1457

1458
	return ret != 0
1459
}
1460

1461
func EndDoc(hdc HDC) int32 {
1462
	ret, _, _ := syscall.Syscall(endDoc.Addr(), 1,
1463
		uintptr(hdc),
1464
		0,
1465
		0)
1466

1467
	return int32(ret)
1468
}
1469

1470
func EndPage(hdc HDC) int32 {
1471
	ret, _, _ := syscall.Syscall(endPage.Addr(), 1,
1472
		uintptr(hdc),
1473
		0,
1474
		0)
1475

1476
	return int32(ret)
1477
}
1478

1479
func ExcludeClipRect(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect int32) int32 {
1480
	ret, _, _ := syscall.Syscall6(excludeClipRect.Addr(), 5,
1481
		uintptr(hdc),
1482
		uintptr(nLeftRect),
1483
		uintptr(nTopRect),
1484
		uintptr(nRightRect),
1485
		uintptr(nBottomRect),
1486
		0)
1487

1488
	return int32(ret)
1489
}
1490

1491
func ExtCreatePen(dwPenStyle, dwWidth uint32, lplb *LOGBRUSH, dwStyleCount uint32, lpStyle *uint32) HPEN {
1492
	ret, _, _ := syscall.Syscall6(extCreatePen.Addr(), 5,
1493
		uintptr(dwPenStyle),
1494
		uintptr(dwWidth),
1495
		uintptr(unsafe.Pointer(lplb)),
1496
		uintptr(dwStyleCount),
1497
		uintptr(unsafe.Pointer(lpStyle)),
1498
		0)
1499

1500
	return HPEN(ret)
1501
}
1502

1503
func FillRgn(hdc HDC, hrgn HRGN, hbr HBRUSH) bool {
1504
	ret, _, _ := syscall.Syscall(fillRgn.Addr(), 3,
1505
		uintptr(hdc),
1506
		uintptr(hrgn),
1507
		uintptr(hbr))
1508

1509
	return ret != 0
1510
}
1511

1512
func GdiFlush() bool {
1513
	ret, _, _ := syscall.Syscall(gdiFlush.Addr(), 0,
1514
		0,
1515
		0,
1516
		0)
1517

1518
	return ret != 0
1519
}
1520

1521
func GetBkColor(hdc HDC) COLORREF {
1522
	ret, _, _ := syscall.Syscall(getBkColor.Addr(), 1,
1523
		uintptr(hdc),
1524
		0,
1525
		0)
1526

1527
	return COLORREF(ret)
1528
}
1529

1530
func GetDeviceCaps(hdc HDC, nIndex int32) int32 {
1531
	ret, _, _ := syscall.Syscall(getDeviceCaps.Addr(), 2,
1532
		uintptr(hdc),
1533
		uintptr(nIndex),
1534
		0)
1535

1536
	return int32(ret)
1537
}
1538

1539
func GetDIBits(hdc HDC, hbmp HBITMAP, uStartScan uint32, cScanLines uint32, lpvBits *byte, lpbi *BITMAPINFO, uUsage uint32) int32 {
1540
	ret, _, _ := syscall.Syscall9(getDIBits.Addr(), 7,
1541
		uintptr(hdc),
1542
		uintptr(hbmp),
1543
		uintptr(uStartScan),
1544
		uintptr(cScanLines),
1545
		uintptr(unsafe.Pointer(lpvBits)),
1546
		uintptr(unsafe.Pointer(lpbi)),
1547
		uintptr(uUsage),
1548
		0,
1549
		0)
1550
	return int32(ret)
1551
}
1552

1553
func GetEnhMetaFile(lpszMetaFile *uint16) HENHMETAFILE {
1554
	ret, _, _ := syscall.Syscall(getEnhMetaFile.Addr(), 1,
1555
		uintptr(unsafe.Pointer(lpszMetaFile)),
1556
		0,
1557
		0)
1558

1559
	return HENHMETAFILE(ret)
1560
}
1561

1562
func GetEnhMetaFileHeader(hemf HENHMETAFILE, cbBuffer uint32, lpemh *ENHMETAHEADER) uint32 {
1563
	ret, _, _ := syscall.Syscall(getEnhMetaFileHeader.Addr(), 3,
1564
		uintptr(hemf),
1565
		uintptr(cbBuffer),
1566
		uintptr(unsafe.Pointer(lpemh)))
1567

1568
	return uint32(ret)
1569
}
1570

1571
func GetObject(hgdiobj HGDIOBJ, cbBuffer uintptr, lpvObject unsafe.Pointer) int32 {
1572
	ret, _, _ := syscall.Syscall(getObject.Addr(), 3,
1573
		uintptr(hgdiobj),
1574
		uintptr(cbBuffer),
1575
		uintptr(lpvObject))
1576

1577
	return int32(ret)
1578
}
1579

1580
func GetPixel(hdc HDC, nXPos, nYPos int32) COLORREF {
1581
	ret, _, _ := syscall.Syscall(getPixel.Addr(), 3,
1582
		uintptr(hdc),
1583
		uintptr(nXPos),
1584
		uintptr(nYPos))
1585

1586
	return COLORREF(ret)
1587
}
1588

1589
func GetRgnBox(hrgn HRGN, lprc *RECT) int32 {
1590
	ret, _, _ := syscall.Syscall(getRgnBox.Addr(), 2,
1591
		uintptr(hrgn),
1592
		uintptr(unsafe.Pointer(lprc)),
1593
		0)
1594

1595
	return int32(ret)
1596
}
1597

1598
func GetStockObject(fnObject int32) HGDIOBJ {
1599
	ret, _, _ := syscall.Syscall(getStockObject.Addr(), 1,
1600
		uintptr(fnObject),
1601
		0,
1602
		0)
1603

1604
	return HGDIOBJ(ret)
1605
}
1606

1607
func GetTextColor(hdc HDC) COLORREF {
1608
	ret, _, _ := syscall.Syscall(getTextColor.Addr(), 1,
1609
		uintptr(hdc),
1610
		0,
1611
		0)
1612

1613
	return COLORREF(ret)
1614
}
1615

1616
func GetTextExtentExPoint(hdc HDC, lpszStr *uint16, cchString, nMaxExtent int32, lpnFit, alpDx *int32, lpSize *SIZE) bool {
1617
	ret, _, _ := syscall.Syscall9(getTextExtentExPoint.Addr(), 7,
1618
		uintptr(hdc),
1619
		uintptr(unsafe.Pointer(lpszStr)),
1620
		uintptr(cchString),
1621
		uintptr(nMaxExtent),
1622
		uintptr(unsafe.Pointer(lpnFit)),
1623
		uintptr(unsafe.Pointer(alpDx)),
1624
		uintptr(unsafe.Pointer(lpSize)),
1625
		0,
1626
		0)
1627

1628
	return ret != 0
1629
}
1630

1631
func GetTextExtentPoint32(hdc HDC, lpString *uint16, c int32, lpSize *SIZE) bool {
1632
	ret, _, _ := syscall.Syscall6(getTextExtentPoint32.Addr(), 4,
1633
		uintptr(hdc),
1634
		uintptr(unsafe.Pointer(lpString)),
1635
		uintptr(c),
1636
		uintptr(unsafe.Pointer(lpSize)),
1637
		0,
1638
		0)
1639

1640
	return ret != 0
1641
}
1642

1643
func GetTextMetrics(hdc HDC, lptm *TEXTMETRIC) bool {
1644
	ret, _, _ := syscall.Syscall(getTextMetrics.Addr(), 2,
1645
		uintptr(hdc),
1646
		uintptr(unsafe.Pointer(lptm)),
1647
		0)
1648

1649
	return ret != 0
1650
}
1651

1652
func GetViewportOrgEx(hdc HDC, lpPoint *POINT) bool {
1653
	ret, _, _ := syscall.Syscall(getViewportOrgEx.Addr(), 2,
1654
		uintptr(hdc),
1655
		uintptr(unsafe.Pointer(lpPoint)),
1656
		0)
1657

1658
	return ret != 0
1659
}
1660

1661
func GradientFill(hdc HDC, pVertex *TRIVERTEX, nVertex uint32, pMesh unsafe.Pointer, nMesh, ulMode uint32) bool {
1662
	ret, _, _ := syscall.Syscall6(gradientFill.Addr(), 6,
1663
		uintptr(hdc),
1664
		uintptr(unsafe.Pointer(pVertex)),
1665
		uintptr(nVertex),
1666
		uintptr(pMesh),
1667
		uintptr(nMesh),
1668
		uintptr(ulMode))
1669

1670
	return ret != 0
1671
}
1672

1673
func IntersectClipRect(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect int32) int32 {
1674
	ret, _, _ := syscall.Syscall6(intersectClipRect.Addr(), 5,
1675
		uintptr(hdc),
1676
		uintptr(nLeftRect),
1677
		uintptr(nTopRect),
1678
		uintptr(nRightRect),
1679
		uintptr(nBottomRect),
1680
		0)
1681

1682
	return int32(ret)
1683
}
1684

1685
func LineTo(hdc HDC, nXEnd, nYEnd int32) bool {
1686
	ret, _, _ := syscall.Syscall(lineTo.Addr(), 3,
1687
		uintptr(hdc),
1688
		uintptr(nXEnd),
1689
		uintptr(nYEnd))
1690

1691
	return ret != 0
1692
}
1693

1694
func MoveToEx(hdc HDC, x, y int, lpPoint *POINT) bool {
1695
	ret, _, _ := syscall.Syscall6(moveToEx.Addr(), 4,
1696
		uintptr(hdc),
1697
		uintptr(x),
1698
		uintptr(y),
1699
		uintptr(unsafe.Pointer(lpPoint)),
1700
		0,
1701
		0)
1702

1703
	return ret != 0
1704
}
1705

1706
func PlayEnhMetaFile(hdc HDC, hemf HENHMETAFILE, lpRect *RECT) bool {
1707
	ret, _, _ := syscall.Syscall(playEnhMetaFile.Addr(), 3,
1708
		uintptr(hdc),
1709
		uintptr(hemf),
1710
		uintptr(unsafe.Pointer(lpRect)))
1711

1712
	return ret != 0
1713
}
1714

1715
func Polyline(hdc HDC, lppt unsafe.Pointer, cPoints int32) bool {
1716
	ret, _, _ := syscall.Syscall(polyline.Addr(), 3,
1717
		uintptr(hdc),
1718
		uintptr(lppt),
1719
		uintptr(cPoints))
1720

1721
	return ret != 0
1722
}
1723

1724
func Rectangle_(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect int32) bool {
1725
	ret, _, _ := syscall.Syscall6(rectangle.Addr(), 5,
1726
		uintptr(hdc),
1727
		uintptr(nLeftRect),
1728
		uintptr(nTopRect),
1729
		uintptr(nRightRect),
1730
		uintptr(nBottomRect),
1731
		0)
1732

1733
	return ret != 0
1734
}
1735

1736
func RemoveFontResourceEx(lpszFilename *uint16, fl uint32, pdv unsafe.Pointer) bool {
1737
	ret, _, _ := syscall.Syscall(removeFontResourceEx.Addr(), 3,
1738
		uintptr(unsafe.Pointer(lpszFilename)),
1739
		uintptr(fl),
1740
		uintptr(pdv))
1741

1742
	return ret != 0
1743
}
1744

1745
func RemoveFontMemResourceEx(h HANDLE) bool {
1746
	ret, _, _ := syscall.Syscall(removeFontMemResourceEx.Addr(), 1,
1747
		uintptr(h),
1748
		0,
1749
		0)
1750

1751
	return ret != 0
1752
}
1753

1754
func ResetDC(hdc HDC, lpInitData *DEVMODE) HDC {
1755
	ret, _, _ := syscall.Syscall(resetDC.Addr(), 2,
1756
		uintptr(hdc),
1757
		uintptr(unsafe.Pointer(lpInitData)),
1758
		0)
1759

1760
	return HDC(ret)
1761
}
1762

1763
func RestoreDC(hdc HDC, nSaveDC int32) bool {
1764
	ret, _, _ := syscall.Syscall(restoreDC.Addr(), 2,
1765
		uintptr(hdc),
1766
		uintptr(nSaveDC),
1767
		0)
1768
	return ret != 0
1769
}
1770

1771
func RoundRect(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect, nWidth, nHeight int32) bool {
1772
	ret, _, _ := syscall.Syscall9(roundRect.Addr(), 7,
1773
		uintptr(hdc),
1774
		uintptr(nLeftRect),
1775
		uintptr(nTopRect),
1776
		uintptr(nRightRect),
1777
		uintptr(nBottomRect),
1778
		uintptr(nWidth),
1779
		uintptr(nHeight),
1780
		0,
1781
		0)
1782

1783
	return ret != 0
1784
}
1785

1786
func SaveDC(hdc HDC) int32 {
1787
	ret, _, _ := syscall.Syscall(saveDC.Addr(), 1,
1788
		uintptr(hdc),
1789
		0,
1790
		0)
1791
	return int32(ret)
1792
}
1793

1794
func SelectObject(hdc HDC, hgdiobj HGDIOBJ) HGDIOBJ {
1795
	ret, _, _ := syscall.Syscall(selectObject.Addr(), 2,
1796
		uintptr(hdc),
1797
		uintptr(hgdiobj),
1798
		0)
1799

1800
	return HGDIOBJ(ret)
1801
}
1802

1803
func SetBkColor(hdc HDC, crColor COLORREF) COLORREF {
1804
	ret, _, _ := syscall.Syscall(setBkColor.Addr(), 2,
1805
		uintptr(hdc),
1806
		uintptr(crColor),
1807
		0)
1808

1809
	return COLORREF(ret)
1810
}
1811

1812
func SetBkMode(hdc HDC, iBkMode int32) int32 {
1813
	ret, _, _ := syscall.Syscall(setBkMode.Addr(), 2,
1814
		uintptr(hdc),
1815
		uintptr(iBkMode),
1816
		0)
1817

1818
	return int32(ret)
1819
}
1820

1821
func SetBrushOrgEx(hdc HDC, nXOrg, nYOrg int32, lppt *POINT) bool {
1822
	ret, _, _ := syscall.Syscall6(setBrushOrgEx.Addr(), 4,
1823
		uintptr(hdc),
1824
		uintptr(nXOrg),
1825
		uintptr(nYOrg),
1826
		uintptr(unsafe.Pointer(lppt)),
1827
		0,
1828
		0)
1829

1830
	return ret != 0
1831
}
1832

1833
func SetDIBits(hdc HDC, hbmp HBITMAP, uStartScan, cScanLines uint32, lpvBits *byte, lpbmi *BITMAPINFO, fuColorUse uint32) int32 {
1834
	ret, _, _ := syscall.Syscall9(setDIBits.Addr(), 7,
1835
		uintptr(hdc),
1836
		uintptr(hbmp),
1837
		uintptr(uStartScan),
1838
		uintptr(cScanLines),
1839
		uintptr(unsafe.Pointer(lpvBits)),
1840
		uintptr(unsafe.Pointer(lpbmi)),
1841
		uintptr(fuColorUse),
1842
		0,
1843
		0)
1844

1845
	return int32(ret)
1846
}
1847

1848
func SetPixel(hdc HDC, X, Y int32, crColor COLORREF) COLORREF {
1849
	ret, _, _ := syscall.Syscall6(setPixel.Addr(), 4,
1850
		uintptr(hdc),
1851
		uintptr(X),
1852
		uintptr(Y),
1853
		uintptr(crColor),
1854
		0,
1855
		0)
1856

1857
	return COLORREF(ret)
1858
}
1859

1860
func SetPixelFormat(hdc HDC, iPixelFormat int32, ppfd *PIXELFORMATDESCRIPTOR) bool {
1861
	ret, _, _ := syscall.Syscall(setPixelFormat.Addr(), 3,
1862
		uintptr(hdc),
1863
		uintptr(iPixelFormat),
1864
		uintptr(unsafe.Pointer(ppfd)))
1865

1866
	return ret != 0
1867
}
1868

1869
func SetStretchBltMode(hdc HDC, iStretchMode int32) int32 {
1870
	ret, _, _ := syscall.Syscall(setStretchBltMode.Addr(), 2,
1871
		uintptr(hdc),
1872
		uintptr(iStretchMode),
1873
		0)
1874

1875
	return int32(ret)
1876
}
1877

1878
func SetTextColor(hdc HDC, crColor COLORREF) COLORREF {
1879
	ret, _, _ := syscall.Syscall(setTextColor.Addr(), 2,
1880
		uintptr(hdc),
1881
		uintptr(crColor),
1882
		0)
1883

1884
	return COLORREF(ret)
1885
}
1886

1887
func SetViewportOrgEx(hdc HDC, x, y int32, lpPoint *POINT) COLORREF {
1888
	ret, _, _ := syscall.Syscall6(setViewportOrgEx.Addr(), 4,
1889
		uintptr(hdc),
1890
		uintptr(x),
1891
		uintptr(y),
1892
		uintptr(unsafe.Pointer(lpPoint)),
1893
		0,
1894
		0)
1895

1896
	return COLORREF(ret)
1897
}
1898

1899
func StartDoc(hdc HDC, lpdi *DOCINFO) int32 {
1900
	ret, _, _ := syscall.Syscall(startDoc.Addr(), 2,
1901
		uintptr(hdc),
1902
		uintptr(unsafe.Pointer(lpdi)),
1903
		0)
1904

1905
	return int32(ret)
1906
}
1907

1908
func StartPage(hdc HDC) int32 {
1909
	ret, _, _ := syscall.Syscall(startPage.Addr(), 1,
1910
		uintptr(hdc),
1911
		0,
1912
		0)
1913

1914
	return int32(ret)
1915
}
1916

1917
func StretchBlt(hdcDest HDC, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest int32, hdcSrc HDC, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc int32, dwRop uint32) bool {
1918
	ret, _, _ := syscall.Syscall12(stretchBlt.Addr(), 11,
1919
		uintptr(hdcDest),
1920
		uintptr(nXOriginDest),
1921
		uintptr(nYOriginDest),
1922
		uintptr(nWidthDest),
1923
		uintptr(nHeightDest),
1924
		uintptr(hdcSrc),
1925
		uintptr(nXOriginSrc),
1926
		uintptr(nYOriginSrc),
1927
		uintptr(nWidthSrc),
1928
		uintptr(nHeightSrc),
1929
		uintptr(dwRop),
1930
		0)
1931

1932
	return ret != 0
1933
}
1934

1935
func SwapBuffers(hdc HDC) bool {
1936
	ret, _, _ := syscall.Syscall(swapBuffers.Addr(), 1,
1937
		uintptr(hdc),
1938
		0,
1939
		0)
1940

1941
	return ret != 0
1942
}
1943

1944
func TextOut(hdc HDC, nXStart, nYStart int32, lpString *uint16, cchString int32) bool {
1945
	ret, _, _ := syscall.Syscall6(textOut.Addr(), 5,
1946
		uintptr(hdc),
1947
		uintptr(nXStart),
1948
		uintptr(nYStart),
1949
		uintptr(unsafe.Pointer(lpString)),
1950
		uintptr(cchString),
1951
		0)
1952
	return ret != 0
1953
}
1954

1955
func TransparentBlt(hdcDest HDC, xoriginDest, yoriginDest, wDest, hDest int32, hdcSrc HDC, xoriginSrc, yoriginSrc, wSrc, hSrc int32, crTransparent uint32) bool {
1956
	ret, _, _ := syscall.Syscall12(transparentBlt.Addr(), 11,
1957
		uintptr(hdcDest),
1958
		uintptr(xoriginDest),
1959
		uintptr(yoriginDest),
1960
		uintptr(wDest),
1961
		uintptr(hDest),
1962
		uintptr(hdcSrc),
1963
		uintptr(xoriginSrc),
1964
		uintptr(yoriginSrc),
1965
		uintptr(wSrc),
1966
		uintptr(hSrc),
1967
		uintptr(crTransparent),
1968
		0)
1969

1970
	return ret != 0
1971
}
1972

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.