2 * DC device-independent Get/SetXXX functions
4 * Copyright 1993 Alexandre Julliard
7 static char Copyright
[] = "Copyright Alexandre Julliard, 1993";
11 /* Default DC values */
12 const WIN_DC_INFO DCVAL_defaultValues
=
20 STOCK_BLACK_PEN
, /* hPen */
21 STOCK_WHITE_BRUSH
, /* hBrush */
22 STOCK_SYSTEM_FONT
, /* hFont */
25 STOCK_DEFAULT_PALETTE
, /* hPalette */
26 R2_COPYPEN
, /* ROPmode */
27 ALTERNATE
, /* polyFillMode */
28 BLACKONWHITE
, /* stretchBltMode */
29 ABSOLUTE
, /* relAbsMode */
30 OPAQUE
, /* backgroundMode */
31 RGB( 255, 255, 255 ), /* backgroundColor */
32 RGB( 0, 0, 0 ), /* textColor */
33 0, /* backgroundPixel */
37 TA_LEFT
| TA_TOP
| TA_NOUPDATECP
, /* textAlign */
39 0, /* breakTotalExtra */
45 MM_TEXT
, /* MapMode */
63 #define DC_GET_VAL( func_type, func_name, dc_field ) \
64 func_type func_name( HDC hdc ) \
66 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
68 return dc->w.dc_field; \
71 #define DC_GET_X_Y( func_type, func_name, ret_x, ret_y ) \
72 func_type func_name( HDC hdc ) \
74 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
76 return dc->w.ret_x | (dc->w.ret_y << 16); \
79 #define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \
80 BOOL func_name( HDC hdc, LPPOINT pt ) \
82 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
83 if (!dc) return FALSE; \
84 pt->x = dc->w.ret_x; \
85 pt->y = dc->w.ret_y; \
89 #define DC_SET_VAL( func_type, func_name, dc_field ) \
90 func_type func_name( HDC hdc, func_type val ) \
93 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
95 prevVal = dc->w.dc_field; \
96 dc->w.dc_field = val; \
100 #define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
101 WORD func_name( HDC hdc, WORD mode ) \
104 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
106 if ((mode < min_val) || (mode > max_val)) return 0; \
107 prevMode = dc->w.dc_field; \
108 dc->w.dc_field = mode; \
113 DC_SET_MODE( SetBkMode
, backgroundMode
, TRANSPARENT
, OPAQUE
) /* GDI.2 */
114 DC_SET_MODE( SetROP2
, ROPmode
, R2_BLACK
, R2_WHITE
) /* GDI.4 */
115 DC_SET_MODE( SetRelAbs
, relAbsMode
, ABSOLUTE
, RELATIVE
) /* GDI.5 */
116 DC_SET_MODE( SetPolyFillMode
, polyFillMode
, ALTERNATE
, WINDING
) /* GDI.6 */
117 DC_SET_MODE( SetStretchBltMode
, stretchBltMode
,
118 BLACKONWHITE
, COLORONCOLOR
) /* GDI.7 */
119 DC_GET_VAL( COLORREF
, GetBkColor
, backgroundColor
) /* GDI.75 */
120 DC_GET_VAL( WORD
, GetBkMode
, backgroundMode
) /* GDI.76 */
121 DC_GET_X_Y( DWORD
, GetCurrentPosition
, CursPosX
, CursPosY
) /* GDI.78 */
122 DC_GET_X_Y( DWORD
, GetDCOrg
, DCOrgX
, DCOrgY
) /* GDI.79 */
123 DC_GET_VAL( WORD
, GetMapMode
, MapMode
) /* GDI.81 */
124 DC_GET_VAL( WORD
, GetPolyFillMode
, polyFillMode
) /* GDI.84 */
125 DC_GET_VAL( WORD
, GetROP2
, ROPmode
) /* GDI.85 */
126 DC_GET_VAL( WORD
, GetRelAbs
, relAbsMode
) /* GDI.86 */
127 DC_GET_VAL( WORD
, GetStretchBltMode
, stretchBltMode
) /* GDI.88 */
128 DC_GET_VAL( COLORREF
, GetTextColor
, textColor
) /* GDI.90 */
129 DC_GET_X_Y( DWORD
, GetViewportExt
, VportExtX
, VportExtY
) /* GDI.94 */
130 DC_GET_X_Y( DWORD
, GetViewportOrg
, VportOrgX
, VportOrgY
) /* GDI.95 */
131 DC_GET_X_Y( DWORD
, GetWindowExt
, WndExtX
, WndExtY
) /* GDI.96 */
132 DC_GET_X_Y( DWORD
, GetWindowOrg
, WndOrgX
, WndOrgY
) /* GDI.97 */
133 DC_GET_VAL( HRGN
, InquireVisRgn
, hVisRgn
) /* GDI.131 */
134 DC_GET_X_Y( DWORD
, GetBrushOrg
, brushOrgX
, brushOrgY
) /* GDI.149 */
135 DC_GET_VAL( HRGN
, GetClipRgn
, hClipRgn
) /* GDI.173 */
136 DC_GET_VAL( WORD
, GetTextAlign
, textAlign
) /* GDI.345 */
137 DC_SET_VAL( WORD
, SetTextAlign
, textAlign
) /* GDI.346 */
138 DC_GET_VAL( HFONT
, GetCurLogFont
, hFont
) /* GDI.411 */
139 DC_GET_VAL_EX( GetBrushOrgEx
, brushOrgX
, brushOrgY
) /* GDI.469 */
140 DC_GET_VAL_EX( GetCurrentPositionEx
, CursPosX
, CursPosY
) /* GDI.470 */
141 DC_GET_VAL_EX( GetViewportExtEx
, VportExtX
, VportExtY
) /* GDI.472 */
142 DC_GET_VAL_EX( GetViewportOrgEx
, VportOrgX
, VportOrgY
) /* GDI.473 */
143 DC_GET_VAL_EX( GetWindowExtEx
, WndExtX
, WndExtY
) /* GDI.474 */
144 DC_GET_VAL_EX( GetWindowOrgEx
, WndOrgX
, WndOrgY
) /* GDI.475 */