Stub implementations for LresultFromObject and
[wine.git] / dlls / gdi / gdi_private.h
blobfed7aaeeea1faa2d8425f076fb1673d422a9c166
1 /*
2 * GDI definitions
4 * Copyright 1993 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_GDI_PRIVATE_H
22 #define __WINE_GDI_PRIVATE_H
24 /* Metafile defines */
25 #define META_EOF 0x0000
26 /* values of mtType in METAHEADER. Note however that the disk image of a disk
27 based metafile has mtType == 1 */
28 #define METAFILE_MEMORY 1
29 #define METAFILE_DISK 2
31 struct gdi_obj_funcs
33 HGDIOBJ (*pSelectObject)( HGDIOBJ handle, void *obj, HDC hdc );
34 INT (*pGetObject16)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
35 INT (*pGetObjectA)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
36 INT (*pGetObjectW)( HGDIOBJ handle, void *obj, INT count, LPVOID buffer );
37 BOOL (*pUnrealizeObject)( HGDIOBJ handle, void *obj );
38 BOOL (*pDeleteObject)( HGDIOBJ handle, void *obj );
41 struct hdc_list
43 HDC hdc;
44 struct hdc_list *next;
47 /* Device functions for the Wine driver interface */
49 typedef struct { int opaque; } *PHYSDEV; /* PHYSDEV is an opaque pointer */
51 typedef struct tagDC_FUNCS
53 INT (*pAbortDoc)(PHYSDEV);
54 BOOL (*pAbortPath)(PHYSDEV);
55 BOOL (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
56 BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
57 BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
58 BOOL (*pBeginPath)(PHYSDEV);
59 BOOL (*pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
60 INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
61 BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
62 BOOL (*pCloseFigure)(PHYSDEV);
63 BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP);
64 BOOL (*pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
65 HBITMAP (*pCreateDIBSection)(PHYSDEV,const BITMAPINFO *,UINT,VOID **,HANDLE,DWORD,DWORD);
66 BOOL (*pDeleteBitmap)(HBITMAP);
67 BOOL (*pDeleteDC)(PHYSDEV);
68 BOOL (*pDeleteObject)(PHYSDEV,HGDIOBJ);
69 INT (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
70 DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
71 BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
72 INT (*pEndDoc)(PHYSDEV);
73 INT (*pEndPage)(PHYSDEV);
74 BOOL (*pEndPath)(PHYSDEV);
75 BOOL (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
76 INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
77 INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
78 INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
79 BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
80 INT (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
81 BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*,INT);
82 BOOL (*pFillPath)(PHYSDEV);
83 BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
84 BOOL (*pFlattenPath)(PHYSDEV);
85 BOOL (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
86 BOOL (*pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
87 LONG (*pGetBitmapBits)(HBITMAP,void*,LONG);
88 BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
89 BOOL (*pGetDCOrgEx)(PHYSDEV,LPPOINT);
90 UINT (*pGetDIBColorTable)(PHYSDEV,UINT,UINT,RGBQUAD*);
91 INT (*pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
92 INT (*pGetDeviceCaps)(PHYSDEV,INT);
93 BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
94 COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
95 COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
96 INT (*pGetPixelFormat)(PHYSDEV);
97 UINT (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
98 BOOL (*pGetTextExtentPoint)(PHYSDEV,LPCWSTR,INT,LPSIZE);
99 BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
100 INT (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
101 BOOL (*pInvertRgn)(PHYSDEV,HRGN);
102 BOOL (*pLineTo)(PHYSDEV,INT,INT);
103 BOOL (*pModifyWorldTransform)(PHYSDEV,const XFORM*,INT);
104 BOOL (*pMoveTo)(PHYSDEV,INT,INT);
105 INT (*pOffsetClipRgn)(PHYSDEV,INT,INT);
106 INT (*pOffsetViewportOrg)(PHYSDEV,INT,INT);
107 INT (*pOffsetWindowOrg)(PHYSDEV,INT,INT);
108 BOOL (*pPaintRgn)(PHYSDEV,HRGN);
109 BOOL (*pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD);
110 BOOL (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
111 BOOL (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
112 BOOL (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
113 BOOL (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
114 BOOL (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
115 BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
116 BOOL (*pPolygon)(PHYSDEV,const POINT*,INT);
117 BOOL (*pPolyline)(PHYSDEV,const POINT*,INT);
118 BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT);
119 UINT (*pRealizeDefaultPalette)(PHYSDEV);
120 UINT (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
121 BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
122 HDC (*pResetDC)(PHYSDEV,const DEVMODEW*);
123 BOOL (*pRestoreDC)(PHYSDEV,INT);
124 BOOL (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
125 INT (*pSaveDC)(PHYSDEV);
126 INT (*pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT);
127 INT (*pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT);
128 HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
129 HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH);
130 BOOL (*pSelectClipPath)(PHYSDEV,INT);
131 HFONT (*pSelectFont)(PHYSDEV,HFONT,HANDLE);
132 HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
133 HPEN (*pSelectPen)(PHYSDEV,HPEN);
134 INT (*pSetArcDirection)(PHYSDEV,INT);
135 LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
136 COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
137 INT (*pSetBkMode)(PHYSDEV,INT);
138 COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
139 DWORD (*pSetDCOrg)(PHYSDEV,INT,INT);
140 COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
141 UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
142 INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
143 INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
144 const BITMAPINFO*,UINT);
145 VOID (*pSetDeviceClipping)(PHYSDEV,HRGN,HRGN);
146 BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
147 INT (*pSetMapMode)(PHYSDEV,INT);
148 DWORD (*pSetMapperFlags)(PHYSDEV,DWORD);
149 COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
150 BOOL (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
151 INT (*pSetPolyFillMode)(PHYSDEV,INT);
152 INT (*pSetROP2)(PHYSDEV,INT);
153 INT (*pSetRelAbs)(PHYSDEV,INT);
154 INT (*pSetStretchBltMode)(PHYSDEV,INT);
155 UINT (*pSetTextAlign)(PHYSDEV,UINT);
156 INT (*pSetTextCharacterExtra)(PHYSDEV,INT);
157 DWORD (*pSetTextColor)(PHYSDEV,DWORD);
158 INT (*pSetTextJustification)(PHYSDEV,INT,INT);
159 INT (*pSetViewportExt)(PHYSDEV,INT,INT);
160 INT (*pSetViewportOrg)(PHYSDEV,INT,INT);
161 INT (*pSetWindowExt)(PHYSDEV,INT,INT);
162 INT (*pSetWindowOrg)(PHYSDEV,INT,INT);
163 BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*);
164 INT (*pStartDoc)(PHYSDEV,const DOCINFOA*);
165 INT (*pStartPage)(PHYSDEV);
166 BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
167 INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
168 const BITMAPINFO*,UINT,DWORD);
169 BOOL (*pStrokeAndFillPath)(PHYSDEV);
170 BOOL (*pStrokePath)(PHYSDEV);
171 BOOL (*pSwapBuffers)(PHYSDEV);
172 BOOL (*pWidenPath)(PHYSDEV);
173 } DC_FUNCTIONS;
175 /* It should not be necessary to access the contents of the GdiPath
176 * structure directly; if you find that the exported functions don't
177 * allow you to do what you want, then please place a new exported
178 * function that does this job in path.c.
180 typedef enum tagGdiPathState
182 PATH_Null,
183 PATH_Open,
184 PATH_Closed
185 } GdiPathState;
187 typedef struct tagGdiPath
189 GdiPathState state;
190 POINT *pPoints;
191 BYTE *pFlags;
192 int numEntriesUsed, numEntriesAllocated;
193 BOOL newStroke;
194 } GdiPath;
196 typedef struct tagGdiFont *GdiFont;
198 typedef struct tagDC
200 GDIOBJHDR header;
201 HDC hSelf; /* Handle to this DC */
202 const struct tagDC_FUNCS *funcs; /* DC function table */
203 PHYSDEV physDev; /* Physical device (driver-specific) */
204 INT saveLevel;
205 DWORD dwHookData;
206 FARPROC16 hookProc; /* the original SEGPTR ... */
207 DCHOOKPROC hookThunk; /* ... and the thunk to call it */
209 INT wndOrgX; /* Window origin */
210 INT wndOrgY;
211 INT wndExtX; /* Window extent */
212 INT wndExtY;
213 INT vportOrgX; /* Viewport origin */
214 INT vportOrgY;
215 INT vportExtX; /* Viewport extent */
216 INT vportExtY;
218 int flags;
219 HRGN hClipRgn; /* Clip region (may be 0) */
220 HRGN hVisRgn; /* Visible region (must never be 0) */
221 HPEN hPen;
222 HBRUSH hBrush;
223 HFONT hFont;
224 HBITMAP hBitmap;
225 HANDLE hDevice;
226 HPALETTE hPalette;
228 GdiFont gdiFont;
229 GdiPath path;
231 WORD ROPmode;
232 WORD polyFillMode;
233 WORD stretchBltMode;
234 WORD relAbsMode;
235 WORD backgroundMode;
236 COLORREF backgroundColor;
237 COLORREF textColor;
238 COLORREF dcBrushColor;
239 COLORREF dcPenColor;
240 short brushOrgX;
241 short brushOrgY;
243 WORD textAlign; /* Text alignment from SetTextAlign() */
244 INT charExtra; /* Spacing from SetTextCharacterExtra() */
245 INT breakExtra; /* breakTotalExtra / breakCount */
246 INT breakRem; /* breakTotalExtra % breakCount */
247 INT MapMode;
248 INT GraphicsMode; /* Graphics mode */
249 ABORTPROC pAbortProc; /* AbortProc for Printing */
250 ABORTPROC16 pAbortProc16;
251 INT CursPosX; /* Current position */
252 INT CursPosY;
253 INT ArcDirection;
254 XFORM xformWorld2Wnd; /* World-to-window transformation */
255 XFORM xformWorld2Vport; /* World-to-viewport transformation */
256 XFORM xformVport2World; /* Inverse of the above transformation */
257 BOOL vport2WorldValid; /* Is xformVport2World valid? */
258 RECT BoundsRect; /* Current bounding rect */
259 } DC;
261 /* DC flags */
262 #define DC_SAVED 0x0002 /* It is a saved DC */
263 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
264 #define DC_BOUNDS_ENABLE 0x0008 /* Bounding rectangle tracking is enabled */
265 #define DC_BOUNDS_SET 0x0010 /* Bounding rectangle has been set */
267 /* Certain functions will do no further processing if the driver returns this.
268 Used by mfdrv for example. */
269 #define GDI_NO_MORE_WORK 2
271 /* Rounds a floating point number to integer. The world-to-viewport
272 * transformation process is done in floating point internally. This function
273 * is then used to round these coordinates to integer values.
275 static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
277 return (int)floor(val + 0.5);
280 /* bidi.c */
282 /* Wine_GCPW Flags */
283 /* Directionality -
284 * LOOSE means that the paragraph dir is only set if there is no strong character.
285 * FORCE means override the characters in the paragraph.
287 #define WINE_GCPW_FORCE_LTR 0
288 #define WINE_GCPW_FORCE_RTL 1
289 #define WINE_GCPW_LOOSE_LTR 2
290 #define WINE_GCPW_LOOSE_RTL 3
291 #define WINE_GCPW_DIR_MASK 3
292 extern BOOL BIDI_Reorder( LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
293 LPWSTR lpOutString, INT uCountOut, UINT *lpOrder );
294 extern BOOL BidiAvail;
296 /* bitmap.c */
297 extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap );
298 extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc );
300 /* clipping.c */
301 extern void CLIPPING_UpdateGCRegion( DC * dc );
303 /* dc.c */
304 extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic );
305 extern DC * DC_GetDCUpdate( HDC hdc );
306 extern DC * DC_GetDCPtr( HDC hdc );
307 extern void DC_InitDC( DC * dc );
308 extern void DC_UpdateXforms( DC * dc );
310 /* dib.c */
311 extern int DIB_GetDIBWidthBytes( int width, int depth );
312 extern int DIB_GetDIBImageBytes( int width, int height, int depth );
313 extern int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
315 /* driver.c */
316 extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name );
317 extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
318 extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
319 extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size );
321 /* enhmetafile.c */
322 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
324 /* freetype.c */
325 extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID);
326 extern GdiFont WineEngCreateFontInstance(DC*, HFONT);
327 extern BOOL WineEngDestroyFontInstance(HFONT handle);
328 extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM);
329 extern BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar,
330 UINT lastChar, LPABC buffer);
331 extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT);
332 extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD);
333 extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count,
334 LPWORD pgi, DWORD flags);
335 extern DWORD WineEngGetGlyphOutline(GdiFont, UINT glyph, UINT format,
336 LPGLYPHMETRICS, DWORD buflen, LPVOID buf,
337 const MAT2*);
338 extern UINT WineEngGetOutlineTextMetrics(GdiFont, UINT, LPOUTLINETEXTMETRICW);
339 extern UINT WineEngGetTextCharsetInfo(GdiFont font, LPFONTSIGNATURE fs, DWORD flags);
340 extern BOOL WineEngGetTextExtentPoint(GdiFont, LPCWSTR, INT, LPSIZE);
341 extern BOOL WineEngGetTextExtentPointI(GdiFont, const WORD *, INT, LPSIZE);
342 extern INT WineEngGetTextFace(GdiFont, INT, LPWSTR);
343 extern BOOL WineEngGetTextMetrics(GdiFont, LPTEXTMETRICW);
344 extern BOOL WineEngInit(void);
345 extern BOOL WineEngRemoveFontResourceEx(LPCWSTR, DWORD, PVOID);
347 /* gdiobj.c */
348 extern BOOL GDI_Init(void);
349 extern void *GDI_AllocObject( WORD, WORD, HGDIOBJ *, const struct gdi_obj_funcs *funcs );
350 extern void *GDI_ReallocObject( WORD, HGDIOBJ, void *obj );
351 extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
352 extern void GDI_CheckNotLock(void);
353 extern BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc);
354 extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc);
356 /* metafile.c */
357 extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh);
358 extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh);
359 extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode );
361 /* path.c */
363 #define PATH_IsPathOpen(path) ((path).state==PATH_Open)
364 /* Returns TRUE if the specified path is in the open state, i.e. in the
365 * state where points will be added to the path, or FALSE otherwise. This
366 * function is implemented as a macro for performance reasons.
369 extern void PATH_InitGdiPath(GdiPath *pPath);
370 extern void PATH_DestroyGdiPath(GdiPath *pPath);
371 extern BOOL PATH_AssignGdiPath(GdiPath *pPathDest, const GdiPath *pPathSrc);
373 extern BOOL PATH_MoveTo(DC *dc);
374 extern BOOL PATH_LineTo(DC *dc, INT x, INT y);
375 extern BOOL PATH_Rectangle(DC *dc, INT x1, INT y1, INT x2, INT y2);
376 extern BOOL PATH_Ellipse(DC *dc, INT x1, INT y1, INT x2, INT y2);
377 extern BOOL PATH_Arc(DC *dc, INT x1, INT y1, INT x2, INT y2,
378 INT xStart, INT yStart, INT xEnd, INT yEnd, INT lines);
379 extern BOOL PATH_PolyBezierTo(DC *dc, const POINT *pt, DWORD cbCount);
380 extern BOOL PATH_PolyBezier(DC *dc, const POINT *pt, DWORD cbCount);
381 extern BOOL PATH_PolylineTo(DC *dc, const POINT *pt, DWORD cbCount);
382 extern BOOL PATH_Polyline(DC *dc, const POINT *pt, DWORD cbCount);
383 extern BOOL PATH_Polygon(DC *dc, const POINT *pt, DWORD cbCount);
384 extern BOOL PATH_PolyPolyline(DC *dc, const POINT *pt, const DWORD *counts, DWORD polylines);
385 extern BOOL PATH_PolyPolygon(DC *dc, const POINT *pt, const INT *counts, UINT polygons);
386 extern BOOL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height);
387 extern BOOL PATH_AddEntry(GdiPath *pPath, const POINT *pPoint, BYTE flags);
389 /* painting.c */
390 extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
392 /* palette.c */
393 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg);
394 extern UINT WINAPI GDIRealizePalette( HDC hdc );
395 extern HPALETTE PALETTE_Init(void);
397 /* region.c */
398 extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y );
400 /* text.c */
401 extern LPWSTR FONT_mbtowc(HDC, LPCSTR, INT, INT*, UINT*);
403 #endif /* __WINE_GDI_PRIVATE_H */