4 * Copyright 1993 Alexandre Julliard
10 #include <X11/Intrinsic.h>
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
__attribute__ ((packed
));
51 typedef struct tagPENOBJ
54 LOGPEN logpen
__attribute__ ((packed
));
57 typedef struct tagPALETTEOBJ
60 LOGPALETTE logpalette
__attribute__ ((packed
));
63 typedef struct tagFONTOBJ
66 LOGFONT logfont
__attribute__ ((packed
));
69 typedef struct tagBITMAPOBJ
78 typedef struct tagRGNOBJ
86 WORD version
; /* 0: driver version */
87 WORD technology
; /* 2: device technology */
88 WORD horzSize
; /* 4: width of display in mm */
89 WORD vertSize
; /* 6: height of display in mm */
90 WORD horzRes
; /* 8: width of display in pixels */
91 WORD vertRes
; /* 10: width of display in pixels */
92 WORD bitsPixel
; /* 12: bits per pixel */
93 WORD planes
; /* 14: color planes */
94 WORD numBrushes
; /* 16: device-specific brushes */
95 WORD numPens
; /* 18: device-specific pens */
96 WORD numMarkers
; /* 20: device-specific markers */
97 WORD numFonts
; /* 22: device-specific fonts */
98 WORD numColors
; /* 24: size of color table */
99 WORD pdeviceSize
; /* 26: size of PDEVICE structure */
100 WORD curveCaps
; /* 28: curve capabilities */
101 WORD lineCaps
; /* 30: line capabilities */
102 WORD polygonalCaps
; /* 32: polygon capabilities */
103 WORD textCaps
; /* 34: text capabilities */
104 WORD clipCaps
; /* 36: clipping capabilities */
105 WORD rasterCaps
; /* 38: raster capabilities */
106 WORD aspectX
; /* 40: relative width of device pixel */
107 WORD aspectY
; /* 42: relative height of device pixel */
108 WORD aspectXY
; /* 44: relative diagonal width of device pixel */
109 WORD pad1
[21]; /* 46-86: reserved */
110 WORD logPixelsX
; /* 88: pixels / logical X inch */
111 WORD logPixelsY
; /* 90: pixels / logical Y inch */
112 WORD pad2
[6]; /* 92-102: reserved */
113 WORD sizePalette
; /* 104: entries in system palette */
114 WORD numReserved
; /* 106: reserved entries */
115 WORD colorRes
; /* 108: color resolution */
119 /* Device independent DC information */
126 HRGN hClipRgn
; /* Clip region */
127 HRGN hVisRgn
; /* Visible region */
128 HRGN hGCClipRgn
; /* GC clip region (ClipRgn AND VisRgn) */
141 COLORREF backgroundColor
;
148 WORD textAlign
; /* Text alignment from SetTextAlign() */
149 short charExtra
; /* Spacing from SetTextCharacterExtra() */
150 short breakTotalExtra
; /* Total extra space for justification */
151 short breakCount
; /* Break char. count */
152 short breakExtra
; /* breakTotalExtra / breakCount */
153 short breakRem
; /* breakTotalExtra % breakCount */
159 short DCOrgX
; /* DC origin */
161 short CursPosX
; /* Current position */
182 /* X physical brush */
191 /* X physical font */
194 XFontStruct
* fstruct
;
198 /* X-specific DC information */
201 GC gc
; /* X Window GC */
218 /* other devices (e.g. printer) */
223 #define DC_MEMORY 1 /* It is a memory DC */
224 #define DC_SAVED 2 /* It is a saved DC */
226 /* Last 32 bytes are reserved for stock object handles */
227 #define GDI_HEAP_SIZE 0xffe0
229 /* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
230 #define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
232 /* Stock objects handles */
234 #define STOCK_WHITE_BRUSH (FIRST_STOCK_HANDLE + WHITE_BRUSH)
235 #define STOCK_LTGRAY_BRUSH (FIRST_STOCK_HANDLE + LTGRAY_BRUSH)
236 #define STOCK_GRAY_BRUSH (FIRST_STOCK_HANDLE + GRAY_BRUSH)
237 #define STOCK_DKGRAY_BRUSH (FIRST_STOCK_HANDLE + DKGRAY_BRUSH)
238 #define STOCK_BLACK_BRUSH (FIRST_STOCK_HANDLE + BLACK_BRUSH)
239 #define STOCK_NULL_BRUSH (FIRST_STOCK_HANDLE + NULL_BRUSH)
240 #define STOCK_HOLLOW_BRUSH (FIRST_STOCK_HANDLE + HOLLOW_BRUSH)
241 #define STOCK_WHITE_PEN (FIRST_STOCK_HANDLE + WHITE_PEN)
242 #define STOCK_BLACK_PEN (FIRST_STOCK_HANDLE + BLACK_PEN)
243 #define STOCK_NULL_PEN (FIRST_STOCK_HANDLE + NULL_PEN)
244 #define STOCK_OEM_FIXED_FONT (FIRST_STOCK_HANDLE + OEM_FIXED_FONT)
245 #define STOCK_ANSI_FIXED_FONT (FIRST_STOCK_HANDLE + ANSI_FIXED_FONT)
246 #define STOCK_ANSI_VAR_FONT (FIRST_STOCK_HANDLE + ANSI_VAR_FONT)
247 #define STOCK_SYSTEM_FONT (FIRST_STOCK_HANDLE + SYSTEM_FONT)
248 #define STOCK_DEVICE_DEFAULT_FONT (FIRST_STOCK_HANDLE + DEVICE_DEFAULT_FONT)
249 #define STOCK_DEFAULT_PALETTE (FIRST_STOCK_HANDLE + DEFAULT_PALETTE)
250 #define STOCK_SYSTEM_FIXED_FONT (FIRST_STOCK_HANDLE + SYSTEM_FIXED_FONT)
252 #define NB_STOCK_OBJECTS (SYSTEM_FIXED_FONT + 1)
254 #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
255 #define LAST_STOCK_FONT STOCK_SYSTEM_FIXED_FONT
259 /* Device <-> logical coords conversion */
261 #define XDPTOLP(dc,x) \
262 (((x)-(dc)->w.VportOrgX) * (dc)->w.WndExtX / (dc)->w.VportExtX+(dc)->w.WndOrgX)
263 #define YDPTOLP(dc,y) \
264 (((y)-(dc)->w.VportOrgY) * (dc)->w.WndExtY / (dc)->w.VportExtY+(dc)->w.WndOrgY)
265 #define XLPTODP(dc,x) \
266 (((x)-(dc)->w.WndOrgX) * (dc)->w.VportExtX / (dc)->w.WndExtX+(dc)->w.VportOrgX)
267 #define YLPTODP(dc,y) \
268 (((y)-(dc)->w.WndOrgY) * (dc)->w.VportExtY / (dc)->w.WndExtY+(dc)->w.VportOrgY)
273 extern MDESC
*GDI_Heap
;
275 #define GDI_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&GDI_Heap,f,size) & 0xffff)
276 #define GDI_HEAP_ADDR(handle) ((void *)(handle | ((int)GDI_Heap & 0xffff0000)))
277 #define GDI_HEAP_FREE(handle) (HEAP_Free(&GDI_Heap,GDI_HEAP_ADDR(handle)))
280 extern HANDLE
GDI_AllocObject( WORD
, WORD
);
281 extern BOOL
GDI_FreeObject( HANDLE
);
282 extern GDIOBJHDR
* GDI_GetObjPtr( HANDLE
, WORD
);
284 extern Display
* XT_display
;
285 extern Screen
* XT_screen
;