[4] | 1 | /*
|
---|
| 2 | * GDI definitions
|
---|
| 3 | *
|
---|
| 4 | * Copyright 1993 Alexandre Julliard
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | #ifndef __WINE_GDI_H
|
---|
| 8 | #define __WINE_GDI_H
|
---|
| 9 |
|
---|
| 10 | #include "windef.h"
|
---|
| 11 | #include "wingdi.h"
|
---|
| 12 | #include "ldt.h"
|
---|
| 13 | #include "path.h"
|
---|
| 14 | #include <math.h>
|
---|
[1007] | 15 | #include "local.h"
|
---|
[4] | 16 |
|
---|
| 17 | /* GDI objects magic numbers */
|
---|
| 18 | #define PEN_MAGIC 0x4f47
|
---|
| 19 | #define BRUSH_MAGIC 0x4f48
|
---|
| 20 | #define FONT_MAGIC 0x4f49
|
---|
| 21 | #define PALETTE_MAGIC 0x4f4a
|
---|
| 22 | #define BITMAP_MAGIC 0x4f4b
|
---|
| 23 | #define REGION_MAGIC 0x4f4c
|
---|
| 24 | #define DC_MAGIC 0x4f4d
|
---|
| 25 | #define DISABLED_DC_MAGIC 0x4f4e
|
---|
| 26 | #define META_DC_MAGIC 0x4f4f
|
---|
| 27 | #define METAFILE_MAGIC 0x4f50
|
---|
| 28 | #define METAFILE_DC_MAGIC 0x4f51
|
---|
| 29 | #define ENHMETAFILE_MAGIC 0x4f52
|
---|
| 30 | #define ENHMETAFILE_DC_MAGIC 0x4f53
|
---|
| 31 |
|
---|
| 32 | #define MAGIC_DONTCARE 0xffff
|
---|
| 33 |
|
---|
| 34 | typedef struct tagGDIOBJHDR
|
---|
| 35 | {
|
---|
| 36 | HANDLE16 hNext;
|
---|
| 37 | WORD wMagic;
|
---|
| 38 | DWORD dwCount;
|
---|
| 39 | } GDIOBJHDR;
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | typedef struct tagDeviceCaps
|
---|
| 43 | {
|
---|
| 44 | WORD version; /* 0: driver version */
|
---|
| 45 | WORD technology; /* 2: device technology */
|
---|
| 46 | WORD horzSize; /* 4: width of display in mm */
|
---|
| 47 | WORD vertSize; /* 6: height of display in mm */
|
---|
| 48 | WORD horzRes; /* 8: width of display in pixels */
|
---|
| 49 | WORD vertRes; /* 10: width of display in pixels */
|
---|
| 50 | WORD bitsPixel; /* 12: bits per pixel */
|
---|
| 51 | WORD planes; /* 14: color planes */
|
---|
| 52 | WORD numBrushes; /* 16: device-specific brushes */
|
---|
| 53 | WORD numPens; /* 18: device-specific pens */
|
---|
| 54 | WORD numMarkers; /* 20: device-specific markers */
|
---|
| 55 | WORD numFonts; /* 22: device-specific fonts */
|
---|
| 56 | WORD numColors; /* 24: size of color table */
|
---|
| 57 | WORD pdeviceSize; /* 26: size of PDEVICE structure */
|
---|
| 58 | WORD curveCaps; /* 28: curve capabilities */
|
---|
| 59 | WORD lineCaps; /* 30: line capabilities */
|
---|
| 60 | WORD polygonalCaps; /* 32: polygon capabilities */
|
---|
| 61 | WORD textCaps; /* 34: text capabilities */
|
---|
| 62 | WORD clipCaps; /* 36: clipping capabilities */
|
---|
| 63 | WORD rasterCaps; /* 38: raster capabilities */
|
---|
| 64 | WORD aspectX; /* 40: relative width of device pixel */
|
---|
| 65 | WORD aspectY; /* 42: relative height of device pixel */
|
---|
| 66 | WORD aspectXY; /* 44: relative diagonal width of device pixel */
|
---|
| 67 | WORD pad1[21]; /* 46-86: reserved */
|
---|
| 68 | WORD logPixelsX; /* 88: pixels / logical X inch */
|
---|
| 69 | WORD logPixelsY; /* 90: pixels / logical Y inch */
|
---|
| 70 | WORD pad2[6]; /* 92-102: reserved */
|
---|
| 71 | WORD sizePalette; /* 104: entries in system palette */
|
---|
| 72 | WORD numReserved; /* 106: reserved entries */
|
---|
| 73 | WORD colorRes; /* 108: color resolution */
|
---|
| 74 | } DeviceCaps;
|
---|
| 75 |
|
---|
| 76 | typedef struct tagGDI_DRIVER
|
---|
| 77 | {
|
---|
| 78 | BOOL (*pInitialize)(void);
|
---|
| 79 | void (*pFinalize)(void);
|
---|
| 80 | } GDI_DRIVER;
|
---|
| 81 |
|
---|
| 82 | extern GDI_DRIVER *GDI_Driver;
|
---|
| 83 |
|
---|
| 84 | /* Device independent DC information */
|
---|
| 85 | typedef struct
|
---|
| 86 | {
|
---|
| 87 | int flags;
|
---|
| 88 | const DeviceCaps *devCaps;
|
---|
| 89 |
|
---|
| 90 | HRGN16 hClipRgn; /* Clip region (may be 0) */
|
---|
| 91 | HRGN16 hVisRgn; /* Visible region (must never be 0) */
|
---|
| 92 | HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
|
---|
| 93 | HPEN16 hPen;
|
---|
| 94 | HBRUSH16 hBrush;
|
---|
| 95 | HFONT16 hFont;
|
---|
| 96 | HBITMAP16 hBitmap;
|
---|
| 97 | HBITMAP16 hFirstBitmap; /* Bitmap selected at creation of the DC */
|
---|
| 98 | HANDLE16 hDevice;
|
---|
| 99 | HPALETTE16 hPalette;
|
---|
| 100 |
|
---|
| 101 | GdiPath path;
|
---|
| 102 |
|
---|
| 103 | WORD ROPmode;
|
---|
| 104 | WORD polyFillMode;
|
---|
| 105 | WORD stretchBltMode;
|
---|
| 106 | WORD relAbsMode;
|
---|
| 107 | WORD backgroundMode;
|
---|
| 108 | COLORREF backgroundColor;
|
---|
| 109 | COLORREF textColor;
|
---|
| 110 | short brushOrgX;
|
---|
| 111 | short brushOrgY;
|
---|
| 112 |
|
---|
| 113 | WORD textAlign; /* Text alignment from SetTextAlign() */
|
---|
| 114 | short charExtra; /* Spacing from SetTextCharacterExtra() */
|
---|
| 115 | short breakTotalExtra; /* Total extra space for justification */
|
---|
| 116 | short breakCount; /* Break char. count */
|
---|
| 117 | short breakExtra; /* breakTotalExtra / breakCount */
|
---|
| 118 | short breakRem; /* breakTotalExtra % breakCount */
|
---|
| 119 |
|
---|
| 120 | RECT totalExtent;
|
---|
| 121 | BYTE bitsPerPixel;
|
---|
| 122 |
|
---|
| 123 | INT MapMode;
|
---|
| 124 | INT GraphicsMode; /* Graphics mode */
|
---|
| 125 | INT DCOrgX; /* DC origin */
|
---|
| 126 | INT DCOrgY;
|
---|
| 127 | FARPROC16 lpfnPrint; /* AbortProc for Printing */
|
---|
| 128 | INT CursPosX; /* Current position */
|
---|
| 129 | INT CursPosY;
|
---|
| 130 | INT ArcDirection;
|
---|
| 131 | XFORM xformWorld2Wnd; /* World-to-window transformation */
|
---|
| 132 | XFORM xformWorld2Vport; /* World-to-viewport transformation */
|
---|
| 133 | XFORM xformVport2World; /* Inverse of the above transformation */
|
---|
| 134 | BOOL vport2WorldValid; /* Is xformVport2World valid? */
|
---|
| 135 | } WIN_DC_INFO;
|
---|
| 136 |
|
---|
| 137 | typedef struct tagDC
|
---|
| 138 | {
|
---|
| 139 | GDIOBJHDR header;
|
---|
| 140 | HDC hSelf; /* Handle to this DC */
|
---|
| 141 | const struct tagDC_FUNCS *funcs; /* DC function table */
|
---|
| 142 | void *physDev; /* Physical device (driver-specific) */
|
---|
| 143 | INT saveLevel;
|
---|
| 144 | DWORD dwHookData;
|
---|
| 145 | FARPROC16 hookProc;
|
---|
| 146 |
|
---|
| 147 | INT wndOrgX; /* Window origin */
|
---|
| 148 | INT wndOrgY;
|
---|
| 149 | INT wndExtX; /* Window extent */
|
---|
| 150 | INT wndExtY;
|
---|
| 151 | INT vportOrgX; /* Viewport origin */
|
---|
| 152 | INT vportOrgY;
|
---|
| 153 | INT vportExtX; /* Viewport extent */
|
---|
| 154 | INT vportExtY;
|
---|
| 155 |
|
---|
| 156 | WIN_DC_INFO w;
|
---|
| 157 | } DC;
|
---|
| 158 |
|
---|
| 159 |
|
---|
| 160 | /* LoadOEMResource types */
|
---|
| 161 | #define OEM_BITMAP 1
|
---|
| 162 | #define OEM_CURSOR 2
|
---|
| 163 | #define OEM_ICON 3
|
---|
| 164 |
|
---|
| 165 | /* DC hook codes */
|
---|
| 166 | #define DCHC_INVALIDVISRGN 0x0001
|
---|
| 167 | #define DCHC_DELETEDC 0x0002
|
---|
| 168 |
|
---|
| 169 | #define DCHF_INVALIDATEVISRGN 0x0001
|
---|
| 170 | #define DCHF_VALIDATEVISRGN 0x0002
|
---|
| 171 |
|
---|
| 172 | /* DC flags */
|
---|
| 173 | #define DC_MEMORY 0x0001 /* It is a memory DC */
|
---|
| 174 | #define DC_SAVED 0x0002 /* It is a saved DC */
|
---|
| 175 | #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
|
---|
| 176 | #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
|
---|
| 177 |
|
---|
| 178 | /* Last 32 bytes are reserved for stock object handles */
|
---|
| 179 | #define GDI_HEAP_SIZE 0xffe0
|
---|
| 180 |
|
---|
| 181 | /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
|
---|
| 182 | #define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
|
---|
| 183 |
|
---|
| 184 | /* Stock objects handles */
|
---|
| 185 |
|
---|
| 186 | #define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
|
---|
| 187 |
|
---|
| 188 | #define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
|
---|
| 189 | #define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
|
---|
| 190 | #define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
|
---|
| 191 | #define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
|
---|
| 192 | #define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
|
---|
| 193 | #define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH))
|
---|
| 194 | #define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
|
---|
| 195 | #define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
|
---|
| 196 | #define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
|
---|
| 197 | #define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
|
---|
| 198 | #define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
|
---|
| 199 | #define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
|
---|
| 200 | #define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
|
---|
| 201 | #define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
|
---|
| 202 | #define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
|
---|
| 203 | #define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
|
---|
| 204 | #define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
|
---|
| 205 | #define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
|
---|
| 206 |
|
---|
| 207 | #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
|
---|
| 208 | #define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
|
---|
| 209 |
|
---|
| 210 | #define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
|
---|
| 211 |
|
---|
| 212 | /* Device <-> logical coords conversion */
|
---|
| 213 |
|
---|
| 214 | /* A floating point version of the POINT structure */
|
---|
| 215 | typedef struct tagFLOAT_POINT
|
---|
| 216 | {
|
---|
| 217 | FLOAT x, y;
|
---|
| 218 | } FLOAT_POINT;
|
---|
| 219 |
|
---|
| 220 |
|
---|
| 221 | #define XDPTOLP(dc,x) \
|
---|
| 222 | (((x)-(dc)->vportOrgX) * (dc)->wndExtX / (dc)->vportExtX+(dc)->wndOrgX)
|
---|
| 223 | #define YDPTOLP(dc,y) \
|
---|
| 224 | (((y)-(dc)->vportOrgY) * (dc)->wndExtY / (dc)->vportExtY+(dc)->wndOrgY)
|
---|
| 225 | #define XLPTODP(dc,x) \
|
---|
| 226 | (((x)-(dc)->wndOrgX) * (dc)->vportExtX / (dc)->wndExtX+(dc)->vportOrgX)
|
---|
| 227 | #define YLPTODP(dc,y) \
|
---|
| 228 | (((y)-(dc)->wndOrgY) * (dc)->vportExtY / (dc)->wndExtY+(dc)->vportOrgY)
|
---|
| 229 |
|
---|
| 230 | /* Device <-> logical size conversion */
|
---|
| 231 |
|
---|
| 232 | #define XDSTOLS(dc,x) \
|
---|
| 233 | ((x) * (dc)->wndExtX / (dc)->vportExtX)
|
---|
| 234 | #define YDSTOLS(dc,y) \
|
---|
| 235 | ((y) * (dc)->wndExtY / (dc)->vportExtY)
|
---|
| 236 | #define XLSTODS(dc,x) \
|
---|
| 237 | ((x) * (dc)->vportExtX / (dc)->wndExtX)
|
---|
| 238 | #define YLSTODS(dc,y) \
|
---|
| 239 | ((y) * (dc)->vportExtY / (dc)->wndExtY)
|
---|
| 240 |
|
---|
| 241 | /* GDI local heap */
|
---|
| 242 |
|
---|
| 243 | extern WORD GDI_HeapSel;
|
---|
| 244 |
|
---|
| 245 | #define GDI_HEAP_ALLOC(size) \
|
---|
| 246 | LOCAL_Alloc( GDI_HeapSel, LMEM_FIXED, (size) )
|
---|
| 247 | #define GDI_HEAP_ALLOC_MOVEABLE(size) \
|
---|
| 248 | LOCAL_Alloc( GDI_HeapSel, LMEM_MOVEABLE, (size) )
|
---|
| 249 | #define GDI_HEAP_REALLOC(handle,size) \
|
---|
| 250 | LOCAL_ReAlloc( GDI_HeapSel, (handle), (size), LMEM_FIXED )
|
---|
| 251 | #define GDI_HEAP_FREE(handle) \
|
---|
| 252 | LOCAL_Free( GDI_HeapSel, (handle) )
|
---|
| 253 |
|
---|
| 254 | #define GDI_HEAP_LOCK(handle) \
|
---|
| 255 | LOCAL_Lock( GDI_HeapSel, (handle) )
|
---|
| 256 | #define GDI_HEAP_LOCK_SEGPTR(handle) \
|
---|
| 257 | LOCAL_LockSegptr( GDI_HeapSel, (handle) )
|
---|
| 258 | #define GDI_HEAP_UNLOCK(handle) \
|
---|
| 259 | ((((HGDIOBJ16)(handle) >= FIRST_STOCK_HANDLE) && \
|
---|
| 260 | ((HGDIOBJ16)(handle)<=LAST_STOCK_HANDLE)) ? \
|
---|
| 261 | 0 : LOCAL_Unlock( GDI_HeapSel, (handle) ))
|
---|
| 262 |
|
---|
| 263 | extern GDIOBJHDR * GDI_GetObjPtr( HGDIOBJ16, WORD );
|
---|
| 264 |
|
---|
[8826] | 265 | VOID GDI_ReleaseObj(HANDLE hObject);
|
---|
| 266 | BOOL GDI_FreeObject(HANDLE hObject, LPVOID lpObjectData);
|
---|
| 267 | LPVOID GDI_AllocObject( int size, DWORD ulType, HANDLE *phObject );
|
---|
[4] | 268 |
|
---|
| 269 | #endif /* __WINE_GDI_H */
|
---|