4 * Copyright 1993 Alexandre Julliard
16 /* GDI objects magic numbers */
17 #define PEN_MAGIC 0x4f47
18 #define BRUSH_MAGIC 0x4f48
19 #define FONT_MAGIC 0x4f49
20 #define PALETTE_MAGIC 0x4f4a
21 #define BITMAP_MAGIC 0x4f4b
22 #define REGION_MAGIC 0x4f4c
23 #define DC_MAGIC 0x4f4d
24 #define DISABLED_DC_MAGIC 0x4f4e
25 #define META_DC_MAGIC 0x4f4f
26 #define METAFILE_MAGIC 0x4f50
27 #define METAFILE_DC_MAGIC 0x4f51
30 typedef struct tagREGION
37 typedef struct tagGDIOBJHDR
45 typedef struct tagBRUSHOBJ
48 LOGBRUSH logbrush WINE_PACKED
;
51 typedef struct tagPENOBJ
54 LOGPEN logpen WINE_PACKED
;
57 typedef struct tagPALETTEOBJ
60 LOGPALETTE logpalette WINE_PACKED
;
63 typedef struct tagFONTOBJ
66 LOGFONT logfont WINE_PACKED
;
69 typedef struct tagBITMAPOBJ
74 SIZE size
; /* For SetBitmapDimension() */
77 typedef struct tagRGNOBJ
85 WORD version
; /* 0: driver version */
86 WORD technology
; /* 2: device technology */
87 WORD horzSize
; /* 4: width of display in mm */
88 WORD vertSize
; /* 6: height of display in mm */
89 WORD horzRes
; /* 8: width of display in pixels */
90 WORD vertRes
; /* 10: width of display in pixels */
91 WORD bitsPixel
; /* 12: bits per pixel */
92 WORD planes
; /* 14: color planes */
93 WORD numBrushes
; /* 16: device-specific brushes */
94 WORD numPens
; /* 18: device-specific pens */
95 WORD numMarkers
; /* 20: device-specific markers */
96 WORD numFonts
; /* 22: device-specific fonts */
97 WORD numColors
; /* 24: size of color table */
98 WORD pdeviceSize
; /* 26: size of PDEVICE structure */
99 WORD curveCaps
; /* 28: curve capabilities */
100 WORD lineCaps
; /* 30: line capabilities */
101 WORD polygonalCaps
; /* 32: polygon capabilities */
102 WORD textCaps
; /* 34: text capabilities */
103 WORD clipCaps
; /* 36: clipping capabilities */
104 WORD rasterCaps
; /* 38: raster capabilities */
105 WORD aspectX
; /* 40: relative width of device pixel */
106 WORD aspectY
; /* 42: relative height of device pixel */
107 WORD aspectXY
; /* 44: relative diagonal width of device pixel */
108 WORD pad1
[21]; /* 46-86: reserved */
109 WORD logPixelsX
; /* 88: pixels / logical X inch */
110 WORD logPixelsY
; /* 90: pixels / logical Y inch */
111 WORD pad2
[6]; /* 92-102: reserved */
112 WORD sizePalette
; /* 104: entries in system palette */
113 WORD numReserved
; /* 106: reserved entries */
114 WORD colorRes
; /* 108: color resolution */
118 /* Device independent DC information */
125 HRGN hClipRgn
; /* Clip region */
126 HRGN hVisRgn
; /* Visible region */
127 HRGN hGCClipRgn
; /* GC clip region (ClipRgn AND VisRgn) */
140 COLORREF backgroundColor
;
147 WORD textAlign
; /* Text alignment from SetTextAlign() */
148 short charExtra
; /* Spacing from SetTextCharacterExtra() */
149 short breakTotalExtra
; /* Total extra space for justification */
150 short breakCount
; /* Break char. count */
151 short breakExtra
; /* breakTotalExtra / breakCount */
152 short breakRem
; /* breakTotalExtra % breakCount */
157 short DCOrgX
; /* DC origin */
159 short DCSizeX
; /* DC dimensions */
161 short CursPosX
; /* Current position */
184 /* X physical brush */
193 /* X physical font */
196 XFontStruct
* fstruct
;
200 /* X physical palette information */
207 /* X-specific DC information */
210 GC gc
; /* X Window GC */
227 /* other devices (e.g. printer) */
232 #define DC_MEMORY 1 /* It is a memory DC */
233 #define DC_SAVED 2 /* It is a saved DC */
235 /* Last 32 bytes are reserved for stock object handles */
236 #define GDI_HEAP_SIZE 0xffe0
238 /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
239 #define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
241 /* Stock objects handles */
243 #define STOCK_WHITE_BRUSH (FIRST_STOCK_HANDLE + WHITE_BRUSH)
244 #define STOCK_LTGRAY_BRUSH (FIRST_STOCK_HANDLE + LTGRAY_BRUSH)
245 #define STOCK_GRAY_BRUSH (FIRST_STOCK_HANDLE + GRAY_BRUSH)
246 #define STOCK_DKGRAY_BRUSH (FIRST_STOCK_HANDLE + DKGRAY_BRUSH)
247 #define STOCK_BLACK_BRUSH (FIRST_STOCK_HANDLE + BLACK_BRUSH)
248 #define STOCK_NULL_BRUSH (FIRST_STOCK_HANDLE + NULL_BRUSH)
249 #define STOCK_HOLLOW_BRUSH (FIRST_STOCK_HANDLE + HOLLOW_BRUSH)
250 #define STOCK_WHITE_PEN (FIRST_STOCK_HANDLE + WHITE_PEN)
251 #define STOCK_BLACK_PEN (FIRST_STOCK_HANDLE + BLACK_PEN)
252 #define STOCK_NULL_PEN (FIRST_STOCK_HANDLE + NULL_PEN)
253 #define STOCK_OEM_FIXED_FONT (FIRST_STOCK_HANDLE + OEM_FIXED_FONT)
254 #define STOCK_ANSI_FIXED_FONT (FIRST_STOCK_HANDLE + ANSI_FIXED_FONT)
255 #define STOCK_ANSI_VAR_FONT (FIRST_STOCK_HANDLE + ANSI_VAR_FONT)
256 #define STOCK_SYSTEM_FONT (FIRST_STOCK_HANDLE + SYSTEM_FONT)
257 #define STOCK_DEVICE_DEFAULT_FONT (FIRST_STOCK_HANDLE + DEVICE_DEFAULT_FONT)
258 #define STOCK_DEFAULT_PALETTE (FIRST_STOCK_HANDLE + DEFAULT_PALETTE)
259 #define STOCK_SYSTEM_FIXED_FONT (FIRST_STOCK_HANDLE + SYSTEM_FIXED_FONT)
261 #define NB_STOCK_OBJECTS (SYSTEM_FIXED_FONT + 1)
263 #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
264 #define LAST_STOCK_FONT STOCK_SYSTEM_FIXED_FONT
268 /* Device <-> logical coords conversion */
270 #define XDPTOLP(dc,x) \
271 (((x)-(dc)->w.VportOrgX) * (dc)->w.WndExtX / (dc)->w.VportExtX+(dc)->w.WndOrgX)
272 #define YDPTOLP(dc,y) \
273 (((y)-(dc)->w.VportOrgY) * (dc)->w.WndExtY / (dc)->w.VportExtY+(dc)->w.WndOrgY)
274 #define XLPTODP(dc,x) \
275 (((x)-(dc)->w.WndOrgX) * (dc)->w.VportExtX / (dc)->w.WndExtX+(dc)->w.VportOrgX)
276 #define YLPTODP(dc,y) \
277 (((y)-(dc)->w.WndOrgY) * (dc)->w.VportExtY / (dc)->w.WndExtY+(dc)->w.VportOrgY)
284 #define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size)
285 #define GDI_HEAP_ADDR(handle) LocalLock (handle)
286 #define GDI_HEAP_FREE(handle) LocalFree (handle)
290 extern MDESC
*GDI_Heap
;
292 #define GDI_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&GDI_Heap,f,size) & 0xffff)
293 #define GDI_HEAP_ADDR(handle) ((void *)((handle)|((int)GDI_Heap & 0xffff0000)))
294 #define GDI_HEAP_FREE(handle) (HEAP_Free(&GDI_Heap,GDI_HEAP_ADDR(handle)))
298 extern HANDLE
GDI_AllocObject( WORD
, WORD
);
299 extern BOOL
GDI_FreeObject( HANDLE
);
300 extern GDIOBJHDR
* GDI_GetObjPtr( HANDLE
, WORD
);
302 extern Display
* XT_display
; /* Will be removed */
303 extern Screen
* XT_screen
; /* Will be removed */
305 extern Display
* display
;
306 extern Screen
* screen
;
307 extern Window rootWindow
;
308 extern int screenWidth
, screenHeight
, screenDepth
;