220ee269e498fdf315c7dd22be29836c77c1d3a7
[reactos.git] / reactos / subsys / win32k / dib / dib.h
1 #ifndef _W32K_DIB_DIB_H
2 #define _W32K_DIB_DIB_H
3
4 #ifdef _M_IX86
5 #define memset4(dest, value, count) asm volatile("rep stosl" : : "D"(dest), "a"(value), "c"(count) : "memory");
6 #endif
7
8 #define ROP4_BLACKNESS ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))
9 #define ROP4_NOTSRCERASE ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))
10 #define ROP4_NOTSRCCOPY ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))
11 #define ROP4_SRCERASE ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))
12 #define ROP4_DSTINVERT ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))
13 #define ROP4_PATINVERT ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))
14 #define ROP4_SRCINVERT ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))
15 #define ROP4_SRCAND ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))
16 #define ROP4_MERGEPAINT ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))
17 #define ROP4_MERGECOPY ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))
18 #define ROP4_SRCCOPY ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))
19 #define ROP4_SRCPAINT ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))
20 #define ROP4_PATCOPY ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))
21 #define ROP4_PATPAINT ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))
22 #define ROP4_WHITENESS ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))
23
24
25 typedef struct _BLTINFO
26 {
27 SURFOBJ *DestSurface;
28 SURFOBJ *SourceSurface;
29 SURFOBJ *PatternSurface;
30 XLATEOBJ *XlateSourceToDest;
31 XLATEOBJ *XlatePatternToDest;
32 RECTL DestRect;
33 POINTL SourcePoint;
34 BRUSHOBJ *Brush;
35 POINTL BrushOrigin;
36 ULONG Rop4;
37 } BLTINFO, *PBLTINFO;
38
39 typedef VOID (*PFN_DIB_PutPixel)(SURFOBJ*,LONG,LONG,ULONG);
40 typedef ULONG (*PFN_DIB_GetPixel)(SURFOBJ*,LONG,LONG);
41 typedef VOID (*PFN_DIB_HLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
42 typedef VOID (*PFN_DIB_VLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
43 typedef BOOLEAN (*PFN_DIB_BitBlt)(PBLTINFO);
44 typedef BOOLEAN (*PFN_DIB_StretchBlt)(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
45 typedef BOOLEAN (*PFN_DIB_TransparentBlt)(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
46 typedef BOOLEAN (*PFN_DIB_ColorFill)(SURFOBJ*, RECTL*, ULONG);
47
48 typedef struct
49 {
50 PFN_DIB_PutPixel DIB_PutPixel;
51 PFN_DIB_GetPixel DIB_GetPixel;
52 PFN_DIB_HLine DIB_HLine;
53 PFN_DIB_VLine DIB_VLine;
54 PFN_DIB_BitBlt DIB_BitBlt;
55 PFN_DIB_BitBlt DIB_BitBltSrcCopy;
56 PFN_DIB_StretchBlt DIB_StretchBlt;
57 PFN_DIB_TransparentBlt DIB_TransparentBlt;
58 PFN_DIB_ColorFill DIB_ColorFill;
59 } DIB_FUNCTIONS;
60
61 extern DIB_FUNCTIONS DibFunctionsForBitmapFormat[];
62
63 VOID Dummy_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
64 ULONG Dummy_GetPixel(SURFOBJ*,LONG,LONG);
65 VOID Dummy_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
66 VOID Dummy_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
67 BOOLEAN Dummy_BitBlt(PBLTINFO);
68 BOOLEAN Dummy_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
69 BOOLEAN Dummy_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
70 BOOLEAN Dummy_ColorFill(SURFOBJ*, RECTL*, ULONG);
71
72 VOID DIB_1BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
73 ULONG DIB_1BPP_GetPixel(SURFOBJ*,LONG,LONG);
74 VOID DIB_1BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
75 VOID DIB_1BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
76 BOOLEAN DIB_1BPP_BitBlt(PBLTINFO);
77 BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
78 BOOLEAN DIB_1BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
79 BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
80 BOOLEAN DIB_1BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
81
82 VOID DIB_4BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
83 ULONG DIB_4BPP_GetPixel(SURFOBJ*,LONG,LONG);
84 VOID DIB_4BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
85 VOID DIB_4BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
86 BOOLEAN DIB_4BPP_BitBlt(PBLTINFO);
87 BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO);
88 BOOLEAN DIB_4BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
89 BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
90 BOOLEAN DIB_4BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
91
92 VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
93 ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG);
94 VOID DIB_8BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
95 VOID DIB_8BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
96 BOOLEAN DIB_8BPP_BitBlt(PBLTINFO);
97 BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
98 BOOLEAN DIB_8BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
99 BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
100 BOOLEAN DIB_8BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
101
102 VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
103 ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG);
104 VOID DIB_16BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
105 VOID DIB_16BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
106 BOOLEAN DIB_16BPP_BitBlt(PBLTINFO);
107 BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
108 BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
109 BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
110 BOOLEAN DIB_16BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
111
112 VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
113 ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG);
114 VOID DIB_24BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
115 VOID DIB_24BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
116 BOOLEAN DIB_24BPP_BitBlt(PBLTINFO);
117 BOOLEAN DIB_24BPP_BitBltSrcCopy(PBLTINFO);
118 BOOLEAN DIB_24BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
119 BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
120 BOOLEAN DIB_24BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
121
122 VOID DIB_32BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
123 ULONG DIB_32BPP_GetPixel(SURFOBJ*,LONG,LONG);
124 VOID DIB_32BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
125 VOID DIB_32BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
126 BOOLEAN DIB_32BPP_BitBlt(PBLTINFO);
127 BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO);
128 BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG);
129 BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
130 BOOLEAN DIB_32BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
131
132 BOOLEAN FASTCALL DIB_32DstInvert(PBLTINFO);
133
134 BOOLEAN FASTCALL DIB32_SrcPaint(PBLTINFO);
135 BOOLEAN FASTCALL DIB32_NotSrcErase(PBLTINFO);
136 BOOLEAN FASTCALL DIB32_SrcErase(PBLTINFO);
137
138 extern unsigned char notmask[2];
139 extern unsigned char altnotmask[2];
140 #define MASK1BPP(x) (1<<(7-((x)&7)))
141
142 ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern);
143
144 #define DIB_GetSource(SourceSurf,sx,sy,ColorTranslation) \
145 XLATEOBJ_iXlate(ColorTranslation, \
146 DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
147 DIB_GetPixel(SourceSurf, sx, sy))
148
149 #define DIB_GetSourceIndex(SourceSurf,sx,sy) \
150 DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
151 DIB_GetPixel(SourceSurf, sx, sy)
152
153 #endif /* _W32K_DIB_DIB_H */
154