Added Drag*32 functions.
[wine] / include / bitmap.h
1 /*
2  * GDI bitmap definitions
3  *
4  * Copyright 1993, 1994  Alexandre Julliard
5  */
6
7 #ifndef __WINE_BITMAP_H
8 #define __WINE_BITMAP_H
9
10 #include "gdi.h"
11 #include "xmalloc.h"
12
13 #ifdef PRELIMINARY_WING16_SUPPORT
14 /* FIXME: this doesn't belong here */
15 #include "ts_xshm.h"
16
17 typedef struct
18 {
19   XShmSegmentInfo       si;
20   SEGPTR                bits;
21 } __ShmBitmapCtl;
22
23 #endif
24
25   /* Additional info for DIB section objects */
26 typedef struct
27 {
28     /* Windows DIB section */
29     DIBSECTION  dibSection;
30
31     /* Mapping status */
32     enum { DIB_NoHandler, DIB_InSync, DIB_AppMod, DIB_GdiMod } status;
33
34     /* Color map info */
35     int         nColorMap;
36     int        *colorMap;
37
38     /* Cached XImage */
39     XImage     *image;
40
41 } DIBSECTIONOBJ;
42
43   /* GDI logical bitmap object */
44 typedef struct
45 {
46     GDIOBJHDR   header;
47     BITMAP16    bitmap;
48     Pixmap      pixmap;
49     SIZE16      size;   /* For SetBitmapDimension() */
50
51     /* For device-independent bitmaps: */
52     DIBSECTIONOBJ *dib;
53
54 } BITMAPOBJ;
55
56   /* GCs used for B&W and color bitmap operations */
57 extern GC BITMAP_monoGC, BITMAP_colorGC;
58
59 #define BITMAP_GC(bmp) \
60   (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
61
62 #define BITMAP_WIDTH_BYTES(width,bpp) \
63     (((bpp) == 24) ? (width) * 4 : ( ((bpp) == 15) ? (width) * 2 : \
64                                     ((width) * (bpp) + 15) / 16 * 2 ))
65
66 #define XCREATEIMAGE(image,width,height,bpp) \
67 { \
68     int width_bytes = DIB_GetXImageWidthBytes( (width), (bpp) ); \
69     (image) = TSXCreateImage(display, DefaultVisualOfScreen(screen), \
70                            (bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
71                            (width), (height), 32, width_bytes ); \
72 }
73
74   /* objects/bitmap.c */
75 extern BOOL32  BITMAP_Init(void);
76 extern INT16   BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer );
77 extern INT32   BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer );
78 extern BOOL32  BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bitmap );
79 extern XImage *BITMAP_GetXImage( const BITMAPOBJ *bmp );
80 extern INT32   BITMAP_GetBitsPadding( int width, int depth );
81 extern INT32   BITMAP_GetBitsWidth( int width, int depth );
82 extern HBITMAP32 BITMAP_LoadBitmap32W(HINSTANCE32 instance,LPCWSTR name,
83   UINT32 loadflags);
84
85   /* objects/dib.c */
86 extern int DIB_GetDIBWidthBytes( int width, int depth );
87 extern int DIB_GetXImageWidthBytes( int width, int depth );
88 extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
89 extern void DIB_UpdateDIBSection( DC *dc, BOOL32 toDIB );
90 extern void DIB_DeleteDIBSection( BITMAPOBJ *bmp );
91 extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp );
92 extern void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT32 loadflags,
93   BYTE pix);
94
95   /* objects/oembitmap.c */
96 extern BOOL32 OBM_Init(void);
97 extern HBITMAP16 OBM_LoadBitmap( WORD id );
98 extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor );
99
100 #endif  /* __WINE_BITMAP_H */