Release 980822
[wine/multimedia.git] / include / bitmap.h
blob5993b1acab0d08d78c4a31096ce30b3289e33bb7
1 /*
2 * GDI bitmap definitions
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #ifndef __WINE_BITMAP_H
8 #define __WINE_BITMAP_H
10 #include "gdi.h"
11 #include "xmalloc.h"
13 #ifdef PRELIMINARY_WING16_SUPPORT
14 /* FIXME: this doesn't belong here */
15 #include "ts_xshm.h"
17 typedef struct
19 XShmSegmentInfo si;
20 SEGPTR bits;
21 } __ShmBitmapCtl;
23 #endif
25 /* Additional info for DIB section objects */
26 typedef struct
28 /* Windows DIB section */
29 DIBSECTION dibSection;
31 /* Mapping status */
32 enum { DIB_NoHandler, DIB_InSync, DIB_AppMod, DIB_GdiMod } status;
34 /* Color map info */
35 int nColorMap;
36 int *colorMap;
38 /* Cached XImage */
39 XImage *image;
41 } DIBSECTIONOBJ;
43 /* GDI logical bitmap object */
44 typedef struct
46 GDIOBJHDR header;
47 BITMAP16 bitmap;
48 Pixmap pixmap;
49 SIZE16 size; /* For SetBitmapDimension() */
51 /* For device-independent bitmaps: */
52 DIBSECTIONOBJ *dib;
54 } BITMAPOBJ;
56 /* GCs used for B&W and color bitmap operations */
57 extern GC BITMAP_monoGC, BITMAP_colorGC;
59 #define BITMAP_GC(bmp) \
60 (((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
62 #define BITMAP_WIDTH_BYTES(width,bpp) \
63 (((bpp) == 24) ? (width) * 4 : ( ((bpp) == 15) ? (width) * 2 : \
64 ((width) * (bpp) + 15) / 16 * 2 ))
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 ); \
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 );
83 /* objects/dib.c */
84 extern int DIB_GetDIBWidthBytes( int width, int depth );
85 extern int DIB_GetXImageWidthBytes( int width, int depth );
86 extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
87 extern void DIB_UpdateDIBSection( DC *dc, BOOL32 toDIB );
88 extern void DIB_DeleteDIBSection( BITMAPOBJ *bmp );
89 extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp );
91 /* objects/oembitmap.c */
92 extern BOOL32 OBM_Init(void);
93 extern HBITMAP16 OBM_LoadBitmap( WORD id );
94 extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor );
96 #endif /* __WINE_BITMAP_H */