update for HEAD-2003091401
[reactos.git] / lib / gdi32 / objects / bitblt.c
1 #ifdef UNICODE
2 #undef UNICODE
3 #endif
4
5 #undef WIN32_LEAN_AND_MEAN
6 #include <windows.h>
7 #include <ddk/ntddk.h>
8 #include <win32k/kapi.h>
9 #include <debug.h>
10
11 /*
12  * @implemented
13  */
14 BOOL
15 STDCALL
16 BitBlt(HDC  hDCDest,
17         INT  XDest,
18         INT  YDest,
19         INT  Width,
20         INT  Height,
21         HDC  hDCSrc,
22         INT  XSrc,
23         INT  YSrc,
24         DWORD  ROP)
25 {
26         return NtGdiBitBlt(hDCDest, XDest, YDest, Width, Height, hDCSrc, XSrc, YSrc, ROP);
27 }
28
29
30 /*
31  * @implemented
32  */
33 HBITMAP
34 STDCALL
35 CreateBitmap(INT  Width,
36         INT  Height,
37         UINT  Planes,
38         UINT  BitsPerPel,
39         CONST VOID *Bits)
40 {
41         return NtGdiCreateBitmap(Width, Height, Planes, BitsPerPel, Bits);
42 }
43
44
45 /*
46  * @implemented
47  */
48 HBITMAP
49 STDCALL
50 CreateBitmapIndirect(CONST BITMAP  *BM)
51 {
52         return NtGdiCreateBitmapIndirect(BM);
53 }
54
55
56 /*
57  * @implemented
58  */
59 HBITMAP
60 STDCALL
61 CreateCompatibleBitmap(HDC hDC,
62         INT  Width,
63         INT  Height)
64 {
65         return NtGdiCreateCompatibleBitmap(hDC, Width, Height);
66 }
67
68
69 /*
70  * @implemented
71  */
72 HBITMAP
73 STDCALL
74 CreateDiscardableBitmap(HDC  hDC,
75         INT  Width,
76         INT  Height)
77 {
78         return NtGdiCreateDiscardableBitmap(hDC, Width, Height);
79 }
80
81
82 /*
83  * @implemented
84  */
85 HBITMAP
86 STDCALL
87 CreateDIBitmap(HDC  hDC,
88         CONST BITMAPINFOHEADER  *bmih,
89         DWORD  Init,
90         CONST VOID  *bInit,
91         CONST BITMAPINFO  *bmi,
92         UINT  Usage)
93 {
94         return NtGdiCreateDIBitmap(hDC, bmih, Init, bInit, bmi, Usage);
95 }
96
97
98 /*
99  * @implemented
100  */
101 LONG
102 STDCALL
103 GetBitmapBits(HBITMAP  hBitmap,
104         LONG  Count,
105         LPVOID  Bits)
106 {
107         return NtGdiGetBitmapBits(hBitmap, Count, Bits);
108 }
109
110
111 /*
112  * @implemented
113  */
114 BOOL
115 STDCALL
116 GetBitmapDimensionEx(HBITMAP  hBitmap,
117         LPSIZE  Dimension)
118 {
119         return NtGdiGetBitmapDimensionEx(hBitmap, Dimension);
120 }
121
122
123 /*
124  * @implemented
125  */
126 int
127 STDCALL
128 GetDIBits(HDC  hDC,
129         HBITMAP hBitmap,
130         UINT  StartScan,
131         UINT  ScanLines,
132         LPVOID  Bits,
133         LPBITMAPINFO   bi,
134         UINT  Usage)
135 {
136         return NtGdiGetDIBits(hDC, hBitmap, StartScan, ScanLines, Bits, bi, Usage);
137 }
138
139
140 /*
141  * @implemented
142  */
143 BOOL
144 STDCALL
145 MaskBlt(HDC  hDCDest,
146         INT  XDest,
147         INT  YDest,
148         INT  Width,
149         INT  Height,
150         HDC  hDCSrc,
151         INT  XSrc,
152         INT  YSrc,
153         HBITMAP  hMaskBitmap,
154         INT  xMask,
155         INT  yMask,
156         DWORD  ROP)
157 {
158         return NtGdiMaskBlt(hDCDest, XDest, YDest, Width, Height, hDCSrc, XSrc, YSrc, hMaskBitmap, xMask, yMask, ROP);
159 }
160
161
162 /*
163  * @implemented
164  */
165 BOOL
166 STDCALL
167 PlgBlt(HDC  hDCDest,
168         CONST POINT  *Point,
169         HDC  hDCSrc, 
170         INT  XSrc,  
171         INT  YSrc,  
172         INT  Width, 
173         INT  Height,
174         HBITMAP  hMaskBitmap,
175         INT  xMask,      
176         INT  yMask)
177 {
178         return NtGdiPlgBlt(hDCDest, Point, hDCSrc, XSrc, YSrc, Width, Height, hMaskBitmap, xMask, yMask);
179 }
180
181
182 /*
183  * @implemented
184  */
185 LONG
186 STDCALL
187 SetBitmapBits(HBITMAP  hBitmap,
188         DWORD  Bytes,
189         CONST VOID *Bits)
190 {
191         return NtGdiSetBitmapBits(hBitmap, Bytes, Bits);
192 }
193
194
195 /*
196  * @implemented
197  */
198 int
199 STDCALL
200 SetDIBits(HDC  hDC,
201         HBITMAP  hBitmap,
202         UINT  StartScan,
203         UINT  ScanLines,
204         CONST VOID  *Bits,
205         CONST BITMAPINFO  *bmi,
206         UINT  ColorUse)
207 {
208         return NtGdiSetDIBits(hDC, hBitmap, StartScan, ScanLines, Bits, bmi, ColorUse);
209 }
210
211
212 /*
213  * @implemented
214  */
215 int
216 STDCALL
217 SetDIBitsToDevice(HDC  hDC,
218         INT  XDest,
219         INT  YDest,
220         DWORD  Width,
221         DWORD  Height,
222         INT  XSrc,
223         INT  YSrc,
224         UINT  StartScan,
225         UINT  ScanLines,
226         CONST VOID  *Bits,
227         CONST BITMAPINFO  *bmi,
228         UINT  ColorUse)
229 {
230         return NtGdiSetDIBitsToDevice(hDC, XDest, YDest, Width, Height, XSrc, YSrc, StartScan, ScanLines,
231                 Bits, bmi, ColorUse);
232 }
233
234
235 /*
236  * @implemented
237  */
238 BOOL
239 STDCALL
240 StretchBlt(
241            HDC hdcDest,      // handle to destination DC
242            int nXOriginDest, // x-coord of destination upper-left corner
243            int nYOriginDest, // y-coord of destination upper-left corner
244            int nWidthDest,   // width of destination rectangle
245            int nHeightDest,  // height of destination rectangle
246            HDC hdcSrc,       // handle to source DC
247            int nXOriginSrc,  // x-coord of source upper-left corner
248            int nYOriginSrc,  // y-coord of source upper-left corner
249            int nWidthSrc,    // width of source rectangle
250            int nHeightSrc,   // height of source rectangle
251            DWORD dwRop       // raster operation code
252         )
253 {
254         //SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
255         if ( (nWidthDest==nWidthSrc) && (nHeightDest==nHeightSrc) )
256         {
257                 return  BitBlt(hdcDest,
258                                 nXOriginDest,  // x-coord of destination upper-left corner
259                                 nYOriginDest,  // y-coord of destination upper-left corner
260                                 nWidthDest,  // width of destination rectangle
261                                 nHeightDest, // height of destination rectangle
262                                 hdcSrc,  // handle to source DC
263                                 nXOriginSrc,   // x-coordinate of source upper-left corner
264                                 nYOriginSrc,   // y-coordinate of source upper-left corner
265                                 dwRop  // raster operation code
266                                 );
267         }
268         
269         DPRINT1("FIXME: StretchBlt can only Blt, not Stretch!\n");
270         return FALSE;
271 }
272
273
274 /*
275  * @implemented
276  */
277 int
278 STDCALL
279 StretchDIBits(HDC  hDC,
280         INT  XDest,
281         INT  YDest,
282         INT  DestWidth,
283         INT  DestHeight,
284         INT  XSrc,
285         INT  YSrc,
286         INT  SrcWidth,
287         INT  SrcHeight,
288         CONST VOID  *Bits,
289         CONST BITMAPINFO  *BitsInfo,
290         UINT  Usage,
291         DWORD  ROP)
292 {
293         return NtGdiStretchDIBits(hDC, XDest, YDest, DestWidth, DestHeight, XSrc, YSrc,
294                 SrcWidth, SrcHeight, Bits, BitsInfo, Usage, ROP);
295 }
296
297
298 /*
299  * @implemented
300  */
301 HBITMAP 
302 STDCALL 
303 CreateDIBSection(HDC hDC,
304         CONST BITMAPINFO  *bmi,
305         UINT  Usage,
306         VOID  *Bits,
307         HANDLE  hSection,
308         DWORD  dwOffset)
309 {
310         return NtGdiCreateDIBSection(hDC, bmi, Usage, Bits, hSection, dwOffset);
311 }
312
313
314 /*
315  * @implemented
316  */
317 COLORREF 
318 STDCALL 
319 SetPixel(HDC  hDC,
320         INT  X,
321         INT  Y,
322         COLORREF  Color)
323 {
324         return NtGdiSetPixel(hDC, X, Y, Color);
325 }
326
327
328 /*
329  * @implemented
330  */
331 BOOL STDCALL
332 PatBlt(HDC hDC, INT Top, INT Left, INT Width, INT Height, ULONG Rop)
333 {
334   return(NtGdiPatBlt(hDC, Top, Left, Width, Height, Rop));
335 }
336
337 /*
338  * @implemented
339  */
340 WINBOOL 
341 STDCALL 
342 PolyPatBlt(HDC hDC,DWORD dwRop,PPATRECT pRects,int cRects,ULONG Reserved)
343 {
344         return NtGdiPolyPatBlt(hDC,dwRop,pRects,cRects,Reserved);
345 }
346
347
348 /*
349
350 BOOL STDCALL NtGdiExtFloodFill(HDC  hDC, INT  XStart, INT  YStart, COLORREF  Color, UINT  FillType)
351 BOOL STDCALL NtGdiFloodFill(HDC  hDC, INT  XStart, INT  YStart, COLORREF  Fill)
352 UINT STDCALL NtGdiGetDIBColorTable(HDC  hDC, UINT  StartIndex, UINT  Entries, RGBQUAD  *Colors)
353 COLORREF STDCALL NtGdiGetPixel(HDC  hDC,
354                        INT  XPos,
355                        INT  YPos)
356 BOOL STDCALL NtGdiSetBitmapDimensionEx(HBITMAP  hBitmap,
357                                INT  Width,
358                                INT  Height,
359                                LPSIZE  Size)
360 UINT STDCALL NtGdiSetDIBColorTable(HDC  hDC,
361                            UINT  StartIndex,
362                            UINT  Entries,
363                            CONST RGBQUAD  *Colors)
364 BOOL STDCALL NtGdiSetPixelV(HDC  hDC,
365                     INT  X,
366                     INT  Y,
367                     COLORREF  Color)
368 BOOL STDCALL NtGdiStretchBlt(HDC  hDCDest,
369                      INT  XOriginDest,
370                      INT  YOriginDest,
371                      INT  WidthDest,
372                      INT  HeightDest,
373                      HDC  hDCSrc,
374                      INT  XOriginSrc,
375                      INT  YOriginSrc,
376                      INT  WidthSrc,    
377                      INT  HeightSrc, 
378                      DWORD  ROP)
379
380 INT BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp)
381 HBITMAP  BITMAPOBJ_CopyBitmap(HBITMAP  hBitmap)
382 int DIB_GetDIBWidthBytes(int  width, int  depth)
383 int DIB_GetDIBImageBytes (int  width, int  height, int  depth)
384 int DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse)
385
386 */