2 * DC device-independent Get/SetXXX functions
4 * Copyright 1993 Alexandre Julliard
12 #define DC_GET_VAL_16( func_type, func_name, dc_field ) \
13 func_type WINAPI func_name( HDC16 hdc ) \
15 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
17 return dc->dc_field; \
20 #define DC_GET_VAL_32( func_type, func_name, dc_field ) \
21 func_type WINAPI func_name( HDC32 hdc ) \
23 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
25 return dc->dc_field; \
28 #define DC_GET_X_Y( func_type, func_name, ret_x, ret_y ) \
29 func_type WINAPI func_name( HDC16 hdc ) \
31 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
33 return MAKELONG( dc->ret_x, dc->ret_y ); \
36 #define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \
37 BOOL16 WINAPI func_name##16( HDC16 hdc, LPPOINT16 pt ) \
39 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
40 if (!dc) return FALSE; \
46 BOOL32 WINAPI func_name##32( HDC32 hdc, LPPOINT32 pt ) \
48 DC * dc = (DC *) GDI_GetObjPtr( (HDC16)hdc, DC_MAGIC ); \
49 if (!dc) return FALSE; \
55 #define DC_SET_MODE_16( func_name, dc_field, min_val, max_val, meta_func ) \
56 INT16 WINAPI func_name( HDC16 hdc, INT16 mode ) \
59 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
60 if ((mode < min_val) || (mode > max_val)) return 0; \
62 dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); \
64 MF_MetaParam1(dc, meta_func, mode); \
67 prevMode = dc->dc_field; \
68 dc->dc_field = mode; \
72 #define DC_SET_MODE_32( func_name, dc_field, min_val, max_val, meta_func ) \
73 INT32 WINAPI func_name( HDC32 hdc, INT32 mode ) \
76 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
77 if ((mode < min_val) || (mode > max_val)) return 0; \
79 dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); \
81 MF_MetaParam1(dc, meta_func, mode); \
84 prevMode = dc->dc_field; \
85 dc->dc_field = mode; \
90 DC_SET_MODE_16( SetBkMode16
, w
.backgroundMode
, TRANSPARENT
, /* GDI.2 */
91 OPAQUE
, META_SETBKMODE
)
92 DC_SET_MODE_32( SetBkMode32
, w
.backgroundMode
, TRANSPARENT
, /* GDI32.306 */
93 OPAQUE
, META_SETBKMODE
)
94 DC_SET_MODE_16( SetROP216
, w
.ROPmode
, R2_BLACK
, R2_WHITE
, /* GDI.4 */
96 DC_SET_MODE_32( SetROP232
, w
.ROPmode
, R2_BLACK
, R2_WHITE
, /* GDI32.331 */
98 DC_SET_MODE_16( SetRelAbs16
, w
.relAbsMode
, ABSOLUTE
, RELATIVE
, /* GDI.5 */
100 DC_SET_MODE_32( SetRelAbs32
, w
.relAbsMode
, ABSOLUTE
, RELATIVE
, /* GDI32.333 */
102 DC_SET_MODE_16( SetPolyFillMode16
, w
.polyFillMode
, /* GDI.6 */
103 ALTERNATE
, WINDING
, META_SETPOLYFILLMODE
)
104 DC_SET_MODE_32( SetPolyFillMode32
, w
.polyFillMode
, /* GDI32.330 */
105 ALTERNATE
, WINDING
, META_SETPOLYFILLMODE
)
106 DC_SET_MODE_16( SetStretchBltMode16
, w
.stretchBltMode
, /* GDI.7 */
107 BLACKONWHITE
, COLORONCOLOR
, META_SETSTRETCHBLTMODE
)
108 DC_SET_MODE_32( SetStretchBltMode32
, w
.stretchBltMode
, /* GDI32.334 */
109 BLACKONWHITE
, COLORONCOLOR
, META_SETSTRETCHBLTMODE
)
110 DC_GET_VAL_16( COLORREF
, GetBkColor16
, w
.backgroundColor
) /* GDI.75 */
111 DC_GET_VAL_32( COLORREF
, GetBkColor32
, w
.backgroundColor
) /* GDI32.145 */
112 DC_GET_VAL_16( INT16
, GetBkMode16
, w
.backgroundMode
) /* GDI.76 */
113 DC_GET_VAL_32( INT32
, GetBkMode32
, w
.backgroundMode
) /* GDI32.146 */
114 DC_GET_X_Y( DWORD
, GetCurrentPosition
, w
.CursPosX
, w
.CursPosY
) /* GDI.78 */
115 DC_GET_VAL_16( INT16
, GetMapMode16
, w
.MapMode
) /* GDI.81 */
116 DC_GET_VAL_32( INT32
, GetMapMode32
, w
.MapMode
) /* GDI32.196 */
117 DC_GET_VAL_16( INT16
, GetPolyFillMode16
, w
.polyFillMode
) /* GDI.84 */
118 DC_GET_VAL_32( INT32
, GetPolyFillMode32
, w
.polyFillMode
) /* GDI32.213 */
119 DC_GET_VAL_16( INT16
, GetROP216
, w
.ROPmode
) /* GDI.85 */
120 DC_GET_VAL_32( INT32
, GetROP232
, w
.ROPmode
) /* GDI32.214 */
121 DC_GET_VAL_16( INT16
, GetRelAbs16
, w
.relAbsMode
) /* GDI.86 */
122 DC_GET_VAL_32( INT32
, GetRelAbs32
, w
.relAbsMode
) /* GDI32.218 */
123 DC_GET_VAL_16( INT16
, GetStretchBltMode16
, w
.stretchBltMode
) /* GDI.88 */
124 DC_GET_VAL_32( INT32
, GetStretchBltMode32
, w
.stretchBltMode
) /* GDI32.221 */
125 DC_GET_VAL_16( COLORREF
, GetTextColor16
, w
.textColor
) /* GDI.90 */
126 DC_GET_VAL_32( COLORREF
, GetTextColor32
, w
.textColor
) /* GDI32.227 */
127 DC_GET_X_Y( DWORD
, GetViewportExt
, vportExtX
, vportExtY
) /* GDI.94 */
128 DC_GET_X_Y( DWORD
, GetViewportOrg
, vportOrgX
, vportOrgY
) /* GDI.95 */
129 DC_GET_X_Y( DWORD
, GetWindowExt
, wndExtX
, wndExtY
) /* GDI.96 */
130 DC_GET_X_Y( DWORD
, GetWindowOrg
, wndOrgX
, wndOrgY
) /* GDI.97 */
131 DC_GET_VAL_16( HRGN16
, InquireVisRgn
, w
.hVisRgn
) /* GDI.131 */
132 DC_GET_VAL_16( HRGN16
, GetClipRgn16
, w
.hClipRgn
) /* GDI.173 */
133 DC_GET_X_Y( DWORD
, GetBrushOrg
, w
.brushOrgX
, w
.brushOrgY
) /* GDI.149 */
134 DC_GET_VAL_16( UINT16
, GetTextAlign16
, w
.textAlign
) /* GDI.345 */
135 DC_GET_VAL_32( UINT32
, GetTextAlign32
, w
.textAlign
) /* GDI32.224 */
136 DC_GET_VAL_16( HFONT16
, GetCurLogFont
, w
.hFont
) /* GDI.411 */
137 DC_GET_VAL_EX( GetBrushOrgEx
, w
.brushOrgX
, w
.brushOrgY
)/* GDI.469 GDI32.148 */
138 DC_GET_VAL_EX( GetCurrentPositionEx
, w
.CursPosX
, /* GDI.470 GDI32.167 */
140 DC_GET_VAL_EX( GetViewportExtEx
, vportExtX
, vportExtY
) /* GDI.472 GDI32.239 */
141 DC_GET_VAL_EX( GetViewportOrgEx
, vportOrgX
, vportOrgY
) /* GDI.473 GDI32.240 */
142 DC_GET_VAL_EX( GetWindowExtEx
, wndExtX
, wndExtY
) /* GDI.474 GDI32.242 */
143 DC_GET_VAL_EX( GetWindowOrgEx
, wndOrgX
, wndOrgY
) /* GDI.475 GDI32.243 */