d799330f1d4709624b2d9395513894d54554834c
[reactos.git] / reactos / subsys / win32k / include / bitmaps.h
1
2 #ifndef __WIN32K_BITMAPS_H
3 #define __WIN32K_BITMAPS_H
4
5 /* GDI logical bitmap object */
6 typedef struct _BITMAPOBJ
7 {
8 SURFOBJ SurfObj;
9 FLONG flHooks;
10 FLONG flFlags;
11 SIZE dimension; /* For SetBitmapDimension(), do NOT use
12 to get width/height of bitmap, use
13 bitmap.bmWidth/bitmap.bmHeight for
14 that */
15 PFAST_MUTEX BitsLock; /* You need to hold this lock before you touch
16 the actual bits in the bitmap */
17
18 /* For device-independent bitmaps: */
19 DIBSECTION *dib;
20 HPALETTE hDIBPalette;
21 } BITMAPOBJ, *PBITMAPOBJ;
22
23 #define BITMAPOBJ_IS_APIBITMAP 0x1
24
25 /* Internal interface */
26
27 #define BITMAPOBJ_AllocBitmap() \
28 ((HBITMAP) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BITMAP))
29 #define BITMAPOBJ_FreeBitmap(hBMObj) \
30 GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
31 /* NOTE: Use shared locks! */
32 #define BITMAPOBJ_LockBitmap(hBMObj) (PBITMAPOBJ)EngLockSurface((HSURF)hBMObj)
33 #define BITMAPOBJ_UnlockBitmap(pBMObj) EngUnlockSurface(&pBMObj->SurfObj)
34 BOOL INTERNAL_CALL BITMAP_Cleanup(PVOID ObjectBody);
35
36 BOOL INTERNAL_CALL BITMAPOBJ_InitBitsLock(BITMAPOBJ *pBMObj);
37 #define BITMAPOBJ_LockBitmapBits(pBMObj) ExEnterCriticalRegionAndAcquireFastMutexUnsafe((pBMObj)->BitsLock)
38 #define BITMAPOBJ_UnlockBitmapBits(pBMObj) ExReleaseFastMutexUnsafeAndLeaveCriticalRegion((pBMObj)->BitsLock)
39 void INTERNAL_CALL BITMAPOBJ_CleanupBitsLock(BITMAPOBJ *pBMObj);
40
41 INT FASTCALL BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp);
42 HBITMAP FASTCALL BITMAPOBJ_CopyBitmap (HBITMAP hBitmap);
43 INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth);
44 int NTAPI DIB_GetDIBImageBytes (INT width, INT height, INT depth);
45 INT FASTCALL DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
46 INT NTAPI BITMAP_GetObject(BITMAPOBJ * bmp, INT count, LPVOID buffer);
47 HBITMAP FASTCALL BitmapToSurf(PBITMAPOBJ BitmapObj, HDEV GDIDevice);
48
49 #endif
50