Better function parameter checking.
[wine] / include / gdi.h
1 /*
2  * GDI definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_GDI_H
22 #define __WINE_GDI_H
23
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <wingdi.h>
28 #include <wine/wingdi16.h>
29 #include <math.h>
30
31   /* GDI objects magic numbers */
32 #define FIRST_MAGIC           0x4f47
33 #define PEN_MAGIC             0x4f47
34 #define BRUSH_MAGIC           0x4f48
35 #define FONT_MAGIC            0x4f49
36 #define PALETTE_MAGIC         0x4f4a
37 #define BITMAP_MAGIC          0x4f4b
38 #define REGION_MAGIC          0x4f4c
39 #define DC_MAGIC              0x4f4d
40 #define DISABLED_DC_MAGIC     0x4f4e
41 #define META_DC_MAGIC         0x4f4f
42 #define METAFILE_MAGIC        0x4f50
43 #define METAFILE_DC_MAGIC     0x4f51
44 #define ENHMETAFILE_MAGIC     0x4f52
45 #define ENHMETAFILE_DC_MAGIC  0x4f53
46 #define MEMORY_DC_MAGIC       0x4f54
47 #define LAST_MAGIC            0x4f54
48
49 #define MAGIC_DONTCARE        0xffff
50
51 /* GDI constants for making objects private/system (naming undoc. !) */
52 #define OBJECT_PRIVATE        0x2000
53 #define OBJECT_NOSYSTEM       0x8000
54
55 #define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
56
57 struct gdi_obj_funcs;
58 struct hdc_list;
59
60 typedef struct tagGDIOBJHDR
61 {
62     HANDLE16    hNext;
63     WORD        wMagic;
64     DWORD       dwCount;
65     const struct gdi_obj_funcs *funcs;
66     struct hdc_list *hdcs;
67 } GDIOBJHDR;
68
69 /* extra stock object: default 1x1 bitmap for memory DCs */
70 #define DEFAULT_BITMAP (STOCK_LAST+1)
71
72 /* bitmap object */
73
74 typedef struct tagBITMAPOBJ
75 {
76     GDIOBJHDR   header;
77     BITMAP      bitmap;
78     SIZE        size;   /* For SetBitmapDimension() */
79     const struct tagDC_FUNCS *funcs; /* DC function table */
80     void        *physBitmap; /* ptr to device specific data */
81     /* For device-independent bitmaps: */
82     DIBSECTION *dib;
83     SEGPTR      segptr_bits;  /* segptr to DIB bits */
84 } BITMAPOBJ;
85
86 /* palette object */
87
88 #define NB_RESERVED_COLORS     20   /* number of fixed colors in system palette */
89
90 #define PC_SYS_USED            0x80 /* palentry is used (both system and logical) */
91 #define PC_SYS_RESERVED        0x40 /* system palentry is not to be mapped to */
92 #define PC_SYS_MAPPED          0x10 /* logical palentry is a direct alias for system palentry */
93
94 typedef struct tagPALETTEOBJ
95 {
96     GDIOBJHDR                    header;
97     int                          *mapping;
98     LOGPALETTE                   logpalette; /* _MUST_ be the last field */
99 } PALETTEOBJ;
100
101   /* GDI local heap */
102
103 extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
104 extern void GDI_ReleaseObj( HGDIOBJ );
105
106 #define WINE_GGO_GRAY16_BITMAP 0x7f
107
108 #endif  /* __WINE_GDI_H */