4ae455bc92b39d441f6bcd116c0b8c4cc0523b4e
[reactos.git] / reactos / subsystems / win32 / win32k / dib / dib.h
1 #pragma once
2
3 #ifdef _M_IX86
4 #define memset4(dest, value, count) asm volatile("rep stosl" : : "D"(dest), "a"(value), "c"(count) : "memory");
5 #endif
6
7 #define ROP4_BLACKNESS ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))
8 #define ROP4_NOTSRCERASE ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))
9 #define ROP4_NOTSRCCOPY ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))
10 #define ROP4_SRCERASE ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))
11 #define ROP4_DSTINVERT ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))
12 #define ROP4_PATINVERT ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))
13 #define ROP4_SRCINVERT ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))
14 #define ROP4_SRCAND ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))
15 #define ROP4_MERGEPAINT ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))
16 #define ROP4_MERGECOPY ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))
17 #define ROP4_SRCCOPY ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))
18 #define ROP4_SRCPAINT ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))
19 #define ROP4_PATCOPY ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))
20 #define ROP4_PATPAINT ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))
21 #define ROP4_WHITENESS ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))
22
23
24 typedef struct _BLTINFO
25 {
26 SURFOBJ *DestSurface;
27 SURFOBJ *SourceSurface;
28 SURFOBJ *PatternSurface;
29 XLATEOBJ *XlateSourceToDest;
30 RECTL DestRect;
31 POINTL SourcePoint;
32 BRUSHOBJ *Brush;
33 POINTL BrushOrigin;
34 ULONG Rop4;
35 } BLTINFO, *PBLTINFO;
36
37 typedef VOID (*PFN_DIB_PutPixel)(SURFOBJ*,LONG,LONG,ULONG);
38 typedef ULONG (*PFN_DIB_GetPixel)(SURFOBJ*,LONG,LONG);
39 typedef VOID (*PFN_DIB_HLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
40 typedef VOID (*PFN_DIB_VLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
41 typedef BOOLEAN (*PFN_DIB_BitBlt)(PBLTINFO);
42 typedef BOOLEAN (*PFN_DIB_StretchBlt)(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,ROP4);
43 typedef BOOLEAN (*PFN_DIB_TransparentBlt)(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
44 typedef BOOLEAN (*PFN_DIB_ColorFill)(SURFOBJ*, RECTL*, ULONG);
45 typedef BOOLEAN (*PFN_DIB_AlphaBlend)(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
46
47 typedef struct
48 {
49 PFN_DIB_PutPixel DIB_PutPixel;
50 PFN_DIB_GetPixel DIB_GetPixel;
51 PFN_DIB_HLine DIB_HLine;
52 PFN_DIB_VLine DIB_VLine;
53 PFN_DIB_BitBlt DIB_BitBlt;
54 PFN_DIB_BitBlt DIB_BitBltSrcCopy;
55 PFN_DIB_StretchBlt DIB_StretchBlt;
56 PFN_DIB_TransparentBlt DIB_TransparentBlt;
57 PFN_DIB_ColorFill DIB_ColorFill;
58 PFN_DIB_AlphaBlend DIB_AlphaBlend;
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*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,ROP4);
69 BOOLEAN Dummy_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
70 BOOLEAN Dummy_ColorFill(SURFOBJ*, RECTL*, ULONG);
71 BOOLEAN Dummy_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
72
73 VOID DIB_1BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
74 ULONG DIB_1BPP_GetPixel(SURFOBJ*,LONG,LONG);
75 VOID DIB_1BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
76 VOID DIB_1BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
77 BOOLEAN DIB_1BPP_BitBlt(PBLTINFO);
78 BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
79 BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,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_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
89 BOOLEAN DIB_4BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
90
91 VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
92 ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG);
93 VOID DIB_8BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
94 VOID DIB_8BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
95 BOOLEAN DIB_8BPP_BitBlt(PBLTINFO);
96 BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
97 BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
98 BOOLEAN DIB_8BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
99
100 VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
101 ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG);
102 VOID DIB_16BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
103 VOID DIB_16BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
104 BOOLEAN DIB_16BPP_BitBlt(PBLTINFO);
105 BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
106 BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
107 BOOLEAN DIB_16BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
108
109 VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
110 ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG);
111 VOID DIB_24BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
112 VOID DIB_24BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
113 BOOLEAN DIB_24BPP_BitBlt(PBLTINFO);
114 BOOLEAN DIB_24BPP_BitBltSrcCopy(PBLTINFO);
115 BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
116 BOOLEAN DIB_24BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
117 BOOLEAN DIB_24BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
118
119 VOID DIB_32BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
120 ULONG DIB_32BPP_GetPixel(SURFOBJ*,LONG,LONG);
121 VOID DIB_32BPP_HLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
122 VOID DIB_32BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
123 BOOLEAN DIB_32BPP_BitBlt(PBLTINFO);
124 BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO);
125 BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
126 BOOLEAN DIB_32BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
127 BOOLEAN DIB_32BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
128
129 BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,ROP4);
130 BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ*, BRUSHOBJ*, RECTL*, POINTL*, ULONG, UINT);
131 BOOLEAN DIB_XXBPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
132
133 extern unsigned char notmask[2];
134 extern unsigned char altnotmask[2];
135 #define MASK1BPP(x) (1<<(7-((x)&7)))
136
137 ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern);
138
139 #define DIB_GetSource(SourceSurf,sx,sy,ColorTranslation) \
140 XLATEOBJ_iXlate(ColorTranslation, \
141 DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
142 DIB_GetPixel(SourceSurf, sx, sy))
143
144 #define DIB_GetSourceIndex(SourceSurf,sx,sy) \
145 DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
146 DIB_GetPixel(SourceSurf, sx, sy)