Fixed palette handling for true/high-color X11.
[wine/multimedia.git] / graphics / bitblt.c
blob01af36766ed336ec03f9bb2b4f0d45f5be65e713
1 /*
2 * GDI bit-blit operations
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #include "dc.h"
8 #include "debugtools.h"
10 DECLARE_DEBUG_CHANNEL(bitblt)
11 DECLARE_DEBUG_CHANNEL(bitmap)
12 DECLARE_DEBUG_CHANNEL(gdi)
15 /***********************************************************************
16 * PatBlt16 (GDI.29)
18 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
19 INT16 width, INT16 height, DWORD rop)
21 DC * dc = DC_GetDCPtr( hdc );
22 if (!dc || !dc->funcs->pPatBlt) return FALSE;
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 );
30 /***********************************************************************
31 * PatBlt32 (GDI32.260)
33 BOOL WINAPI PatBlt( HDC hdc, INT left, INT top,
34 INT width, INT height, DWORD rop)
36 DC * dc = DC_GetDCPtr( hdc );
37 if (!dc || !dc->funcs->pPatBlt) return FALSE;
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 );
45 /***********************************************************************
46 * BitBlt16 (GDI.34)
48 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
49 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
50 DWORD rop )
52 DC *dcDst, *dcSrc;
54 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
55 if (!dcDst->funcs->pBitBlt) return FALSE;
56 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
66 /***********************************************************************
67 * BitBlt32 (GDI32.10)
69 BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
70 INT height, HDC hdcSrc, INT xSrc, INT ySrc,
71 DWORD rop )
73 DC *dcDst, *dcSrc;
75 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
76 if (!dcDst->funcs->pBitBlt) return FALSE;
77 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
87 /***********************************************************************
88 * StretchBlt16 (GDI.35)
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 )
95 DC *dcDst, *dcSrc;
97 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
98 if (!dcDst->funcs->pStretchBlt) return FALSE;
99 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
111 /***********************************************************************
112 * StretchBlt32 (GDI32.350)
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 )
119 DC *dcDst, *dcSrc;
121 if (!(dcDst = DC_GetDCPtr( hdcDst ))) return FALSE;
122 if (!dcDst->funcs->pStretchBlt) return FALSE;
123 dcSrc = DC_GetDCPtr( hdcSrc );
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 );
135 /***********************************************************************
136 * FastWindowFrame (GDI.400)
138 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
139 INT16 width, INT16 height, DWORD rop )
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,
147 rect->right - rect->left - width, -height, rop );
148 PatBlt( hdc, rect->right, rect->top, -width,
149 rect->bottom - rect->top - height, rop );
150 SelectObject( hdc, hbrush );
151 return TRUE;
153 /***********************************************************************
154 * MaskBlt32 [GDI32.252]
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)
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;
167 /*********************************************************************
168 * PlgBlt [GDI.267]
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)
175 FIXME_(gdi)("PlgBlt, stub\n");
176 return 1;