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
26 #include "wine/winuser16.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(wing
);
31 /*************************************************************************
34 * The Windows Game dll provides a number of functions designed to allow
35 * programmers to bypass Gdi and write directly to video memory. The intention
36 * was to bolster the use of Windows as a gaming platform and remove the
37 * need for Dos based games using 32 bit Dos extenders.
39 * This initial approach could not compete with the performance of Dos games
40 * (such as Doom and Warcraft) at the time, and so this dll was eventually
41 * superseded by DirectX. It should not be used by new applications, and is
42 * provided only for compatibility with older Windows programs.
45 typedef enum WING_DITHER_TYPE
47 WING_DISPERSED_4x4
, WING_DISPERSED_8x8
, WING_CLUSTERED_4x4
51 * WinG DIB bitmaps can be selected into DC and then scribbled upon
52 * by GDI functions. They can also be changed directly. This gives us
54 * - use original WinG 16-bit DLL
55 * requires working 16-bit driver interface
56 * - implement DIB graphics driver from scratch
58 * - use shared pixmaps
59 * won't work with some videocards and/or videomodes
63 /***********************************************************************
64 * WinGCreateDC (WING.1001)
66 * Create a new WinG device context.
72 * Success: A handle to the created device context.
73 * Failure: A NULL handle.
75 HDC16 WINAPI
WinGCreateDC16(void)
78 return CreateCompatibleDC16(0);
81 /***********************************************************************
82 * WinGRecommendDIBFormat (WING.1002)
84 * Get the recommended format of bitmaps for the current display.
87 * bmpi [O] Destination for format information
90 * Success: TRUE. bmpi is filled with the best (fastest) bitmap format
91 * Failure: FALSE, if bmpi is NULL.
93 BOOL16 WINAPI
WinGRecommendDIBFormat16(BITMAPINFO
*bmpi
)
96 TRACE("(%p)\n", bmpi
);
100 hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
101 bmpi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
102 bmpi
->bmiHeader
.biWidth
= 320;
103 bmpi
->bmiHeader
.biHeight
= -1;
104 bmpi
->bmiHeader
.biPlanes
= 1;
105 bmpi
->bmiHeader
.biBitCount
= 8;
106 bmpi
->bmiHeader
.biCompression
= BI_RGB
;
107 bmpi
->bmiHeader
.biSizeImage
= 0;
108 bmpi
->bmiHeader
.biXPelsPerMeter
= 0;
109 bmpi
->bmiHeader
.biYPelsPerMeter
= 0;
110 bmpi
->bmiHeader
.biClrUsed
= 0;
111 bmpi
->bmiHeader
.biClrImportant
= 0;
116 /***********************************************************************
117 * WinGCreateBitmap (WING.1003)
119 * Create a new WinG bitmap.
122 * hdc [I] WinG device context
123 * bmpi [I] Information about the bitmap
124 * bits [I] Location of the bitmap image data
127 * Success: A handle to the created bitmap.
128 * Failure: A NULL handle.
130 HBITMAP16 WINAPI
WinGCreateBitmap16(HDC16 hdc
, BITMAPINFO
*bmpi
,
133 TRACE("(%d,%p,%p)\n", hdc
, bmpi
, bits
);
134 TRACE(": create %ldx%ldx%d bitmap\n", bmpi
->bmiHeader
.biWidth
,
135 bmpi
->bmiHeader
.biHeight
, bmpi
->bmiHeader
.biPlanes
);
136 return CreateDIBSection16(hdc
, bmpi
, 0, bits
, 0, 0);
139 /***********************************************************************
140 * WinGGetDIBPointer (WING.1004)
142 SEGPTR WINAPI
WinGGetDIBPointer16(HBITMAP16 hWinGBitmap
, BITMAPINFO
* bmpi
)
144 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( HBITMAP_32(hWinGBitmap
),
148 TRACE("(%d,%p)\n", hWinGBitmap
, bmpi
);
151 if (bmpi
) FIXME(": Todo - implement setting BITMAPINFO\n");
153 res
= bmp
->segptr_bits
;
154 GDI_ReleaseObj( HBITMAP_32(hWinGBitmap
) );
158 /***********************************************************************
159 * WinGSetDIBColorTable (WING.1006)
161 * Set all or part of the color table for a WinG device context.
164 * hdc [I] WinG device context
165 * start [I] Start color
166 * num [I] Number of entries to set
167 * colors [I] Array of color data
170 * The number of entries set.
172 UINT16 WINAPI
WinGSetDIBColorTable16(HDC16 hdc
, UINT16 start
, UINT16 num
,
175 TRACE("(%d,%d,%d,%p)\n", hdc
, start
, num
, colors
);
176 return SetDIBColorTable16(hdc
, start
, num
, colors
);
179 /***********************************************************************
180 * WinGGetDIBColorTable (WING.1005)
182 * Get all or part of the color table for a WinG device context.
185 * hdc [I] WinG device context
186 * start [I] Start color
187 * num [I] Number of entries to set
188 * colors [O] Destination for the array of color data
191 * The number of entries retrieved.
193 UINT16 WINAPI
WinGGetDIBColorTable16(HDC16 hdc
, UINT16 start
, UINT16 num
,
196 TRACE("(%d,%d,%d,%p)\n", hdc
, start
, num
, colors
);
197 return GetDIBColorTable16(hdc
, start
, num
, colors
);
200 /***********************************************************************
201 * WinGCreateHalfTonePalette (WING.1007)
203 * Create a half tone palette.
209 * Success: A handle to the created palette.
210 * Failure: A NULL handle.
212 HPALETTE16 WINAPI
WinGCreateHalfTonePalette16(void)
214 HDC16 hdc
= CreateCompatibleDC16(0);
215 HPALETTE16 ret
= CreateHalftonePalette16(hdc
);
221 /***********************************************************************
222 * WinGCreateHalfToneBrush (WING.1008)
224 * Create a half tone brush for a WinG device context.
227 * winDC [I] WinG device context
229 * type [I] Desired dithering type.
232 * Success: A handle to the created brush.
233 * Failure: A NULL handle.
235 HBRUSH16 WINAPI
WinGCreateHalfToneBrush16(HDC16 winDC
, COLORREF col
,
236 WING_DITHER_TYPE type
)
238 TRACE("(%d,%ld,%d)\n", winDC
, col
, type
);
239 return CreateSolidBrush16(col
);
242 /***********************************************************************
243 * WinGStretchBlt (WING.1009)
247 BOOL16 WINAPI
WinGStretchBlt16(HDC16 destDC
, INT16 xDest
, INT16 yDest
,
248 INT16 widDest
, INT16 heiDest
,
249 HDC16 srcDC
, INT16 xSrc
, INT16 ySrc
,
250 INT16 widSrc
, INT16 heiSrc
)
253 TRACE("(%d,%d,...)\n", destDC
, srcDC
);
254 SetStretchBltMode16 ( destDC
, COLORONCOLOR
);
255 retval
=StretchBlt16(destDC
, xDest
, yDest
, widDest
, heiDest
, srcDC
,
256 xSrc
, ySrc
, widSrc
, heiSrc
, SRCCOPY
);
257 SetStretchBltMode16 ( destDC
, BLACKONWHITE
);
261 /***********************************************************************
262 * WinGBitBlt (WING.1010)
266 BOOL16 WINAPI
WinGBitBlt16(HDC16 destDC
, INT16 xDest
, INT16 yDest
,
267 INT16 widDest
, INT16 heiDest
, HDC16 srcDC
,
268 INT16 xSrc
, INT16 ySrc
)
270 TRACE("(%d,%d,...)\n", destDC
, srcDC
);
271 return BitBlt16(destDC
, xDest
, yDest
, widDest
, heiDest
, srcDC
,
272 xSrc
, ySrc
, SRCCOPY
);