~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/gdi32/wing.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * WinG support
  3  *
  4  * Copyright (C) Robert Pouliot <krynos@clic.net>
  5  *
  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.
 10  *
 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.
 15  *
 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include "config.h"
 22 
 23 #include <stdarg.h>
 24 
 25 #include "windef.h"
 26 #include "winbase.h"
 27 #include "wingdi.h"
 28 #include "wownt32.h"
 29 #include "gdi_private.h"
 30 #include "wine/wingdi16.h"
 31 #include "wine/debug.h"
 32 
 33 WINE_DEFAULT_DEBUG_CHANNEL(wing);
 34 
 35 /*************************************************************************
 36  * WING {WING}
 37  *
 38  * The Windows Game dll provides a number of functions designed to allow
 39  * programmers to bypass Gdi and write directly to video memory. The intention
 40  * was to bolster the use of Windows as a gaming platform and remove the
 41  * need for Dos based games using 32 bit Dos extenders.
 42  *
 43  * This initial approach could not compete with the performance of Dos games
 44  * (such as Doom and Warcraft) at the time, and so this dll was eventually
 45  * superseded by DirectX. It should not be used by new applications, and is
 46  * provided only for compatibility with older Windows programs.
 47  */
 48 
 49 typedef enum WING_DITHER_TYPE
 50 {
 51   WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4
 52 } WING_DITHER_TYPE;
 53 
 54 /*
 55  * WinG DIB bitmaps can be selected into DC and then scribbled upon
 56  * by GDI functions. They can also be changed directly. This gives us
 57  * three choices
 58  *      - use original WinG 16-bit DLL
 59  *              requires working 16-bit driver interface
 60  *      - implement DIB graphics driver from scratch
 61  *              see wing.zip size
 62  *      - use shared pixmaps
 63  *              won't work with some videocards and/or videomodes
 64  * 961208 - AK
 65  */
 66 
 67 /***********************************************************************
 68  *          WinGCreateDC        (WING.1001)
 69  *
 70  * Create a new WinG device context.
 71  *
 72  * PARAMS
 73  *  None.
 74  *
 75  * RETURNS
 76  *  Success: A handle to the created device context.
 77  *  Failure: A NULL handle.
 78  */
 79 HDC16 WINAPI WinGCreateDC16(void)
 80 {
 81     TRACE("(void)\n");
 82         return CreateCompatibleDC16(0);
 83 }
 84 
 85 /***********************************************************************
 86  *  WinGRecommendDIBFormat    (WING.1002)
 87  *
 88  * Get the recommended format of bitmaps for the current display.
 89  *
 90  * PARAMS
 91  *  bmpi [O] Destination for format information
 92  *
 93  * RETURNS
 94  *  Success: TRUE. bmpi is filled with the best (fastest) bitmap format
 95  *  Failure: FALSE, if bmpi is NULL.
 96  */
 97 BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi)
 98 {
 99     TRACE("(%p)\n", bmpi);
100 
101     if (!bmpi)
102         return FALSE;
103 
104     bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
105     bmpi->bmiHeader.biWidth = 320;
106     bmpi->bmiHeader.biHeight = -1;
107     bmpi->bmiHeader.biPlanes = 1;
108     bmpi->bmiHeader.biBitCount = 8;
109     bmpi->bmiHeader.biCompression = BI_RGB;
110     bmpi->bmiHeader.biSizeImage = 0;
111     bmpi->bmiHeader.biXPelsPerMeter = 0;
112     bmpi->bmiHeader.biYPelsPerMeter = 0;
113     bmpi->bmiHeader.biClrUsed = 0;
114     bmpi->bmiHeader.biClrImportant = 0;
115 
116     return TRUE;
117 }
118 
119 /***********************************************************************
120  *        WinGCreateBitmap    (WING.1003)
121  *
122  * Create a new WinG bitmap.
123  *
124  * PARAMS
125  *  hdc  [I] WinG device context
126  *  bmpi [I] Information about the bitmap
127  *  bits [I] Location of the bitmap image data
128  *
129  * RETURNS
130  *  Success: A handle to the created bitmap.
131  *  Failure: A NULL handle.
132  */
133 HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
134                                     SEGPTR *bits)
135 {
136     TRACE("(%d,%p,%p)\n", hdc, bmpi, bits);
137     TRACE(": create %dx%dx%d bitmap\n", bmpi->bmiHeader.biWidth,
138           bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes);
139     return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0);
140 }
141 
142 /***********************************************************************
143  *  WinGGetDIBPointer   (WING.1004)
144  */
145 SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
146 {
147     BITMAPOBJ* bmp = GDI_GetObjPtr( HBITMAP_32(hWinGBitmap), OBJ_BITMAP );
148     SEGPTR res = 0;
149 
150     TRACE("(%d,%p)\n", hWinGBitmap, bmpi);
151     if (!bmp) return 0;
152 
153     if (bmpi) FIXME(": Todo - implement setting BITMAPINFO\n");
154 
155     res = bmp->segptr_bits;
156     GDI_ReleaseObj( HBITMAP_32(hWinGBitmap) );
157     return res;
158 }
159 
160 /***********************************************************************
161  *  WinGSetDIBColorTable   (WING.1006)
162  *
163  * Set all or part of the color table for a WinG device context.
164  *
165  * PARAMS
166  *  hdc    [I] WinG device context
167  *  start  [I] Start color
168  *  num    [I] Number of entries to set
169  *  colors [I] Array of color data
170  *
171  * RETURNS
172  *  The number of entries set.
173  */
174 UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num,
175                                      RGBQUAD *colors)
176 {
177     TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors);
178     return SetDIBColorTable16(hdc, start, num, colors);
179 }
180 
181 /***********************************************************************
182  *  WinGGetDIBColorTable   (WING.1005)
183  *
184  * Get all or part of the color table for a WinG device context.
185  *
186  * PARAMS
187  *  hdc    [I] WinG device context
188  *  start  [I] Start color
189  *  num    [I] Number of entries to set
190  *  colors [O] Destination for the array of color data
191  *
192  * RETURNS
193  *  The number of entries retrieved.
194  */
195 UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num,
196                                      RGBQUAD *colors)
197 {
198     TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors);
199     return GetDIBColorTable16(hdc, start, num, colors);
200 }
201 
202 /***********************************************************************
203  *  WinGCreateHalfTonePalette   (WING.1007)
204  *
205  * Create a half tone palette.
206  *
207  * PARAMS
208  *  None.
209  *
210  * RETURNS
211  *  Success: A handle to the created palette.
212  *  Failure: A NULL handle.
213  */
214 HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void)
215 {
216     HDC16 hdc = CreateCompatibleDC16(0);
217     HPALETTE16 ret = CreateHalftonePalette16(hdc);
218     TRACE("(void)\n");
219     DeleteDC16(hdc);
220     return ret;
221 }
222 
223 /***********************************************************************
224  *  WinGCreateHalfToneBrush   (WING.1008)
225  *
226  * Create a half tone brush for a WinG device context.
227  *
228  * PARAMS
229  *  winDC [I] WinG device context
230  *  col   [I] Color
231  *  type  [I] Desired dithering type.
232  *
233  * RETURNS
234  *  Success: A handle to the created brush.
235  *  Failure: A NULL handle.
236  */
237 HBRUSH16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col,
238                                             WING_DITHER_TYPE type)
239 {
240     TRACE("(%d,%d,%d)\n", winDC, col, type);
241     return CreateSolidBrush16(col);
242 }
243 
244 /***********************************************************************
245  *  WinGStretchBlt   (WING.1009)
246  *
247  * See StretchBlt16.
248  */
249 BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
250                                INT16 widDest, INT16 heiDest,
251                                HDC16 srcDC, INT16 xSrc, INT16 ySrc,
252                                INT16 widSrc, INT16 heiSrc)
253 {
254     BOOL16 retval;
255     TRACE("(%d,%d,...)\n", destDC, srcDC);
256     SetStretchBltMode16 ( destDC, COLORONCOLOR );
257     retval=StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC,
258                         xSrc, ySrc, widSrc, heiSrc, SRCCOPY);
259     SetStretchBltMode16 ( destDC, BLACKONWHITE );
260     return retval;
261 }
262 
263 /***********************************************************************
264  *  WinGBitBlt   (WING.1010)
265  *
266  * See BitBlt16.
267  */
268 BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
269                            INT16 widDest, INT16 heiDest, HDC16 srcDC,
270                            INT16 xSrc, INT16 ySrc)
271 {
272     TRACE("(%d,%d,...)\n", destDC, srcDC);
273     return BitBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC,
274                     xSrc, ySrc, SRCCOPY);
275 }
276 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.