Release 980517
[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   /* 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 : ( ((bpp) == 15) ? (width) * 2 : \
42                                     ((width) * (bpp) + 15) / 16 * 2 ))
43
44 #define XCREATEIMAGE(image,width,height,bpp) \
45 { \
46     int width_bytes = DIB_GetXImageWidthBytes( (width), (bpp) ); \
47     (image) = TSXCreateImage(display, DefaultVisualOfScreen(screen), \
48                            (bpp), ZPixmap, 0, xmalloc( (height)*width_bytes ),\
49                            (width), (height), 32, width_bytes ); \
50 }
51
52   /* objects/bitmap.c */
53 extern BOOL32  BITMAP_Init(void);
54 extern INT16   BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer );
55 extern INT32   BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer );
56 extern BOOL32  BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bitmap );
57 extern XImage *BITMAP_GetXImage( const BITMAPOBJ *bmp );
58 extern INT32   BITMAP_GetBitsPadding( int width, int depth );
59 extern INT32   BITMAP_GetBitsWidth( int width, int depth );
60
61   /* objects/dib.c */
62 extern int DIB_GetDIBWidthBytes( int width, int depth );
63 extern int DIB_GetXImageWidthBytes( int width, int depth );
64 extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
65
66   /* objects/oembitmap.c */
67 extern BOOL32 OBM_Init(void);
68 extern HBITMAP16 OBM_LoadBitmap( WORD id );
69 extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor );
70
71 #endif  /* __WINE_BITMAP_H */