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
23 #include "wine/winuser16.h"
25 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(wing
);
32 typedef enum WING_DITHER_TYPE
34 WING_DISPERSED_4x4
, WING_DISPERSED_8x8
, WING_CLUSTERED_4x4
38 * WinG DIB bitmaps can be selected into DC and then scribbled upon
39 * by GDI functions. They can also be changed directly. This gives us
41 * - use original WinG 16-bit DLL
42 * requires working 16-bit driver interface
43 * - implement DIB graphics driver from scratch
45 * - use shared pixmaps
46 * won't work with some videocards and/or videomodes
50 /***********************************************************************
51 * WinGCreateDC (WING.1001)
53 HDC16 WINAPI
WinGCreateDC16(void)
56 return CreateCompatibleDC16(0);
59 /***********************************************************************
60 * WinGRecommendDIBFormat (WING.1002)
62 BOOL16 WINAPI
WinGRecommendDIBFormat16(BITMAPINFO
*bmpi
)
65 TRACE("(%p)\n", bmpi
);
69 hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
70 bmpi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
71 bmpi
->bmiHeader
.biWidth
= 320;
72 bmpi
->bmiHeader
.biHeight
= -1;
73 bmpi
->bmiHeader
.biPlanes
= 1;
74 bmpi
->bmiHeader
.biBitCount
= 8;
75 bmpi
->bmiHeader
.biCompression
= BI_RGB
;
76 bmpi
->bmiHeader
.biSizeImage
= 0;
77 bmpi
->bmiHeader
.biXPelsPerMeter
= 0;
78 bmpi
->bmiHeader
.biYPelsPerMeter
= 0;
79 bmpi
->bmiHeader
.biClrUsed
= 0;
80 bmpi
->bmiHeader
.biClrImportant
= 0;
85 /***********************************************************************
86 * WinGCreateBitmap (WING.1003)
88 HBITMAP16 WINAPI
WinGCreateBitmap16(HDC16 hdc
, BITMAPINFO
*bmpi
,
91 TRACE("(%d,%p,%p)\n", hdc
, bmpi
, bits
);
92 TRACE(": create %ldx%ldx%d bitmap\n", bmpi
->bmiHeader
.biWidth
,
93 bmpi
->bmiHeader
.biHeight
, bmpi
->bmiHeader
.biPlanes
);
94 return CreateDIBSection16(hdc
, bmpi
, 0, bits
, 0, 0);
97 /***********************************************************************
98 * WinGGetDIBPointer (WING.1004)
100 SEGPTR WINAPI
WinGGetDIBPointer16(HBITMAP16 hWinGBitmap
, BITMAPINFO
* bmpi
)
102 BITMAPOBJ
* bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( hWinGBitmap
, BITMAP_MAGIC
);
105 TRACE("(%d,%p)\n", hWinGBitmap
, bmpi
);
108 if (bmpi
) FIXME(": Todo - implement setting BITMAPINFO\n");
110 res
= bmp
->segptr_bits
;
111 GDI_ReleaseObj( hWinGBitmap
);
115 /***********************************************************************
116 * WinGSetDIBColorTable (WING.1006)
118 UINT16 WINAPI
WinGSetDIBColorTable16(HDC16 hdc
, UINT16 start
, UINT16 num
,
121 TRACE("(%d,%d,%d,%p)\n", hdc
, start
, num
, colors
);
122 return SetDIBColorTable16(hdc
, start
, num
, colors
);
125 /***********************************************************************
126 * WinGGetDIBColorTable (WING.1005)
128 UINT16 WINAPI
WinGGetDIBColorTable16(HDC16 hdc
, UINT16 start
, UINT16 num
,
131 TRACE("(%d,%d,%d,%p)\n", hdc
, start
, num
, colors
);
132 return GetDIBColorTable16(hdc
, start
, num
, colors
);
135 /***********************************************************************
136 * WinGCreateHalfTonePalette (WING.1007)
138 HPALETTE16 WINAPI
WinGCreateHalfTonePalette16(void)
140 HDC hdc
= CreateCompatibleDC(0);
141 HPALETTE16 ret
= CreateHalftonePalette16(hdc
);
147 /***********************************************************************
148 * WinGCreateHalfToneBrush (WING.1008)
150 HBRUSH16 WINAPI
WinGCreateHalfToneBrush16(HDC16 winDC
, COLORREF col
,
151 WING_DITHER_TYPE type
)
153 TRACE("(%d,%ld,%d)\n", winDC
, col
, type
);
154 return CreateSolidBrush16(col
);
157 /***********************************************************************
158 * WinGStretchBlt (WING.1009)
160 BOOL16 WINAPI
WinGStretchBlt16(HDC16 destDC
, INT16 xDest
, INT16 yDest
,
161 INT16 widDest
, INT16 heiDest
,
162 HDC16 srcDC
, INT16 xSrc
, INT16 ySrc
,
163 INT16 widSrc
, INT16 heiSrc
)
166 TRACE("(%d,%d,...)\n", destDC
, srcDC
);
167 SetStretchBltMode16 ( destDC
, COLORONCOLOR
);
168 retval
=StretchBlt16(destDC
, xDest
, yDest
, widDest
, heiDest
, srcDC
,
169 xSrc
, ySrc
, widSrc
, heiSrc
, SRCCOPY
);
170 SetStretchBltMode16 ( destDC
, BLACKONWHITE
);
174 /***********************************************************************
175 * WinGBitBlt (WING.1010)
177 BOOL16 WINAPI
WinGBitBlt16(HDC16 destDC
, INT16 xDest
, INT16 yDest
,
178 INT16 widDest
, INT16 heiDest
, HDC16 srcDC
,
179 INT16 xSrc
, INT16 ySrc
)
181 TRACE("(%d,%d,...)\n", destDC
, srcDC
);
182 return BitBlt16(destDC
, xDest
, yDest
, widDest
, heiDest
, srcDC
,
183 xSrc
, ySrc
, SRCCOPY
);