Added/fixed some documentation reported by winapi_check.
[wine] / graphics / bitblt.c
1 /*
2  * GDI bit-blit operations
3  *
4  * Copyright 1993, 1994  Alexandre Julliard
5  */
6
7 #include "dc.h"
8 #include "debugtools.h"
9
10 DEFAULT_DEBUG_CHANNEL(bitblt)
11 DECLARE_DEBUG_CHANNEL(bitmap)
12 DECLARE_DEBUG_CHANNEL(gdi)
13
14
15 /***********************************************************************
16  *           PatBlt16    (GDI.29)
17  */
18 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
19                         INT16 width, INT16 height, DWORD rop)
20 {
21     DC * dc = DC_GetDCPtr( hdc );
22     if (!dc || !dc->funcs->pPatBlt) return FALSE;
23
24     TRACE("%04x %d,%d %dx%d %06lx\n", hdc, left, top, width, height, rop );
25     return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
26 }
27
28
29 /***********************************************************************
30  *           PatBlt    (GDI32.260)
31  */
32 BOOL WINAPI PatBlt( HDC hdc, INT left, INT top,
33                         INT width, INT height, DWORD rop)
34 {
35     DC * dc = DC_GetDCPtr( hdc );
36     if (!dc || !dc->funcs->pPatBlt) return FALSE;
37
38     TRACE("%04x %d,%d %dx%d %06lx\n", hdc, left, top, width, height, rop );
39     return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
40 }
41
42
43 /***********************************************************************
44  *           BitBlt16    (GDI.34)
45  */
46 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
47                         INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
48                         DWORD rop )
49 {
50     DC *dcDst, *dcSrc;
51
52     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
53     if (!dcDst->funcs->pBitBlt) return FALSE;
54     dcSrc = DC_GetDCPtr( hdcSrc );
55
56     TRACE("hdcSrc=%04x %d,%d %d bpp->hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
57           hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
58           hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
59     return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height,
60                                   dcSrc, xSrc, ySrc, rop );
61 }
62
63
64 /***********************************************************************
65  *           BitBlt    (GDI32.10)
66  */
67 BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
68                         INT height, HDC hdcSrc, INT xSrc, INT ySrc,
69                         DWORD rop )
70 {
71     DC *dcDst, *dcSrc;
72
73     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
74     if (!dcDst->funcs->pBitBlt) return FALSE;
75     dcSrc = DC_GetDCPtr( hdcSrc );
76
77     TRACE("hdcSrc=%04x %d,%d %d bpp->hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
78           hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
79           hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
80     return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height,
81                                   dcSrc, xSrc, ySrc, rop );
82 }
83
84
85 /***********************************************************************
86  *           StretchBlt16    (GDI.35)
87  */
88 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
89                             INT16 widthDst, INT16 heightDst,
90                             HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
91                             INT16 widthSrc, INT16 heightSrc, DWORD rop )
92 {
93     DC *dcDst, *dcSrc;
94
95     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
96     if (!dcDst->funcs->pStretchBlt) return FALSE;
97     dcSrc = DC_GetDCPtr( hdcSrc );
98
99     TRACE("%04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
100           hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
101           dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
102           widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
103     return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
104                                       dcSrc, xSrc, ySrc, widthSrc, heightSrc,
105                                       rop );
106 }
107
108
109 /***********************************************************************
110  *           StretchBlt    (GDI32.350)
111  */
112 BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst,
113                             INT widthDst, INT heightDst,
114                             HDC hdcSrc, INT xSrc, INT ySrc,
115                             INT widthSrc, INT heightSrc, DWORD rop )
116 {
117     DC *dcDst, *dcSrc;
118
119     if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
120     if (!dcDst->funcs->pStretchBlt) return FALSE;
121     dcSrc = DC_GetDCPtr( hdcSrc );
122
123     TRACE("%04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
124           hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
125           dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
126           widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
127     return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst,
128                                       dcSrc, xSrc, ySrc, widthSrc, heightSrc,
129                                       rop );
130 }
131
132
133 /***********************************************************************
134  *           FastWindowFrame    (GDI.400)
135  */
136 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
137                                INT16 width, INT16 height, DWORD rop )
138 {
139     HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
140     PatBlt( hdc, rect->left, rect->top,
141               rect->right - rect->left - width, height, rop );
142     PatBlt( hdc, rect->left, rect->top + height, width,
143               rect->bottom - rect->top - height, rop );
144     PatBlt( hdc, rect->left + width, rect->bottom - 1,
145               rect->right - rect->left - width, -height, rop );
146     PatBlt( hdc, rect->right - 1, rect->top, -width,
147               rect->bottom - rect->top - height, rop );
148     SelectObject( hdc, hbrush );
149     return TRUE;
150 }
151 /***********************************************************************
152  *           MaskBlt [GDI32.252]
153  */
154 BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest,
155                         INT nWidth, INT nHeight, HDC hdcSource,
156                         INT nXSrc, INT nYSrc, HBITMAP hbmMask,
157                         INT xMask, INT yMask, DWORD dwRop)
158 {
159     FIXME_(bitmap)("(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%ld): stub\n",
160              hdcDest,nXDest,nYDest,nWidth,nHeight,hdcSource,nXSrc,nYSrc,
161              hbmMask,xMask,yMask,dwRop);
162     return 1;
163 }
164   
165 /*********************************************************************
166  *      PlgBlt [GDI.267]
167  *
168  */
169 BOOL WINAPI PlgBlt( HDC hdcDest, const POINT *lpPoint,
170                         HDC hdcSrc, INT nXDest, INT nYDest, INT nWidth,
171                         INT nHeight, HBITMAP hbmMask, INT xMask, INT yMask)
172 {
173         FIXME_(gdi)("PlgBlt, stub\n");
174         return 1;
175 }
176