po: Update Lithuanian translation.
[wine.git] / include / wine / gdi_driver.h
blob4693235cae8ad93fffd2dda1778d0f94351ef4cb
1 /*
2 * Definitions for Wine GDI drivers
4 * Copyright 2011 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_WINE_GDI_DRIVER_H
22 #define __WINE_WINE_GDI_DRIVER_H
24 #include "wine/list.h"
26 struct gdi_dc_funcs;
27 struct opengl_funcs;
28 struct vulkan_funcs;
30 typedef struct gdi_physdev
32 const struct gdi_dc_funcs *funcs;
33 struct gdi_physdev *next;
34 HDC hdc;
35 } *PHYSDEV;
37 struct bitblt_coords
39 int log_x; /* original position and size, in logical coords */
40 int log_y;
41 int log_width;
42 int log_height;
43 int x; /* mapped position and size, in device coords */
44 int y;
45 int width;
46 int height;
47 RECT visrect; /* rectangle clipped to the visible part, in device coords */
48 DWORD layout; /* DC layout */
51 struct gdi_image_bits
53 void *ptr; /* pointer to the bits */
54 BOOL is_copy; /* whether this is a copy of the bits that can be modified */
55 void (*free)(struct gdi_image_bits *); /* callback for freeing the bits */
56 void *param; /* extra parameter for callback private use */
59 struct brush_pattern
61 BITMAPINFO *info; /* DIB info */
62 struct gdi_image_bits bits; /* DIB bits */
63 UINT usage; /* color usage for DIB info */
66 struct gdi_dc_funcs
68 INT (*pAbortDoc)(PHYSDEV);
69 BOOL (*pAbortPath)(PHYSDEV);
70 BOOL (*pAlphaBlend)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,BLENDFUNCTION);
71 BOOL (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
72 BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
73 BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
74 BOOL (*pBeginPath)(PHYSDEV);
75 DWORD (*pBlendImage)(PHYSDEV,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,BLENDFUNCTION);
76 BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
77 BOOL (*pCloseFigure)(PHYSDEV);
78 BOOL (*pCreateCompatibleDC)(PHYSDEV,PHYSDEV*);
79 BOOL (*pCreateDC)(PHYSDEV*,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
80 BOOL (*pDeleteDC)(PHYSDEV);
81 BOOL (*pDeleteObject)(PHYSDEV,HGDIOBJ);
82 DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
83 BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
84 INT (*pEndDoc)(PHYSDEV);
85 INT (*pEndPage)(PHYSDEV);
86 BOOL (*pEndPath)(PHYSDEV);
87 BOOL (*pEnumFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
88 INT (*pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
89 INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
90 INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
91 INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
92 BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
93 INT (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
94 BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
95 BOOL (*pFillPath)(PHYSDEV);
96 BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
97 BOOL (*pFlattenPath)(PHYSDEV);
98 BOOL (*pFontIsLinked)(PHYSDEV);
99 BOOL (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
100 BOOL (*pGdiComment)(PHYSDEV,UINT,const BYTE*);
101 UINT (*pGetBoundsRect)(PHYSDEV,RECT*,UINT);
102 BOOL (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,LPABC);
103 BOOL (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
104 BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
105 INT (*pGetDeviceCaps)(PHYSDEV,INT);
106 BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
107 DWORD (*pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
108 BOOL (*pGetFontRealizationInfo)(PHYSDEV,void*);
109 DWORD (*pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
110 DWORD (*pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
111 DWORD (*pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
112 BOOL (*pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR);
113 DWORD (*pGetImage)(PHYSDEV,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*);
114 DWORD (*pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR);
115 COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
116 UINT (*pGetOutlineTextMetrics)(PHYSDEV,UINT,LPOUTLINETEXTMETRICW);
117 COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
118 UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
119 UINT (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD);
120 BOOL (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,LPINT);
121 BOOL (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,LPINT);
122 INT (*pGetTextFace)(PHYSDEV,INT,LPWSTR);
123 BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
124 BOOL (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
125 INT (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
126 BOOL (*pInvertRgn)(PHYSDEV,HRGN);
127 BOOL (*pLineTo)(PHYSDEV,INT,INT);
128 BOOL (*pModifyWorldTransform)(PHYSDEV,const XFORM*,DWORD);
129 BOOL (*pMoveTo)(PHYSDEV,INT,INT);
130 INT (*pOffsetClipRgn)(PHYSDEV,INT,INT);
131 BOOL (*pOffsetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
132 BOOL (*pOffsetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
133 BOOL (*pPaintRgn)(PHYSDEV,HRGN);
134 BOOL (*pPatBlt)(PHYSDEV,struct bitblt_coords*,DWORD);
135 BOOL (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
136 BOOL (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
137 BOOL (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
138 BOOL (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
139 BOOL (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
140 BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
141 BOOL (*pPolygon)(PHYSDEV,const POINT*,INT);
142 BOOL (*pPolyline)(PHYSDEV,const POINT*,INT);
143 BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT);
144 DWORD (*pPutImage)(PHYSDEV,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD);
145 UINT (*pRealizeDefaultPalette)(PHYSDEV);
146 UINT (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
147 BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
148 HDC (*pResetDC)(PHYSDEV,const DEVMODEW*);
149 BOOL (*pRestoreDC)(PHYSDEV,INT);
150 BOOL (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
151 INT (*pSaveDC)(PHYSDEV);
152 BOOL (*pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
153 BOOL (*pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
154 HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
155 HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH,const struct brush_pattern*);
156 BOOL (*pSelectClipPath)(PHYSDEV,INT);
157 HFONT (*pSelectFont)(PHYSDEV,HFONT,UINT*);
158 HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
159 HPEN (*pSelectPen)(PHYSDEV,HPEN,const struct brush_pattern*);
160 INT (*pSetArcDirection)(PHYSDEV,INT);
161 COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
162 INT (*pSetBkMode)(PHYSDEV,INT);
163 UINT (*pSetBoundsRect)(PHYSDEV,RECT*,UINT);
164 COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
165 COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
166 INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT);
167 VOID (*pSetDeviceClipping)(PHYSDEV,HRGN);
168 BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
169 DWORD (*pSetLayout)(PHYSDEV,DWORD);
170 INT (*pSetMapMode)(PHYSDEV,INT);
171 DWORD (*pSetMapperFlags)(PHYSDEV,DWORD);
172 COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
173 INT (*pSetPolyFillMode)(PHYSDEV,INT);
174 INT (*pSetROP2)(PHYSDEV,INT);
175 INT (*pSetRelAbs)(PHYSDEV,INT);
176 INT (*pSetStretchBltMode)(PHYSDEV,INT);
177 UINT (*pSetTextAlign)(PHYSDEV,UINT);
178 INT (*pSetTextCharacterExtra)(PHYSDEV,INT);
179 COLORREF (*pSetTextColor)(PHYSDEV,COLORREF);
180 BOOL (*pSetTextJustification)(PHYSDEV,INT,INT);
181 BOOL (*pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*);
182 BOOL (*pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
183 BOOL (*pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*);
184 BOOL (*pSetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
185 BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*);
186 INT (*pStartDoc)(PHYSDEV,const DOCINFOW*);
187 INT (*pStartPage)(PHYSDEV);
188 BOOL (*pStretchBlt)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,DWORD);
189 INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void*,BITMAPINFO*,UINT,DWORD);
190 BOOL (*pStrokeAndFillPath)(PHYSDEV);
191 BOOL (*pStrokePath)(PHYSDEV);
192 BOOL (*pUnrealizePalette)(HPALETTE);
193 BOOL (*pWidenPath)(PHYSDEV);
194 struct opengl_funcs * (*wine_get_wgl_driver)(PHYSDEV,UINT);
195 const struct vulkan_funcs * (*wine_get_vulkan_driver)(PHYSDEV,UINT);
197 /* priority order for the driver on the stack */
198 UINT priority;
201 /* increment this when you change the DC function table */
202 #define WINE_GDI_DRIVER_VERSION 48
204 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */
205 #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
206 #define GDI_PRIORITY_GRAPHICS_DRV 200 /* any graphics driver */
207 #define GDI_PRIORITY_DIB_DRV 300 /* the DIB driver */
208 #define GDI_PRIORITY_PATH_DRV 400 /* the path driver */
210 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
212 while (!((void **)dev->funcs)[offset / sizeof(void *)]) dev = dev->next;
213 return dev;
216 #define GET_NEXT_PHYSDEV(dev,func) \
217 get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
219 static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs )
221 while ((*dev)->funcs->priority > funcs->priority) dev = &(*dev)->next;
222 physdev->funcs = funcs;
223 physdev->next = *dev;
224 physdev->hdc = (*dev)->hdc;
225 *dev = physdev;
228 /* support for window surfaces */
230 struct window_surface;
232 struct window_surface_funcs
234 void (*lock)( struct window_surface *surface );
235 void (*unlock)( struct window_surface *surface );
236 void* (*get_info)( struct window_surface *surface, BITMAPINFO *info );
237 RECT* (*get_bounds)( struct window_surface *surface );
238 void (*set_region)( struct window_surface *surface, HRGN region );
239 void (*flush)( struct window_surface *surface );
240 void (*destroy)( struct window_surface *surface );
243 struct window_surface
245 const struct window_surface_funcs *funcs; /* driver-specific implementations */
246 struct list entry; /* entry in global list managed by user32 */
247 LONG ref; /* reference count */
248 RECT rect; /* constant, no locking needed */
249 /* driver-specific fields here */
252 static inline ULONG window_surface_add_ref( struct window_surface *surface )
254 return InterlockedIncrement( &surface->ref );
257 static inline ULONG window_surface_release( struct window_surface *surface )
259 ULONG ret = InterlockedDecrement( &surface->ref );
260 if (!ret) surface->funcs->destroy( surface );
261 return ret;
264 /* the DC hook support is only exported on Win16, the 32-bit version is a Wine extension */
266 #define DCHC_INVALIDVISRGN 0x0001
267 #define DCHC_DELETEDC 0x0002
268 #define DCHF_INVALIDATEVISRGN 0x0001
269 #define DCHF_VALIDATEVISRGN 0x0002
270 #define DCHF_RESETDC 0x0004 /* Wine extension */
271 #define DCHF_DISABLEDC 0x0008 /* Wine extension */
272 #define DCHF_ENABLEDC 0x0010 /* Wine extension */
274 typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
276 WINGDIAPI DWORD_PTR WINAPI GetDCHook(HDC,DCHOOKPROC*);
277 WINGDIAPI BOOL WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
278 WINGDIAPI WORD WINAPI SetHookFlags(HDC,WORD);
280 extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
281 extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
282 const RECT *device_rect, struct window_surface *surface );
283 extern void CDECL __wine_set_display_driver( HMODULE module );
284 extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
285 extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver( HDC hdc, UINT version );
287 #endif /* __WINE_WINE_GDI_DRIVER_H */