update for HEAD-2003091401
[reactos.git] / include / win32k / cursoricon.h
1
2 #ifndef __WIN32K_CURSORICON_H
3 #define __WIN32K_CURSORICON_H
4
5 #include <win32k/dc.h>
6 #include <win32k/gdiobj.h>
7
8 /* Structures for reading icon/cursor files and resources */
9 // Structures for reading icon files and resources 
10 typedef struct _ICONIMAGE
11 {
12    BITMAPINFOHEADER   icHeader;      // DIB header
13    RGBQUAD         icColors[1];   // Color table
14    BYTE            icXOR[1];      // DIB bits for XOR mask
15    BYTE            icAND[1];      // DIB bits for AND mask
16 } PACKED ICONIMAGE, *LPICONIMAGE;
17
18 typedef struct _CURSORIMAGE
19 {
20    BITMAPINFOHEADER   icHeader;      // DIB header
21    RGBQUAD         icColors[1];   // Color table
22    BYTE            icXOR[1];      // DIB bits for XOR mask
23    BYTE            icAND[1];      // DIB bits for AND mask
24 } PACKED CURSORIMAGE, *LPCURSORIMAGE;
25
26 typedef struct
27 {
28     BYTE   bWidth;
29     BYTE   bHeight;
30     BYTE   bColorCount;
31     BYTE   bReserved;
32 } PACKED ICONRESDIR;
33
34 typedef struct
35 {
36     WORD   wWidth;
37     WORD   wHeight;
38 } PACKED CURSORRESDIR;
39
40 typedef struct
41 {
42     WORD   wPlanes;                             // Number of Color Planes in the XOR image
43     WORD   wBitCount;                   // Bits per pixel in the XOR image
44 } PACKED ICONDIR;
45
46 typedef struct
47 {
48     WORD   wXHotspot;                           // Number of Color Planes in the XOR image
49     WORD   wYHotspot;                   // Bits per pixel in the XOR image
50 } PACKED CURSORDIR;
51
52 typedef struct
53 {
54     BYTE   bWidth;                              // Width, in pixels, of the icon image
55     BYTE   bHeight;                             // Height, in pixels, of the icon image
56     BYTE   bColorCount;                 // Number of colors in image (0 if >=8bpp)
57     BYTE   bReserved;                   // Reserved ( must be 0)
58         union
59     { ICONDIR icon;
60       CURSORDIR  cursor;
61     } Info;
62     DWORD  dwBytesInRes;                // How many bytes in this resource?
63     DWORD  dwImageOffset;               // Where in the file is this image?
64 } PACKED CURSORICONDIRENTRY;
65
66 typedef struct
67 {
68     WORD                                idReserved;             // Reserved (must be 0)
69     WORD                                idType;                 // Resource Type (1 for icons, 0 for cursors)
70     WORD                                idCount;                // How many images?
71     CURSORICONDIRENTRY  idEntries[1] __attribute__((packed));   // An entry for idCount number of images
72 } PACKED CURSORICONDIR;
73
74 typedef struct
75 {  
76         union
77     { ICONRESDIR icon;
78       CURSORRESDIR  cursor;
79     } ResInfo;
80         WORD   wPlanes;              // Color Planes
81         WORD   wBitCount;            // Bits per pixel
82         DWORD  dwBytesInRes;         // how many bytes in this resource?
83         WORD   nID;                  // the ID
84 } PACKED GRPCURSORICONDIRENTRY;
85
86 typedef struct 
87 {
88    WORD            idReserved;   // Reserved (must be 0)
89    WORD            idType;       // Resource type (1 for icons)
90    WORD            idCount;      // How many images?
91    GRPCURSORICONDIRENTRY   idEntries[1] PACKED; // The entries for each image
92 } PACKED GRPCURSORICONDIR;
93
94 /* GDI logical Icon/Cursor object */
95 typedef struct _ICONCURSOROBJ
96 {
97         BOOL            fIcon;
98         DWORD           xHotspot;
99         DWORD           yHotspot;
100         BITMAP          ANDBitmap;
101         BITMAP          XORBitmap;
102 } ICONCURSOROBJ, *PICONCURSOROBJ;
103
104 /*  Internal interfaces  */
105 #define  ICONCURSOROBJ_AllocIconCursor()  \
106   ((HICON) GDIOBJ_AllocObj (sizeof (ICONCURSOROBJ), GDI_OBJECT_TYPE_ICONCURSOR, (GDICLEANUPPROC) IconCursor_InternalDelete))
107
108 #define  ICONCURSOROBJ_LockIconCursor(hICObj)  \
109   ((PICONCURSOROBJ) GDIOBJ_LockObj ((HGDIOBJ) hICObj, GDI_OBJECT_TYPE_ICONCURSOR))
110   
111 #define  ICONCURSOROBJ_UnlockIconCursor(hICObj) GDIOBJ_UnlockObj ((HGDIOBJ) hICObj, GDI_OBJECT_TYPE_ICONCURSOR)
112
113
114 BOOL FASTCALL IconCursor_InternalDelete( PICONCURSOROBJ pIconCursor );
115
116 /*  User Entry Points  */
117 HICON 
118 STDCALL 
119 NtGdiCreateIcon (
120     BOOL fIcon,
121         INT  Width,
122         INT  Height,
123         UINT  Planes,
124         UINT  BitsPerPel,
125         DWORD xHotspot,
126         DWORD yHotspot,
127         const VOID *ANDBits,
128         const VOID *XORBits
129         );
130
131
132
133 #endif