patch by Jonathon Wilson
[reactos.git] / reactos / 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 W32kBitBlt(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 W32kCreateBitmap(Width, Height, Planes, BitsPerPel, Bits);
42 }
43
44
45 /*
46 * @implemented
47 */
48 HBITMAP
49 STDCALL
50 CreateBitmapIndirect(CONST BITMAP *BM)
51 {
52 return W32kCreateBitmapIndirect(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 W32kCreateCompatibleBitmap(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 W32kCreateDiscardableBitmap(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 W32kCreateDIBitmap(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 W32kGetBitmapBits(hBitmap, Count, Bits);
108 }
109
110
111 /*
112 * @implemented
113 */
114 BOOL
115 STDCALL
116 GetBitmapDimensionEx(HBITMAP hBitmap,
117 LPSIZE Dimension)
118 {
119 return W32kGetBitmapDimensionEx(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 W32kGetDIBits(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 W32kMaskBlt(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 W32kPlgBlt(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 W32kSetBitmapBits(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 W32kSetDIBits(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 W32kSetDIBitsToDevice(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 W32kStretchDIBits(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 W32kCreateDIBSection(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 W32kSetPixel(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(W32kPatBlt(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 int i;
345 PATRECT r;
346 HBRUSH hBrOld;
347 for (i = 0;i<cRects;i++)
348 {
349 hBrOld = SelectObject(hDC,r.hBrush);
350 r = *pRects;
351 PatBlt(hDC,r.r.top,r.r.left,r.r.bottom-r.r.top,r.r.right-r.r.left,dwRop);
352 pRects+=sizeof(PATRECT);
353 SelectObject(hDC,hBrOld);
354 }
355 return TRUE;
356 }
357
358
359
360
361 /*
362
363 BOOL STDCALL W32kExtFloodFill(HDC hDC, INT XStart, INT YStart, COLORREF Color, UINT FillType)
364 BOOL STDCALL W32kFloodFill(HDC hDC, INT XStart, INT YStart, COLORREF Fill)
365 UINT STDCALL W32kGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors)
366 COLORREF STDCALL W32kGetPixel(HDC hDC,
367 INT XPos,
368 INT YPos)
369 BOOL STDCALL W32kSetBitmapDimensionEx(HBITMAP hBitmap,
370 INT Width,
371 INT Height,
372 LPSIZE Size)
373 UINT STDCALL W32kSetDIBColorTable(HDC hDC,
374 UINT StartIndex,
375 UINT Entries,
376 CONST RGBQUAD *Colors)
377 BOOL STDCALL W32kSetPixelV(HDC hDC,
378 INT X,
379 INT Y,
380 COLORREF Color)
381 BOOL STDCALL W32kStretchBlt(HDC hDCDest,
382 INT XOriginDest,
383 INT YOriginDest,
384 INT WidthDest,
385 INT HeightDest,
386 HDC hDCSrc,
387 INT XOriginSrc,
388 INT YOriginSrc,
389 INT WidthSrc,
390 INT HeightSrc,
391 DWORD ROP)
392
393 INT BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp)
394 HBITMAP BITMAPOBJ_CopyBitmap(HBITMAP hBitmap)
395 int DIB_GetDIBWidthBytes(int width, int depth)
396 int DIB_GetDIBImageBytes (int width, int height, int depth)
397 int DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse)
398
399 */