update for HEAD-2003091401
[reactos.git] / include / win32k / dc.h
1
2 #ifndef __WIN32K_DC_H
3 #define __WIN32K_DC_H
4
5 #include <windows.h>
6 #include <win32k/driver.h>
7 #include <win32k/gdiobj.h>
8 #include <win32k/path.h>
9
10 typedef struct _WIN_DC_INFO
11 {
12   int  flags;
13   HRGN  hClipRgn;     /* Clip region (may be 0) */
14   HRGN  hVisRgn;      /* Visible region (must never be 0) */
15   HRGN  hGCClipRgn;   /* GC clip region (ClipRgn AND VisRgn) */
16   HPEN  hPen;
17   HBRUSH  hBrush;
18   HFONT  hFont;
19   HBITMAP  hBitmap;
20   HBITMAP  hFirstBitmap; /* Bitmap selected at creation of the DC */
21
22 /* #if 0 */
23     HANDLE      hDevice;
24     HPALETTE    hPalette;
25
26     GdiPath       path;
27 /* #endif */
28
29   WORD  ROPmode;
30   WORD  polyFillMode;
31   WORD  stretchBltMode;
32   WORD  relAbsMode;
33   WORD  backgroundMode;
34   COLORREF  backgroundColor;
35   COLORREF  textColor;
36
37   short  brushOrgX;
38   short  brushOrgY;
39
40   WORD  textAlign;         /* Text alignment from SetTextAlign() */
41   short  charExtra;         /* Spacing from SetTextCharacterExtra() */
42   short  breakTotalExtra;   /* Total extra space for justification */
43   short  breakCount;        /* Break char. count */
44   short  breakExtra;        /* breakTotalExtra / breakCount */
45   short  breakRem;          /* breakTotalExtra % breakCount */
46
47   RECT   totalExtent;
48   BYTE   bitsPerPixel;
49
50   INT  MapMode;
51   INT  GraphicsMode;      /* Graphics mode */
52   INT  DCOrgX;            /* DC origin */
53   INT  DCOrgY;
54
55 #if 0
56     FARPROC     lpfnPrint;         /* AbortProc for Printing */
57 #endif
58
59   INT  CursPosX;          /* Current position */
60   INT  CursPosY;
61   INT  ArcDirection;
62
63   XFORM  xformWorld2Wnd;    /* World-to-window transformation */
64   XFORM  xformWorld2Vport;  /* World-to-viewport transformation */
65   XFORM  xformVport2World;  /* Inverse of the above transformation */
66   BOOL  vport2WorldValid;  /* Is xformVport2World valid? */
67 } WIN_DC_INFO;
68
69   /* DC flags */
70 #define DC_MEMORY     0x0001   /* It is a memory DC */
71 #define DC_SAVED      0x0002   /* It is a saved DC */
72 #define DC_DIRTY      0x0004   /* hVisRgn has to be updated */
73 #define DC_THUNKHOOK  0x0008   /* DC hook is in the 16-bit code */
74
75 #define  GDI_DC_TYPE  (1)
76
77 typedef struct _DC
78 {
79   HDC  hSelf;
80   HDC  hNext;
81   DHPDEV  PDev;
82   DEVMODEW  DMW;
83   HSURF  FillPatternSurfaces[HS_DDI_MAX];
84   PGDIINFO  GDIInfo;
85   PDEVINFO  DevInfo;
86   HSURF  Surface;
87
88   DRIVER_FUNCTIONS  DriverFunctions;
89   PWSTR  DriverName;
90   HANDLE  DeviceDriver;
91
92   INT  wndOrgX;          /* Window origin */
93   INT  wndOrgY;
94   INT  wndExtX;          /* Window extent */
95   INT  wndExtY;
96   INT  vportOrgX;        /* Viewport origin */
97   INT  vportOrgY;
98   INT  vportExtX;        /* Viewport extent */
99   INT  vportExtY;
100
101   CLIPOBJ *CombinedClip;
102
103   INT  saveLevel;
104
105   WIN_DC_INFO  w;
106 } DC, *PDC;
107
108 typedef struct
109 {
110   HANDLE Handle;
111   DHPDEV PDev;
112   DEVMODEW DMW;
113   HSURF FillPatterns[HS_DDI_MAX];
114   GDIINFO GDIInfo;
115   DEVINFO DevInfo;
116   DRIVER_FUNCTIONS DriverFunctions;
117   HANDLE DisplayDevice;
118 } GDIDEVICE;
119
120 /*  Internal functions  */
121
122 #define  DC_LockDc(hDC)  \
123   ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
124 #define  DC_UnlockDc(hDC)  \
125   GDIOBJ_UnlockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)
126
127 HDC  FASTCALL RetrieveDisplayHDC(VOID);
128 HDC  FASTCALL DC_AllocDC(LPCWSTR  Driver);
129 VOID FASTCALL DC_InitDC(HDC  DCToInit);
130 HDC  FASTCALL DC_FindOpenDC(LPCWSTR  Driver);
131 VOID FASTCALL DC_FreeDC(HDC  DCToFree);
132 HDC  FASTCALL DC_GetNextDC (PDC pDC);
133 VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC);
134 BOOL FASTCALL DC_InternalDeleteDC( PDC DCToDelete );
135
136 VOID FASTCALL DC_UpdateXforms(PDC  dc);
137 BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
138
139 /*  User entry points */
140
141 BOOL STDCALL  NtGdiCancelDC(HDC  hDC);
142 HDC STDCALL  NtGdiCreateCompatableDC(HDC  hDC);
143 HDC STDCALL  NtGdiCreateDC(LPCWSTR  Driver,
144                           LPCWSTR  Device,
145                           LPCWSTR  Output,
146                           CONST PDEVMODEW  InitData);
147 HDC STDCALL NtGdiCreateIC(LPCWSTR  Driver,
148                          LPCWSTR  Device,
149                          LPCWSTR  Output,
150                          CONST PDEVMODEW  DevMode);
151 BOOL STDCALL  NtGdiDeleteDC(HDC  hDC);
152 BOOL STDCALL  NtGdiDeleteObject(HGDIOBJ hObject);
153 INT STDCALL  NtGdiDrawEscape(HDC  hDC,
154                             INT  nEscape,
155                             INT  cbInput,
156                             LPCSTR  lpszInData);
157
158 /* FIXME: this typedef should go somewhere else...  */
159 typedef VOID (*GOBJENUMPROC)(PVOID, LPARAM);
160
161 INT STDCALL  NtGdiEnumObjects(HDC  hDC,
162                              INT  ObjectType,
163                              GOBJENUMPROC  ObjectFunc,
164                              LPARAM  lParam);
165
166 COLORREF STDCALL  NtGdiGetBkColor(HDC  hDC);
167 INT STDCALL  NtGdiGetBkMode(HDC  hDC);
168 BOOL STDCALL  NtGdiGetBrushOrgEx(HDC  hDC, LPPOINT brushOrg);
169 HRGN STDCALL  NtGdiGetClipRgn(HDC  hDC);
170 HGDIOBJ STDCALL  NtGdiGetCurrentObject(HDC  hDC, UINT  ObjectType);
171 VOID FASTCALL IntGetCurrentPositionEx (PDC  dc,  LPPOINT currentPosition);
172 BOOL STDCALL  NtGdiGetCurrentPositionEx(HDC  hDC, LPPOINT currentPosition);
173 BOOL STDCALL  NtGdiGetDCOrgEx(HDC  hDC, LPPOINT  Point);
174 INT STDCALL  NtGdiGetDeviceCaps(HDC  hDC, INT  Index);
175 INT STDCALL  NtGdiGetMapMode(HDC  hDC);
176 INT STDCALL  NtGdiGetObject(HGDIOBJ  hGDIObj,
177                            INT  BufSize,
178                            LPVOID  Object);
179 DWORD STDCALL  NtGdiGetObjectType(HGDIOBJ  hGDIObj);
180 INT STDCALL  NtGdiGetPolyFillMode(HDC  hDC);
181 INT STDCALL  NtGdiGetRelAbs(HDC  hDC);
182 INT STDCALL  NtGdiGetROP2(HDC  hDC);
183 HGDIOBJ STDCALL  NtGdiGetStockObject(INT  Object);
184 INT STDCALL  NtGdiGetStretchBltMode(HDC  hDC);
185 COLORREF STDCALL  NtGdiGetTextColor(HDC  hDC);
186 UINT STDCALL  NtGdiGetTextAlign(HDC  hDC);
187 BOOL STDCALL  NtGdiGetViewportExtEx(HDC  hDC, LPSIZE viewportExt);
188 BOOL STDCALL  NtGdiGetViewportOrgEx(HDC  hDC, LPPOINT viewportOrg);
189 BOOL STDCALL  NtGdiGetWindowExtEx(HDC  hDC, LPSIZE windowExt);
190 BOOL STDCALL  NtGdiGetWindowOrgEx(HDC  hDC, LPPOINT windowOrg);
191 HDC STDCALL  NtGdiResetDC(HDC  hDC, CONST DEVMODEW  *InitData);
192 BOOL STDCALL  NtGdiRestoreDC(HDC  hDC, INT  SavedDC);
193 INT STDCALL  NtGdiSaveDC(HDC  hDC);
194 HGDIOBJ STDCALL  NtGdiSelectObject(HDC  hDC, HGDIOBJ  hGDIObj);
195 INT STDCALL  NtGdiSetBkMode(HDC  hDC, INT  backgroundMode);
196 INT STDCALL  NtGdiSetPolyFillMode(HDC  hDC, INT polyFillMode);
197 INT STDCALL  NtGdiSetRelAbs(HDC  hDC, INT  relAbsMode);
198 INT STDCALL  NtGdiSetROP2(HDC  hDC, INT  ROPmode);
199 INT STDCALL  NtGdiSetStretchBltMode(HDC  hDC, INT  stretchBltMode);
200 COLORREF STDCALL  NtGdiSetTextColor(HDC hDC, COLORREF color);
201
202 #endif