2 * DC device-independent Get/SetXXX functions
4 * Copyright 1993 Alexandre Julliard
6 static char Copyright[] = "Copyright Alexandre Julliard, 1993";
12 #define DC_GET_VAL( func_type, func_name, dc_field ) \
13 func_type func_name( HDC hdc ) \
15 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
17 return dc->w.dc_field; \
20 #define DC_GET_X_Y( func_type, func_name, ret_x, ret_y ) \
21 func_type func_name( HDC hdc ) \
23 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
25 return MAKELONG( dc->w.ret_x, dc->w.ret_y ); \
28 #define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \
29 BOOL func_name( HDC hdc, LPPOINT pt ) \
31 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
32 if (!dc) return FALSE; \
33 pt->x = dc->w.ret_x; \
34 pt->y = dc->w.ret_y; \
38 #define DC_SET_MODE( func_name, dc_field, min_val, max_val, meta_func ) \
39 WORD func_name( HDC hdc, WORD mode ) \
42 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
43 if ((mode < min_val) || (mode > max_val)) return 0; \
45 dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); \
47 MF_MetaParam1(dc, meta_func, mode); \
50 prevMode = dc->w.dc_field; \
51 dc->w.dc_field = mode; \
56 DC_SET_MODE( SetBkMode
, backgroundMode
, TRANSPARENT
, OPAQUE
,
57 META_SETBKMODE
) /* GDI.2 */
58 DC_SET_MODE( SetROP2
, ROPmode
, R2_BLACK
, R2_WHITE
, META_SETROP2
) /* GDI.4 */
59 DC_SET_MODE( SetRelAbs
, relAbsMode
, ABSOLUTE
, RELATIVE
,
60 META_SETRELABS
) /* GDI.5 */
61 DC_SET_MODE( SetPolyFillMode
, polyFillMode
, ALTERNATE
, WINDING
,
62 META_SETPOLYFILLMODE
) /* GDI.6 */
63 DC_SET_MODE( SetStretchBltMode
, stretchBltMode
,
64 BLACKONWHITE
, COLORONCOLOR
, META_SETSTRETCHBLTMODE
) /* GDI.7 */
65 DC_GET_VAL( COLORREF
, GetBkColor
, backgroundColor
) /* GDI.75 */
66 DC_GET_VAL( WORD
, GetBkMode
, backgroundMode
) /* GDI.76 */
67 DC_GET_X_Y( DWORD
, GetCurrentPosition
, CursPosX
, CursPosY
) /* GDI.78 */
68 DC_GET_VAL( WORD
, GetMapMode
, MapMode
) /* GDI.81 */
69 DC_GET_VAL( WORD
, GetPolyFillMode
, polyFillMode
) /* GDI.84 */
70 DC_GET_VAL( WORD
, GetROP2
, ROPmode
) /* GDI.85 */
71 DC_GET_VAL( WORD
, GetRelAbs
, relAbsMode
) /* GDI.86 */
72 DC_GET_VAL( WORD
, GetStretchBltMode
, stretchBltMode
) /* GDI.88 */
73 DC_GET_VAL( COLORREF
, GetTextColor
, textColor
) /* GDI.90 */
74 DC_GET_X_Y( DWORD
, GetViewportExt
, VportExtX
, VportExtY
) /* GDI.94 */
75 DC_GET_X_Y( DWORD
, GetViewportOrg
, VportOrgX
, VportOrgY
) /* GDI.95 */
76 DC_GET_X_Y( DWORD
, GetWindowExt
, WndExtX
, WndExtY
) /* GDI.96 */
77 DC_GET_X_Y( DWORD
, GetWindowOrg
, WndOrgX
, WndOrgY
) /* GDI.97 */
78 DC_GET_VAL( HRGN
, InquireVisRgn
, hVisRgn
) /* GDI.131 */
79 DC_GET_X_Y( DWORD
, GetBrushOrg
, brushOrgX
, brushOrgY
) /* GDI.149 */
80 DC_GET_VAL( HRGN
, GetClipRgn
, hClipRgn
) /* GDI.173 */
81 DC_GET_VAL( WORD
, GetTextAlign
, textAlign
) /* GDI.345 */
82 DC_GET_VAL( HFONT
, GetCurLogFont
, hFont
) /* GDI.411 */
83 DC_GET_VAL_EX( GetBrushOrgEx
, brushOrgX
, brushOrgY
) /* GDI.469 */
84 DC_GET_VAL_EX( GetCurrentPositionEx
, CursPosX
, CursPosY
) /* GDI.470 */
85 DC_GET_VAL_EX( GetViewportExtEx
, VportExtX
, VportExtY
) /* GDI.472 */
86 DC_GET_VAL_EX( GetViewportOrgEx
, VportOrgX
, VportOrgY
) /* GDI.473 */
87 DC_GET_VAL_EX( GetWindowExtEx
, WndExtX
, WndExtY
) /* GDI.474 */
88 DC_GET_VAL_EX( GetWindowOrgEx
, WndOrgX
, WndOrgY
) /* GDI.475 */