:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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
11 {
12   HANDLE Handle;
13   DHPDEV PDev;
14   DEVMODEW DMW;
15   HSURF FillPatterns[HS_DDI_MAX];
16   GDIINFO GDIInfo;
17   DEVINFO DevInfo;
18   DRIVER_FUNCTIONS DriverFunctions;
19 } GDIDEVICE;
20
21 /*  (RJJ) Taken from WINE  */
22 typedef struct _DEVICECAPS
23 {
24   WORD   version;       /*   0: driver version */
25   WORD   technology;    /*   2: device technology */
26   WORD   horzSize;      /*   4: width of display in mm */
27   WORD   vertSize;      /*   6: height of display in mm */
28   WORD   horzRes;       /*   8: width of display in pixels */
29   WORD   vertRes;       /*  10: width of display in pixels */
30   WORD   bitsPixel;     /*  12: bits per pixel */
31   WORD   planes;        /*  14: color planes */
32   WORD   numBrushes;    /*  16: device-specific brushes */
33   WORD   numPens;       /*  18: device-specific pens */
34   WORD   numMarkers;    /*  20: device-specific markers */
35   WORD   numFonts;      /*  22: device-specific fonts */
36   WORD   numColors;     /*  24: size of color table */
37   WORD   pdeviceSize;   /*  26: size of PDEVICE structure */
38   WORD   curveCaps;     /*  28: curve capabilities */
39   WORD   lineCaps;      /*  30: line capabilities */
40   WORD   polygonalCaps; /*  32: polygon capabilities */
41   WORD   textCaps;      /*  34: text capabilities */
42   WORD   clipCaps;      /*  36: clipping capabilities */
43   WORD   rasterCaps;    /*  38: raster capabilities */
44   WORD   aspectX;       /*  40: relative width of device pixel */
45   WORD   aspectY;       /*  42: relative height of device pixel */
46   WORD   aspectXY;      /*  44: relative diagonal width of device pixel */
47   WORD   pad1[21];      /*  46-86: reserved */
48   WORD   logPixelsX;    /*  88: pixels / logical X inch */
49   WORD   logPixelsY;    /*  90: pixels / logical Y inch */
50   WORD   pad2[6];       /*  92-102: reserved */
51   WORD   sizePalette;   /* 104: entries in system palette */
52   WORD   numReserved;   /* 106: reserved entries */
53   WORD   colorRes;      /* 108: color resolution */
54 } DEVICECAPS, *PDEVICECAPS;
55
56 typedef struct _WIN_DC_INFO
57 {
58   int  flags;
59   const PDEVICECAPS  devCaps;
60   HRGN  hClipRgn;     /* Clip region (may be 0) */
61   HRGN  hVisRgn;      /* Visible region (must never be 0) */
62   HRGN  hGCClipRgn;   /* GC clip region (ClipRgn AND VisRgn) */
63   HPEN  hPen;
64   HBRUSH  hBrush;
65   HFONT  hFont;
66   HBITMAP  hBitmap;
67   HBITMAP  hFirstBitmap; /* Bitmap selected at creation of the DC */
68
69 // #if 0
70     HANDLE      hDevice;
71     HPALETTE    hPalette;
72
73     GdiPath       path;
74 // #endif
75
76   WORD  ROPmode;
77   WORD  polyFillMode;
78   WORD  stretchBltMode;
79   WORD  relAbsMode;
80   WORD  backgroundMode;
81   COLORREF  backgroundColor;
82   COLORREF  textColor;
83
84   short  brushOrgX;
85   short  brushOrgY;
86
87   WORD  textAlign;         /* Text alignment from SetTextAlign() */
88   short  charExtra;         /* Spacing from SetTextCharacterExtra() */
89   short  breakTotalExtra;   /* Total extra space for justification */
90   short  breakCount;        /* Break char. count */
91   short  breakExtra;        /* breakTotalExtra / breakCount */
92   short  breakRem;          /* breakTotalExtra % breakCount */
93
94   RECT   totalExtent;
95   BYTE   bitsPerPixel;
96
97   INT  MapMode;
98   INT  GraphicsMode;      /* Graphics mode */
99   INT  DCOrgX;            /* DC origin */
100   INT  DCOrgY;
101
102 #if 0
103     FARPROC     lpfnPrint;         /* AbortProc for Printing */
104 #endif
105
106   INT  CursPosX;          /* Current position */
107   INT  CursPosY;
108   INT  ArcDirection;
109
110   XFORM  xformWorld2Wnd;    /* World-to-window transformation */
111   XFORM  xformWorld2Vport;  /* World-to-viewport transformation */
112   XFORM  xformVport2World;  /* Inverse of the above transformation */
113   BOOL  vport2WorldValid;  /* Is xformVport2World valid? */
114 } WIN_DC_INFO;
115
116   /* DC flags */
117 #define DC_MEMORY     0x0001   /* It is a memory DC */
118 #define DC_SAVED      0x0002   /* It is a saved DC */
119 #define DC_DIRTY      0x0004   /* hVisRgn has to be updated */
120 #define DC_THUNKHOOK  0x0008   /* DC hook is in the 16-bit code */
121
122 #define  GDI_DC_TYPE  (1)
123
124 typedef struct _DC
125 {
126   HDC  hSelf;
127   HDC  hNext;
128   DHPDEV  PDev;
129   DEVMODEW  DMW;
130   HSURF  FillPatternSurfaces[HS_DDI_MAX];
131   GDIINFO  GDIInfo;
132   DEVINFO  DevInfo;
133   HSURF  Surface;
134
135   DRIVER_FUNCTIONS  DriverFunctions;
136   PWSTR  DriverName;
137   HANDLE  DeviceDriver;
138
139   INT  wndOrgX;          /* Window origin */
140   INT  wndOrgY;
141   INT  wndExtX;          /* Window extent */
142   INT  wndExtY;
143   INT  vportOrgX;        /* Viewport origin */
144   INT  vportOrgY;
145   INT  vportExtX;        /* Viewport extent */
146   INT  vportExtY;
147
148   INT  saveLevel;
149
150   WIN_DC_INFO  w;
151 } DC, *PDC;
152
153 /*  Internal functions  */
154
155 /*
156 #define  DC_PtrToHandle(pDC)  \
157   ((HDC) GDIOBJ_PtrToHandle ((PGDIOBJ) pDC, GO_DC_MAGIC))
158 */
159
160 #define  DC_HandleToPtr(hDC)  \
161   ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GO_DC_MAGIC))
162 #define  DC_ReleasePtr(hDC)  \
163   GDIOBJ_UnlockObj ((HGDIOBJ) hDC, GO_DC_MAGIC)
164
165 HDC RetrieveDisplayHDC(VOID);
166 HDC  DC_AllocDC(LPCWSTR  Driver);
167 void  DC_InitDC(HDC  DCToInit);
168 HDC  DC_FindOpenDC(LPCWSTR  Driver);
169 void  DC_FreeDC(HDC  DCToFree);
170 HDC  DC_GetNextDC (PDC pDC);
171 void  DC_SetNextDC (PDC pDC, HDC hNextDC);
172 BOOL DC_InternalDeleteDC( PDC DCToDelete );
173
174 void DC_UpdateXforms(PDC  dc);
175 BOOL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
176
177 /*  User entry points */
178
179 BOOL STDCALL  W32kCancelDC(HDC  hDC);
180 HDC STDCALL  W32kCreateCompatableDC(HDC  hDC);
181 HDC STDCALL  W32kCreateDC(LPCWSTR  Driver,
182                           LPCWSTR  Device,
183                           LPCWSTR  Output,
184                           CONST PDEVMODEW  InitData);
185 HDC STDCALL W32kCreateIC(LPCWSTR  Driver,
186                          LPCWSTR  Device,
187                          LPCWSTR  Output,
188                          CONST PDEVMODEW  DevMode);
189 BOOL STDCALL  W32kDeleteDC(HDC  hDC);
190 BOOL STDCALL  W32kDeleteObject(HGDIOBJ hObject);
191 INT STDCALL  W32kDrawEscape(HDC  hDC,
192                             INT  nEscape,
193                             INT  cbInput,
194                             LPCSTR  lpszInData);
195
196 /* FIXME: this typedef should go somewhere else...  */
197 typedef VOID (*GOBJENUMPROC)(PVOID, LPARAM);
198
199 INT STDCALL  W32kEnumObjects(HDC  hDC,
200                              INT  ObjectType,
201                              GOBJENUMPROC  ObjectFunc,
202                              LPARAM  lParam);
203
204 COLORREF STDCALL  W32kGetBkColor(HDC  hDC);
205 INT STDCALL  W32kGetBkMode(HDC  hDC);
206 BOOL STDCALL  W32kGetBrushOrgEx(HDC  hDC, LPPOINT brushOrg);
207 HRGN STDCALL  W32kGetClipRgn(HDC  hDC);
208 HGDIOBJ STDCALL  W32kGetCurrentObject(HDC  hDC, UINT  ObjectType);
209 BOOL STDCALL  W32kGetCurrentPositionEx(HDC  hDC, LPPOINT currentPosition);
210 BOOL STDCALL  W32kGetDCOrgEx(HDC  hDC, LPPOINT  Point);
211 HDC STDCALL  W32kGetDCState16(HDC  hDC);
212 INT STDCALL  W32kGetDeviceCaps(HDC  hDC, INT  Index);
213 INT STDCALL  W32kGetMapMode(HDC  hDC);
214 INT STDCALL  W32kGetObject(HGDIOBJ  hGDIObj,
215                            INT  BufSize,
216                            LPVOID  Object);
217 DWORD STDCALL  W32kGetObjectType(HGDIOBJ  hGDIObj);
218 INT STDCALL  W32kGetPolyFillMode(HDC  hDC);
219 INT STDCALL  W32kGetRelAbs(HDC  hDC);
220 INT STDCALL  W32kGetROP2(HDC  hDC);
221 HGDIOBJ STDCALL  W32kGetStockObject(INT  Object);
222 INT STDCALL  W32kGetStretchBltMode(HDC  hDC);
223 COLORREF STDCALL  W32kGetTextColor(HDC  hDC);
224 UINT STDCALL  W32kGetTextAlign(HDC  hDC);
225 BOOL STDCALL  W32kGetViewportExtEx(HDC  hDC, LPSIZE viewportExt);
226 BOOL STDCALL  W32kGetViewportOrgEx(HDC  hDC, LPPOINT viewportOrg);
227 BOOL STDCALL  W32kGetWindowExtEx(HDC  hDC, LPSIZE windowExt);
228 BOOL STDCALL  W32kGetWindowOrgEx(HDC  hDC, LPPOINT windowOrg);
229 HDC STDCALL  W32kResetDC(HDC  hDC, CONST DEVMODEW  *InitData);
230 BOOL STDCALL  W32kRestoreDC(HDC  hDC, INT  SavedDC);
231 INT STDCALL  W32kSaveDC(HDC  hDC);
232 HGDIOBJ STDCALL  W32kSelectObject(HDC  hDC, HGDIOBJ  hGDIObj);
233 INT STDCALL  W32kSetBkMode(HDC  hDC, INT  backgroundMode);
234 INT STDCALL  W32kSetPolyFillMode(HDC  hDC, INT polyFillMode);
235 INT STDCALL  W32kSetRelAbs(HDC  hDC, INT  relAbsMode);
236 INT STDCALL  W32kSetROP2(HDC  hDC, INT  ROPmode);
237 INT STDCALL  W32kSetStretchBltMode(HDC  hDC, INT  stretchBltMode);
238 COLORREF STDCALL  W32kSetTextColor(HDC hDC, COLORREF color);
239
240 #endif
241