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 */
44 MM_TEXT
, /* MapMode */
62 #define DC_GET_VAL( func_type, func_name, dc_field ) \
63 func_type func_name( HDC hdc ) \
65 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
67 return dc->w.dc_field; \
70 #define DC_GET_X_Y( func_type, func_name, ret_x, ret_y ) \
71 func_type func_name( HDC hdc ) \
73 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
75 return dc->w.ret_x | (dc->w.ret_y << 16); \
78 #define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \
79 BOOL func_name( HDC hdc, LPPOINT pt ) \
81 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
82 if (!dc) return FALSE; \
83 pt->x = dc->w.ret_x; \
84 pt->y = dc->w.ret_y; \
88 #define DC_SET_VAL( func_type, func_name, dc_field ) \
89 func_type func_name( HDC hdc, func_type val ) \
92 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
94 prevVal = dc->w.dc_field; \
95 dc->w.dc_field = val; \
99 #define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
100 WORD func_name( HDC hdc, WORD mode ) \
103 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
105 if ((mode < min_val) || (mode > max_val)) return 0; \
106 prevMode = dc->w.dc_field; \
107 dc->w.dc_field = mode; \
112 DC_SET_MODE( SetBkMode
, backgroundMode
, TRANSPARENT
, OPAQUE
) /* GDI.2 */
113 DC_SET_MODE( SetROP2
, ROPmode
, R2_BLACK
, R2_WHITE
) /* GDI.4 */
114 DC_SET_MODE( SetRelAbs
, relAbsMode
, ABSOLUTE
, RELATIVE
) /* GDI.5 */
115 DC_SET_MODE( SetPolyFillMode
, polyFillMode
, ALTERNATE
, WINDING
) /* GDI.6 */
116 DC_SET_MODE( SetStretchBltMode
, stretchBltMode
,
117 BLACKONWHITE
, COLORONCOLOR
) /* GDI.7 */
118 DC_GET_VAL( COLORREF
, GetBkColor
, backgroundColor
) /* GDI.75 */
119 DC_GET_VAL( WORD
, GetBkMode
, backgroundMode
) /* GDI.76 */
120 DC_GET_X_Y( DWORD
, GetCurrentPosition
, CursPosX
, CursPosY
) /* GDI.78 */
121 DC_GET_X_Y( DWORD
, GetDCOrg
, DCOrgX
, DCOrgY
) /* GDI.79 */
122 DC_GET_VAL( WORD
, GetMapMode
, MapMode
) /* GDI.81 */
123 DC_GET_VAL( WORD
, GetPolyFillMode
, polyFillMode
) /* GDI.84 */
124 DC_GET_VAL( WORD
, GetROP2
, ROPmode
) /* GDI.85 */
125 DC_GET_VAL( WORD
, GetRelAbs
, relAbsMode
) /* GDI.86 */
126 DC_GET_VAL( WORD
, GetStretchBltMode
, stretchBltMode
) /* GDI.88 */
127 DC_GET_VAL( COLORREF
, GetTextColor
, textColor
) /* GDI.90 */
128 DC_GET_X_Y( DWORD
, GetViewportExt
, VportExtX
, VportExtY
) /* GDI.94 */
129 DC_GET_X_Y( DWORD
, GetViewportOrg
, VportOrgX
, VportOrgY
) /* GDI.95 */
130 DC_GET_X_Y( DWORD
, GetWindowExt
, WndExtX
, WndExtY
) /* GDI.96 */
131 DC_GET_X_Y( DWORD
, GetWindowOrg
, WndOrgX
, WndOrgY
) /* GDI.97 */
132 DC_GET_VAL( HRGN
, InquireVisRgn
, hVisRgn
) /* GDI.131 */
133 DC_GET_X_Y( DWORD
, GetBrushOrg
, brushOrgX
, brushOrgY
) /* GDI.149 */
134 DC_GET_VAL( HRGN
, GetClipRgn
, hClipRgn
) /* GDI.173 */
135 DC_GET_VAL( WORD
, GetTextAlign
, textAlign
) /* GDI.345 */
136 DC_SET_VAL( WORD
, SetTextAlign
, textAlign
) /* GDI.346 */
137 DC_GET_VAL( HFONT
, GetCurLogFont
, hFont
) /* GDI.411 */
138 DC_GET_VAL_EX( GetBrushOrgEx
, brushOrgX
, brushOrgY
) /* GDI.469 */
139 DC_GET_VAL_EX( GetCurrentPositionEx
, CursPosX
, CursPosY
) /* GDI.470 */
140 DC_GET_VAL_EX( GetViewportExtEx
, VportExtX
, VportExtY
) /* GDI.472 */
141 DC_GET_VAL_EX( GetViewportOrgEx
, VportOrgX
, VportOrgY
) /* GDI.473 */
142 DC_GET_VAL_EX( GetWindowExtEx
, WndExtX
, WndExtY
) /* GDI.474 */
143 DC_GET_VAL_EX( GetWindowOrgEx
, WndOrgX
, WndOrgY
) /* GDI.475 */