Added 'blt' and 'bltfast' override functions.
[wine/wine64.git] / dlls / gdi / wing.c
blob7a5a88e83ca20165ccbbc1ccda4be32891ae7376
1 /*
2 * WinG support
4 * Copyright (C) Robert Pouliot <krynos@clic.net>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include "wine/winuser16.h"
24 #include "bitmap.h"
25 #include "wine/debug.h"
26 #include "palette.h"
27 #include "windef.h"
28 #include "wownt32.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wing);
33 typedef enum WING_DITHER_TYPE
35 WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4
36 } WING_DITHER_TYPE;
39 * WinG DIB bitmaps can be selected into DC and then scribbled upon
40 * by GDI functions. They can also be changed directly. This gives us
41 * three choices
42 * - use original WinG 16-bit DLL
43 * requires working 16-bit driver interface
44 * - implement DIB graphics driver from scratch
45 * see wing.zip size
46 * - use shared pixmaps
47 * won't work with some videocards and/or videomodes
48 * 961208 - AK
51 /***********************************************************************
52 * WinGCreateDC (WING.1001)
54 HDC16 WINAPI WinGCreateDC16(void)
56 TRACE("(void)\n");
57 return CreateCompatibleDC16(0);
60 /***********************************************************************
61 * WinGRecommendDIBFormat (WING.1002)
63 BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi)
65 HDC hdc;
66 TRACE("(%p)\n", bmpi);
67 if (!bmpi)
68 return FALSE;
70 hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
71 bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
72 bmpi->bmiHeader.biWidth = 320;
73 bmpi->bmiHeader.biHeight = -1;
74 bmpi->bmiHeader.biPlanes = 1;
75 bmpi->bmiHeader.biBitCount = 8;
76 bmpi->bmiHeader.biCompression = BI_RGB;
77 bmpi->bmiHeader.biSizeImage = 0;
78 bmpi->bmiHeader.biXPelsPerMeter = 0;
79 bmpi->bmiHeader.biYPelsPerMeter = 0;
80 bmpi->bmiHeader.biClrUsed = 0;
81 bmpi->bmiHeader.biClrImportant = 0;
82 DeleteDC(hdc);
83 return TRUE;
86 /***********************************************************************
87 * WinGCreateBitmap (WING.1003)
89 HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
90 SEGPTR *bits)
92 TRACE("(%d,%p,%p)\n", hdc, bmpi, bits);
93 TRACE(": create %ldx%ldx%d bitmap\n", bmpi->bmiHeader.biWidth,
94 bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes);
95 return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0);
98 /***********************************************************************
99 * WinGGetDIBPointer (WING.1004)
101 SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
103 BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( HBITMAP_32(hWinGBitmap),
104 BITMAP_MAGIC );
105 SEGPTR res = 0;
107 TRACE("(%d,%p)\n", hWinGBitmap, bmpi);
108 if (!bmp) return 0;
110 if (bmpi) FIXME(": Todo - implement setting BITMAPINFO\n");
112 res = bmp->segptr_bits;
113 GDI_ReleaseObj( HBITMAP_32(hWinGBitmap) );
114 return res;
117 /***********************************************************************
118 * WinGSetDIBColorTable (WING.1006)
120 UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num,
121 RGBQUAD *colors)
123 TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors);
124 return SetDIBColorTable16(hdc, start, num, colors);
127 /***********************************************************************
128 * WinGGetDIBColorTable (WING.1005)
130 UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num,
131 RGBQUAD *colors)
133 TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors);
134 return GetDIBColorTable16(hdc, start, num, colors);
137 /***********************************************************************
138 * WinGCreateHalfTonePalette (WING.1007)
140 HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void)
142 HDC16 hdc = CreateCompatibleDC16(0);
143 HPALETTE16 ret = CreateHalftonePalette16(hdc);
144 TRACE("(void)\n");
145 DeleteDC16(hdc);
146 return ret;
149 /***********************************************************************
150 * WinGCreateHalfToneBrush (WING.1008)
152 HBRUSH16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col,
153 WING_DITHER_TYPE type)
155 TRACE("(%d,%ld,%d)\n", winDC, col, type);
156 return CreateSolidBrush16(col);
159 /***********************************************************************
160 * WinGStretchBlt (WING.1009)
162 BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
163 INT16 widDest, INT16 heiDest,
164 HDC16 srcDC, INT16 xSrc, INT16 ySrc,
165 INT16 widSrc, INT16 heiSrc)
167 BOOL16 retval;
168 TRACE("(%d,%d,...)\n", destDC, srcDC);
169 SetStretchBltMode16 ( destDC, COLORONCOLOR );
170 retval=StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC,
171 xSrc, ySrc, widSrc, heiSrc, SRCCOPY);
172 SetStretchBltMode16 ( destDC, BLACKONWHITE );
173 return retval;
176 /***********************************************************************
177 * WinGBitBlt (WING.1010)
179 BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
180 INT16 widDest, INT16 heiDest, HDC16 srcDC,
181 INT16 xSrc, INT16 ySrc)
183 TRACE("(%d,%d,...)\n", destDC, srcDC);
184 return BitBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC,
185 xSrc, ySrc, SRCCOPY);