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