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