Release 970415
[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 <X11/extensions/XShm.h>
16
17 typedef struct
18 {
19   XShmSegmentInfo       si;
20   SEGPTR                bits;
21 } __ShmBitmapCtl;
22
23 #endif
24
25   /* GDI logical bitmap object */
26 typedef struct
27 {
28     GDIOBJHDR   header;
29     BITMAP16    bitmap;
30     Pixmap      pixmap;
31     SIZE16      size;   /* For SetBitmapDimension() */
32 } BITMAPOBJ;
33
34   /* GCs used for B&W and color bitmap operations */
35 extern GC BITMAP_monoGC, BITMAP_colorGC;
36
37 #define BITMAP_GC(bmp) \
38   (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
39
40 #define BITMAP_WIDTH_BYTES(width,bpp) \
41     (((bpp) == 24) ? (width) * 4 : ((width) * (bpp) + 15) / 16 * 2)
42
43 #define XCREATEIMAGE(image,width,height,bpp) \
44 { \
45     int width_bytes = DIB_GetImageWidthBytesX11( (width), (bpp) ); \
46     (image) = XCreateImage(display, DefaultVisualOfScreen(screen), \
47                            (bpp), ZPixmap, 0, xmalloc( (height)*width_bytes ),\
48                            (width), (height), 32, width_bytes ); \
49 }
50
51   /* objects/bitmap.c */
52 extern BOOL32 BITMAP_Init(void);
53 extern INT16 BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer );
54 extern INT32 BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer );
55 extern BOOL32 BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bitmap );
56
57   /* objects/dib.c */
58 extern int DIB_GetImageWidthBytes( int width, int depth );
59 extern int DIB_GetImageWidthBytesX11( int width, int depth );
60 extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
61
62   /* objects/oembitmap.c */
63 extern HBITMAP16 OBM_LoadBitmap( WORD id );
64 extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor );
65
66 #endif  /* __WINE_BITMAP_H */