[WIN32K]
[reactos.git] / subsystems / win32 / win32k / include / surface.h
1 #pragma once
2
3 #include "win32.h"
4 #include "gdiobj.h"
5
6 #define PDEV_SURFACE 0x80000000
7
8 /* GDI surface object */
9 typedef struct _SURFACE
10 {
11 BASEOBJECT BaseObject;
12
13 SURFOBJ SurfObj;
14 //XDCOBJ * pdcoAA;
15 FLONG flags;
16 struct _PALETTE *ppal;
17 //UINT unk_050;
18
19 union
20 {
21 HANDLE hSecureUMPD; // if UMPD_SURFACE set
22 HANDLE hMirrorParent;// if MIRROR_SURFACE set
23 HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set
24 };
25
26 SIZEL sizlDim; /* For SetBitmapDimension(), do NOT use
27 to get width/height of bitmap, use
28 bitmap.bmWidth/bitmap.bmHeight for
29 that */
30
31 HDC hdc; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
32 ULONG cRef;
33 HPALETTE hpalHint;
34
35 /* For device-independent bitmaps: */
36 HANDLE hDIBSection;
37 HANDLE hSecure;
38 DWORD dwOffset;
39 //UINT unk_078;
40
41 /* reactos specific */
42 DWORD biClrImportant;
43 } SURFACE, *PSURFACE;
44
45 // flags field:
46 //#define HOOK_BITBLT 0x00000001
47 //#define HOOK_STRETCHBLT 0x00000002
48 //#define HOOK_PLGBLT 0x00000004
49 //#define HOOK_TEXTOUT 0x00000008
50 //#define HOOK_PAINT 0x00000010
51 //#define HOOK_STROKEPATH 0x00000020
52 //#define HOOK_FILLPATH 0x00000040
53 //#define HOOK_STROKEANDFILLPATH 0x00000080
54 //#define HOOK_LINETO 0x00000100
55 //#define SHAREACCESS_SURFACE 0x00000200
56 //#define HOOK_COPYBITS 0x00000400
57 //#define REDIRECTION_SURFACE 0x00000800 // ?
58 //#define HOOK_MOVEPANNING 0x00000800
59 //#define HOOK_SYNCHRONIZE 0x00001000
60 //#define HOOK_STRETCHBLTROP 0x00002000
61 //#define HOOK_SYNCHRONIZEACCESS 0x00004000
62 //#define USE_DEVLOCK_SURFACE 0x00004000
63 //#define HOOK_TRANSPARENTBLT 0x00008000
64 //#define HOOK_ALPHABLEND 0x00010000
65 //#define HOOK_GRADIENTFILL 0x00020000
66 //#if (NTDDI_VERSION < 0x06000000)
67 // #define HOOK_FLAGS 0x0003B5FF
68 //#else
69 // #define HOOK_FLAGS 0x0003B5EF
70 //#endif
71 #define UMPD_SURFACE 0x00040000
72 #define MIRROR_SURFACE 0x00080000
73 #define DIRECTDRAW_SURFACE 0x00100000
74 #define DRIVER_CREATED_SURFACE 0x00200000
75 #define ENG_CREATE_DEVICE_SURFACE 0x00400000
76 #define DDB_SURFACE 0x00800000
77 #define LAZY_DELETE_SURFACE 0x01000000
78 #define BANDING_SURFACE 0x02000000
79 #define API_BITMAP 0x04000000
80 #define PALETTE_SELECT_SET 0x08000000
81 #define UNREADABLE_SURFACE 0x10000000
82 #define DYNAMIC_MODE_PALETTE 0x20000000
83 #define ABORT_SURFACE 0x40000000
84 #define PDEV_SURFACE 0x80000000
85
86
87 #define BMF_DONT_FREE 0x100
88 #define BMF_RLE_HACK 0x200
89
90
91 /* Internal interface */
92
93 #define SURFACE_AllocSurfaceWithHandle() ((PSURFACE) GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP))
94 #define SURFACE_FreeSurface(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_SURF_TYPE)
95 #define SURFACE_FreeSurfaceByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
96
97 /* NOTE: Use shared locks! */
98 #define SURFACE_LockSurface(hBMObj) \
99 ((PSURFACE) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
100 #define SURFACE_ShareLockSurface(hBMObj) \
101 ((PSURFACE) GDIOBJ_ShareLockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
102 #define SURFACE_UnlockSurface(pBMObj) \
103 GDIOBJ_UnlockObjByPtr ((POBJ)pBMObj)
104 #define SURFACE_ShareUnlockSurface(pBMObj) \
105 GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj)
106
107 BOOL INTERNAL_CALL SURFACE_Cleanup(PVOID ObjectBody);
108
109 PSURFACE
110 NTAPI
111 SURFACE_AllocSurface(
112 IN ULONG iType,
113 IN ULONG cx,
114 IN ULONG cy,
115 IN ULONG iFormat);
116
117 BOOL
118 NTAPI
119 SURFACE_bSetBitmapBits(
120 IN PSURFACE psurf,
121 IN USHORT fjBitmap,
122 IN ULONG ulWidth,
123 IN PVOID pvBits OPTIONAL);
124
125 #define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
126 #define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions
127
128 ULONG FASTCALL BitmapFormat (WORD Bits, DWORD Compression);
129 extern UCHAR gajBitsPerFormat[];
130 #define BitsPerFormat(Format) gajBitsPerFormat[Format]