Release 0.5
[wine/gsoc_dplay.git] / objects / dcvalues.c
blob73c98aabedd3b1e6f92f92b4ee0bc023260d6333
1 /*
2 * DC device-independent Get/SetXXX functions
4 * Copyright 1993 Alexandre Julliard
5 */
7 static char Copyright[] = "Copyright Alexandre Julliard, 1993";
9 #include "gdi.h"
11 /* Default DC values */
12 const WIN_DC_INFO DCVAL_defaultValues =
14 0, /* flags */
15 NULL, /* devCaps */
16 0, /* hMetaFile */
17 0, /* hClipRgn */
18 0, /* hVisRgn */
19 0, /* hGCClipRgn */
20 STOCK_BLACK_PEN, /* hPen */
21 STOCK_WHITE_BRUSH, /* hBrush */
22 STOCK_SYSTEM_FONT, /* hFont */
23 0, /* hBitmap */
24 0, /* hDevice */
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 */
34 0, /* textPixel */
35 0, /* brushOrgX */
36 0, /* brushOrgY */
37 TA_LEFT | TA_TOP | TA_NOUPDATECP, /* textAlign */
38 0, /* charExtra */
39 0, /* breakTotalExtra */
40 0, /* breakCount */
41 0, /* breakExtra */
42 0, /* breakRem */
43 1, /* planes */
44 1, /* bitsPerPixel */
45 MM_TEXT, /* MapMode */
46 0, /* DCOrgX */
47 0, /* DCOrgY */
48 0, /* DCSizeX */
49 0, /* DCSizeY */
50 0, /* CursPosX */
51 0, /* CursPosY */
52 0, /* WndOrgX */
53 0, /* WndOrgY */
54 1, /* WndExtX */
55 1, /* WndExtY */
56 0, /* VportOrgX */
57 0, /* VportOrgY */
58 1, /* VportExtX */
59 1 /* VportExtY */
63 #define DC_GET_VAL( func_type, func_name, dc_field ) \
64 func_type func_name( HDC hdc ) \
65 { \
66 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
67 if (!dc) return 0; \
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 ) \
73 { \
74 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
75 if (!dc) return 0; \
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 ) \
81 { \
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; \
86 return TRUE; \
89 #define DC_SET_VAL( func_type, func_name, dc_field ) \
90 func_type func_name( HDC hdc, func_type val ) \
91 { \
92 func_type prevVal; \
93 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
94 if (!dc) return 0; \
95 prevVal = dc->w.dc_field; \
96 dc->w.dc_field = val; \
97 return prevVal; \
100 #define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
101 WORD func_name( HDC hdc, WORD mode ) \
103 WORD prevMode; \
104 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
105 if (!dc) return 0; \
106 if ((mode < min_val) || (mode > max_val)) return 0; \
107 prevMode = dc->w.dc_field; \
108 dc->w.dc_field = mode; \
109 return prevMode; \
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 */