winsafe\gdi/co.rs
1#![allow(non_camel_case_types, non_upper_case_globals)]
2
3const_ordinary! { AD: i32;
4 /// [`HDC::SetArcDirection`](crate::HDC::SetArcDirection) `dir` (`i32`).
5 =>
6 COUNTERCLOCKWISE 1
7 CLOCKWISE 2
8}
9
10const_ordinary! { BI: u32;
11 /// [`BITMAPINFOHEADER`](crate::BITMAPINFOHEADER) `biCompression` (`u32`).
12 =>
13 RGB 0
14 RLE8 1
15 RLE4 2
16 BITFIELDS 3
17 JPEG 4
18 PNG 5
19}
20
21const_ordinary! { BKMODE: i32;
22 /// [`HDC::SetBkMode`](crate::HDC::SetBkMode) `mode` (`i32`).
23 =>
24 TRANSPARENT 1
25 OPAQUE 2
26}
27
28const_ordinary! { BSS: u32;
29 /// [`LOGBRUSH`](crate::LOGBRUSH) `lbStyle` (`u32`).
30 ///
31 /// Originally has `BS` prefix.
32 =>
33 SOLID 0
34 NULL 1
35 HOLLOW Self::NULL.0
36 HATCHED 2
37 PATTERN 3
38 INDEXED 4
39 DIBPATTERN 5
40 DIBPATTERNPT 6
41 PATTERN8X8 7
42 DIBPATTERN8X8 8
43 MONOPATTERN 9
44}
45
46const_ordinary! { CHARSET: u8;
47 /// [`HFONT::CreateFont`](crate::HFONT::CreateFont) `char_set` and
48 /// [`LOGFONT`](crate::LOGFONT) `lfCharset` (`u8`).
49 =>
50 ANSI 0
51 DEFAULT 1
52 SYMBOL 2
53 SHIFTJIS 128
54 HANGEUL 129
55 HANGUL 129
56 GB2312 134
57 CHINESEBIG5 136
58 OEM 255
59 JOHAB 130
60 HEBREW 177
61 ARABIC 178
62 GREEK 161
63 TURKISH 162
64 VIETNAMESE 163
65 THAI 222
66 EASTEUROPE 238
67 RUSSIAN 204
68 MAC 77
69 BALTIC 186
70}
71
72const_ordinary! { CLIP: u8;
73 /// [`HFONT::CreateFont`](crate::HFONT::CreateFont) `clip_precision` and
74 /// [`LOGFONT`](crate::LOGFONT) `lfClipPrecision`
75 /// (`u8`).
76 =>
77 DEFAULT_PRECIS 0
78 CHARACTER_PRECIS 1
79 STROKE_PRECIS 2
80 MASK 0xf
81 LH_ANGLES 1 << 4
82 TT_ALWAYS 2 << 4
83 DFA_DISABLE 4 << 4
84 EMBEDDED 8 << 4
85}
86
87const_ordinary! { CUR_OBJ: u32;
88 /// [`HDC::GetCurrentObject`](crate::HDC::GetCurrentObject) `kind` (`u32`).
89 ///
90 /// Originally has `OBJ` prefix.
91 =>
92 BITMAP 7
93 BRUSH 2
94 FONT 6
95 PAL 5
96 PEN 1
97}
98
99const_ordinary! { DIB: u32;
100 /// [`LOGBRUSH`](crate::LOGBRUSH) `lbColor` (`u32`).
101 =>
102 /// The color table consists of an array of 16-bit indexes into the
103 /// currently realized logical palette.
104 RGB_COLORS 0
105 /// The color table contains literal RGB values.
106 PAL_COLORS 1
107}
108
109const_ordinary! { FF: u8;
110 /// [`LOGFONT`](crate::LOGFONT) `lfPitchAndFamily` (`u8`) used with
111 /// [`PITCH`](crate::co::PITCH).
112 =>
113 DONTCARE 0 << 4
114 ROMAN 1 << 4
115 SWISS 2 << 4
116 MODERN 3 << 4
117 SCRIPT 4 << 4
118 DECORATIVE 5 << 4
119}
120
121const_ordinary! { FW: u32;
122 /// [`HFONT::CreateFont`](crate::HFONT::CreateFont) `weight` and
123 /// [`LOGFONT`](crate::LOGFONT) `lfWeight` (`u32`).
124 =>
125 DONTCARE 0
126 THIN 100
127 EXTRALIGHT 200
128 ULTRALIGHT Self::EXTRALIGHT.0
129 LIGHT 300
130 NORMAL 400
131 REGULAR 400
132 MEDIUM 500
133 SEMIBOLD 600
134 DEMIBOLD Self::SEMIBOLD.0
135 BOLD 700
136 EXTRABOLD 800
137 ULTRABOLD Self::EXTRABOLD.0
138 HEAVY 900
139 BLACK Self::HEAVY.0
140}
141
142const_ordinary! { GDC: i32;
143 /// [`HDC::GetDeviceCaps`](crate::HDC::GetDeviceCaps) `index` (`i32`).
144 ///
145 /// Originally has no prefix.
146 =>
147 DRIVERVERSION 0
148 TECHNOLOGY 2
149 HORZSIZE 4
150 VERTSIZE 6
151 HORZRES 8
152 VERTRES 10
153 BITSPIXEL 12
154 PLANES 14
155 NUMBRUSHES 16
156 NUMPENS 18
157 NUMMARKERS 20
158 NUMFONTS 22
159 NUMCOLORS 24
160 PDEVICESIZE 26
161 CURVECAPS 28
162 LINECAPS 30
163 POLYGONALCAPS 32
164 TEXTCAPS 34
165 CLIPCAPS 36
166 RASTERCAPS 38
167 ASPECTX 40
168 ASPECTY 42
169 ASPECTXY 44
170 LOGPIXELSX 88
171 LOGPIXELSY 90
172 SIZEPALETTE 104
173 NUMRESERVED 106
174 COLORRES 108
175 PHYSICALWIDTH 110
176 PHYSICALHEIGHT 111
177 PHYSICALOFFSETX 112
178 PHYSICALOFFSETY 113
179 SCALINGFACTORX 114
180 SCALINGFACTORY 115
181 VREFRESH 116
182 DESKTOPVERTRES 117
183 DESKTOPHORZRES 118
184 BLTALIGNMENT 119
185 SHADEBLENDCAPS 120
186 COLORMGMTCAPS 121
187}
188
189const_ordinary! { GM: i32;
190 /// [`HDC::SetGraphicsMode`](crate::HDC::SetGraphicsMode) `mode` (`i32`).
191 =>
192 COMPATIBLE 1
193 ADVANCED 2
194}
195
196const_ordinary! { HS: i32;
197 /// [`HBRUSH::CreateHatchBrush`](crate::HBRUSH::CreateHatchBrush) `hatch`
198 /// (`i32`).
199 =>
200 /// Horizontal hatch: `-----`.
201 HORIZONTAL 0
202 /// Vertical hatch: `|||||`.
203 VERTICAL 1
204 /// 45-degree downward left-to-right hatch: `\\\\\`.
205 FDIAGONAL 2
206 /// 45-degree upward left-to-right hatch: `/////`.
207 BDIAGONAL 3
208 /// Horizontal and vertical crosshatch: `+++++`.
209 CROSS 4
210 /// 45-degree crosshatch: `xxxxx`.
211 DIAGCROSS 5
212}
213
214const_bitflag! { LR: u32;
215 /// [`HINSTANCE::LoadImageBitmap`](crate::HINSTANCE::LoadImageBitmap),
216 /// [`HINSTANCE::LoadImageCursor`](crate::HINSTANCE::LoadImageCursor) and
217 /// [`HINSTANCE::LoadImageIcon`](crate::HINSTANCE::LoadImageIcon) `load`
218 /// (`u32`).
219 =>
220 DEFAULTCOLOR 0x0000_0000
221 MONOCHROME 0x0000_0001
222 COLOR 0x0000_0002
223 COPYRETURNORG 0x0000_0004
224 COPYDELETEORG 0x0000_0008
225 LOADFROMFILE 0x0000_0010
226 LOADTRANSPARENT 0x0000_0020
227 DEFAULTSIZE 0x0000_0040
228 VGACOLOR 0x0000_0080
229 LOADMAP3DCOLORS 0x0000_1000
230 CREATEDIBSECTION 0x0000_2000
231 COPYFROMRESOURCE 0x0000_4000
232 SHARED 0x0000_8000
233}
234
235const_ordinary! { OUT_PRECIS: u8;
236 /// [`HFONT::CreateFont`](crate::HFONT::CreateFont) `out_precision` and
237 /// [`LOGFONT`](crate::LOGFONT) `lfOutPrecision` (`u8`).
238 =>
239 DEFAULT 0
240 STRING 1
241 CHARACTER 2
242 STROKE 3
243 TT 4
244 DEVICE 5
245 RASTER 6
246 TT_ONLY 7
247 OUTLINE 8
248 SCREEN_OUTLINE 9
249 PS_ONLY 10
250}
251
252const_ordinary! { PC: u8;
253 /// [`PALETTEENTRY`](crate::PALETTEENTRY) `peFlags` (`u8`).
254 =>
255 /// None of the actual values (zero).
256 NoValue 0
257 RESERVED 0x01
258 EXPLICIT 0x02
259 NOCOLLAPSE 0x04
260}
261
262const_bitflag! { PFD: u32;
263 /// [`PIXELFORMATDESCRIPTOR`](crate::PIXELFORMATDESCRIPTOR) `dwFlags`
264 /// (`u32`).
265 =>
266 /// None of the actual values (zero).
267 NoValue 0
268
269 DRAW_TO_WINDOW 0x0000_0004
270 DRAW_TO_BITMAP 0x0000_0008
271 SUPPORT_GDI 0x0000_0010
272 SUPPORT_OPENGL 0x0000_0020
273 GENERIC_ACCELERATED 0x0000_1000
274 GENERIC_FORMAT 0x0000_0040
275 NEED_PALETTE 0x0000_0080
276 NEED_SYSTEM_PALETTE 0x0000_0100
277 DOUBLEBUFFER 0x0000_0001
278 STEREO 0x0000_0002
279 SWAP_LAYER_BUFFERS 0x0000_0800
280
281 DEPTH_DONTCARE 0x2000_0000
282 DOUBLEBUFFER_DONTCARE 0x4000_0000
283 STEREO_DONTCARE 0x8000_0000
284
285 SWAP_COPY 0x0000_0400
286 SWAP_EXCHANGE 0x0000_0200
287}
288
289const_bitflag! { PFD_TYPE: u8;
290 /// [`PIXELFORMATDESCRIPTOR`](crate::PIXELFORMATDESCRIPTOR) `iPixelType`
291 /// (`u8`).
292 =>
293 RGBA 0
294 COLORINDEX 1
295}
296
297const_ordinary! { PITCH: u8;
298 /// [`HFONT::CreateFont`](crate::HFONT::CreateFont) `pitch_and_family` and
299 /// [`LOGFONT`](crate::LOGFONT) `lfPitchAndFamily` (`u8`) used with
300 /// [`FF`](crate::co::FF).
301 =>
302 DEFAULT 0
303 FIXED 1
304 VARIABLE 2
305}
306impl PITCH {
307 /// Composes [`LOGFONT`](crate::LOGFONT) `lfPitchAndFamily`.
308 pub fn add_family(&mut self, family: FF) -> &PITCH {
309 self.0 |= family.0;
310 self
311 }
312}
313
314const_ordinary! { PS: i32;
315 /// [`HPEN::CreatePen`](crate::HPEN::CreatePen) `style` (`i32`).
316 =>
317 SOLID 0
318 DASH 1
319 DOT 2
320 DASHDOT 3
321 DASHDOTDOT 4
322 NULL 5
323 INSIDEFRAME 6
324}
325
326const_bitflag! { PT: u8;
327 /// [`HDC::PolyDraw`](crate::HDC::PolyDraw) `aj` (`u8`).
328 =>
329 CLOSEFIGURE 0x01
330 LINETO 0x02
331 BEZIERTO 0x04
332 MOVETO 0x06
333}
334
335const_ordinary! { QUALITY: u8;
336 /// [`HFONT::CreateFont`](crate::HFONT::CreateFont) `quality` and
337 /// [`LOGFONT`](crate::LOGFONT) `lfQuality` (`u8`).
338 =>
339 DEFAULT 0
340 DRAFT 1
341 PROOF 2
342 NONANTIALIASED 3
343 ANTIALIASED 4
344 CLEARTYPE 5
345 CLEARTYPE_NATURAL 6
346}
347
348const_ordinary! { RGN: i32;
349 /// [`HDC::SelectClipPath`](crate::HDC::SelectClipPath) `mode` (`i32`).
350 =>
351 AND 1
352 OR 2
353 XOR 3
354 DIFF 4
355 COPY 5
356}
357
358const_ordinary! { ROP: u32;
359 /// Raster operation code for [`HDC::BitBlt`](crate::HDC::BitBlt),
360 /// [`HDC::PatBlt`](crate::HDC::PatBlt) and
361 /// [`IMAGELISTDRAWPARAMS`](crate::IMAGELISTDRAWPARAMS) (`u32`).
362 ///
363 /// Originally has no prefix.
364 =>
365 /// Copies the source rectangle directly to the destination rectangle.
366 SRCCOPY 0x00cc_0020
367 /// Combines the colors of the source and destination rectangles by using
368 /// the Boolean OR operator.
369 SRCPAINT 0x00ee_0086
370 /// Combines the colors of the source and destination rectangles by using
371 /// the Boolean AND operator.
372 SRCAND 0x0088_00c6
373 /// Combines the colors of the source and destination rectangles by using
374 /// the Boolean XOR operator.
375 SRCINVERT 0x0066_0046
376 /// Combines the inverted colors of the destination rectangle with the
377 /// colors of the source rectangle by using the Boolean AND operator.
378 SRCERASE 0x0044_0328
379 /// Copies the inverted source rectangle to the destination.
380 NOTSRCCOPY 0x0033_0008
381 /// Combines the colors of the source and destination rectangles by using
382 /// the Boolean OR operator and then inverts the resultant color.
383 NOTSRCERASE 0x0011_00a6
384 /// Merges the colors of the source rectangle with the brush currently
385 /// selected in hdcDest, by using the Boolean AND operator.
386 MERGECOPY 0x00c0_00ca
387 /// Merges the colors of the inverted source rectangle with the colors of
388 /// the destination rectangle by using the Boolean OR operator.
389 MERGEPAINT 0x00bb_0226
390 /// Copies the brush currently selected in hdcDest, into the destination
391 /// bitmap.
392 PATCOPY 0x00f0_0021
393 /// Combines the colors of the brush currently selected in hdcDest, with the
394 /// colors of the inverted source rectangle by using the Boolean OR
395 /// operator. The result of this operation is combined with the colors of
396 /// the destination rectangle by using the Boolean OR operator.
397 PATPAINT 0x00fb_0a09
398 /// Combines the colors of the brush currently selected in hdcDest, with the
399 /// colors of the destination rectangle by using the Boolean XOR operator.
400 PATINVERT 0x005a_0049
401 /// Inverts the destination rectangle.
402 DSTINVERT 0x0055_0009
403 /// Fills the destination rectangle using the color associated with index 0
404 /// in the physical palette. (This color is black for the default physical
405 /// palette.)
406 BLACKNESS 0x0000_0042
407 /// Fills the destination rectangle using the color associated with index 1
408 /// in the physical palette. (This color is white for the default physical
409 /// palette.)
410 WHITENESS 0x00ff_0062
411 /// Prevents the bitmap from being mirrored.
412 NOMIRRORBITMAP 0x8000_0000
413 /// Includes any windows that are layered on top of your window in the
414 /// resulting image. By default, the image only contains your window. Note
415 /// that this generally cannot be used for printing device contexts.
416 CAPTUREBLT 0x4000_0000
417}
418
419const_ordinary! { STOCK_BRUSH: i32;
420 /// [`HBRUSH::GetStockObject`](crate::HBRUSH::GetStockObject) `i` (`i32`).
421 =>
422 BLACK 4
423 DKGRAY 3
424 DC 18
425 GRAY 2
426 HOLLOW Self::NULL.0
427 LTGRAY 1
428 NULL 5
429 WHITE 0
430}
431
432const_ordinary! { STOCK_FONT: i32;
433 /// [`HFONT::GetStockObject`](crate::HFONT::GetStockObject) `i` (`i32`).
434 =>
435 ANSI_FIXED 11
436 ANSI_VAR 12
437 DEVICE_DEFAULT 14
438 DEFAULT_GUI 17
439 OEM_FIXED 10
440 SYSTEM 13
441 SYSTEM_FIXED 16
442}
443
444const_ordinary! { STOCK_PEN: i32;
445 /// [`HPEN::GetStockObject`](crate::HPEN::GetStockObject) `i` (`i32`).
446 =>
447 BLACK 7
448 DC 19
449 NULL 8
450 WHITE 6
451}
452
453const_ordinary! { STRETCH_MODE: i32;
454 /// [`HDC::SetStretchBltMode`](crate::HDC::SetStretchBltMode) `mode`
455 /// (`i32`).
456 =>
457 /// Performs a Boolean AND operation using the color values for the
458 /// eliminated and existing pixels. If the bitmap is a monochrome bitmap,
459 /// this mode preserves black pixels at the expense of white pixels.
460 BLACKONWHITE 1
461 /// Deletes the pixels. This mode deletes all eliminated lines of pixels
462 /// without trying to preserve their information.
463 COLORONCOLOR 3
464 /// Maps pixels from the source rectangle into blocks of pixels in the
465 /// destination rectangle. The average color over the destination block of
466 /// pixels approximates the color of the source pixels.
467 ///
468 /// After setting the `HALFTONE` stretching mode, an application must call
469 /// the [`HDC::SetBrushOrgEx`](crate::HDC::SetBrushOrgEx) function to set
470 /// the brush origin. If it fails to do so, brush misalignment occurs.
471 HALFTONE 4
472 /// Same as `BLACKONWHITE`.
473 STRETCH_ANDSCANS Self::BLACKONWHITE.0
474 /// Same as `WHITEONBLACK`.
475 STRETCH_ORSCANS Self::WHITEONBLACK.0
476 /// Same as `COLORONCOLOR`.
477 STRETCH_DELETESCANS Self::COLORONCOLOR.0
478 /// Same as `HALFTONE`.
479 STRETCH_HALFTONE Self::HALFTONE.0
480 /// Performs a Boolean OR operation using the color values for the
481 /// eliminated and existing pixels. If the bitmap is a monochrome bitmap,
482 /// this mode preserves white pixels at the expense of black pixels.
483 WHITEONBLACK 2
484}
485
486const_bitflag! { TA: u32;
487 /// [`HDC::SetTextAlign`](crate::HDC::SetTextAlign) `align` (`u32`).
488 ///
489 /// Also includes constants with `VTA` prefix.
490 =>
491 NOUPDATECP 0
492 UPDATECP 1
493 LEFT 0
494 RIGHT 2
495 CENTER 6
496 TOP 0
497 BOTTOM 8
498 BASELINE 24
499 RTLREADING 256
500}