Added Finnish keyboard layout.
[wine/hacks.git] / graphics / wing.c
blob2eac6066e8adda6908a9e86167aa90d9ec09f4d2
1 /*
2 * WinG support
4 * Started by Robert Pouliot <krynos@clic.net>
5 */
7 #include "config.h"
9 #include "ts_xlib.h"
10 #ifdef HAVE_LIBXXSHM
11 #include <sys/types.h>
12 #include <sys/ipc.h>
13 #ifndef __EMX__
14 #include <sys/shm.h>
15 #endif /* !defined(__EMX__) */
16 #include "ts_xshm.h"
17 #endif /* defined(HAVE_LIBXXSHM) */
18 #include "x11drv.h"
20 #include "wine/winuser16.h"
21 #include "bitmap.h"
22 #include "palette.h"
23 #include "dc.h"
24 #include "debug.h"
25 #include "gdi.h"
26 #include "heap.h"
27 #include "selectors.h"
28 #include "monitor.h"
29 #include "windef.h"
30 #include "xmalloc.h"
32 typedef enum WING_DITHER_TYPE
34 WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4
35 } WING_DITHER_TYPE;
37 /*
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
40 * three choices
41 * - use original WinG 16-bit DLL
42 * requires working 16-bit driver interface
43 * - implement DIB graphics driver from scratch
44 * see wing.zip size
45 * - use shared pixmaps
46 * won't work with some videocards and/or videomodes
47 * 961208 - AK
50 /***********************************************************************
51 * WinGCreateDC16 (WING.1001)
53 HDC16 WINAPI WinGCreateDC16(void)
55 TRACE(wing, "(void)\n");
56 return CreateCompatibleDC16(0);
59 /***********************************************************************
60 * WinGRecommendDIBFormat16 (WING.1002)
62 BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi)
64 TRACE(wing, "(%p)\n", bmpi);
65 if (!bmpi)
66 return FALSE;
68 bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
69 bmpi->bmiHeader.biWidth = 320;
70 bmpi->bmiHeader.biHeight = -1;
71 bmpi->bmiHeader.biPlanes = 1;
72 bmpi->bmiHeader.biBitCount = MONITOR_GetDepth(&MONITOR_PrimaryMonitor);
73 bmpi->bmiHeader.biCompression = BI_RGB;
74 bmpi->bmiHeader.biSizeImage = 0;
75 bmpi->bmiHeader.biXPelsPerMeter = 0;
76 bmpi->bmiHeader.biYPelsPerMeter = 0;
77 bmpi->bmiHeader.biClrUsed = 0;
78 bmpi->bmiHeader.biClrImportant = 0;
80 return TRUE;
83 /***********************************************************************
84 * WinGCreateBitmap16 (WING.1003)
86 HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
87 SEGPTR *bits)
89 TRACE(wing, "(%d,%p,%p)\n", hdc, bmpi, bits);
90 TRACE(wing, ": create %ldx%ldx%d bitmap\n", bmpi->bmiHeader.biWidth,
91 bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes);
92 return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0);
95 /***********************************************************************
96 * WinGGetDIBPointer (WING.1004)
98 SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
100 BITMAPOBJ* bmp = (BITMAPOBJ *) GDI_GetObjPtr( hWinGBitmap, BITMAP_MAGIC );
102 TRACE(wing, "(%d,%p)\n", hWinGBitmap, bmpi);
103 if (!bmp) return (SEGPTR)NULL;
105 if (bmpi)
106 FIXME(wing, ": Todo - implement setting BITMAPINFO\n");
108 return PTR_SEG_OFF_TO_SEGPTR(bmp->dib->selector, 0);
111 /***********************************************************************
112 * WinGSetDIBColorTable (WING.1004)
114 UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num,
115 RGBQUAD *colors)
117 TRACE(wing, "(%d,%d,%d,%p)\n", hdc, start, num, colors);
118 return SetDIBColorTable16(hdc, start, num, colors);
121 /***********************************************************************
122 * WinGGetDIBColorTable16 (WING.1005)
124 UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num,
125 RGBQUAD *colors)
127 TRACE(wing, "(%d,%d,%d,%p)\n", hdc, start, num, colors);
128 return GetDIBColorTable16(hdc, start, num, colors);
131 /***********************************************************************
132 * WinGCreateHalfTonePalette16 (WING.1007)
134 HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void)
136 TRACE(wing, "(void)\n");
137 return CreateHalftonePalette16(GetDC16(0));
140 /***********************************************************************
141 * WinGCreateHalfToneBrush16 (WING.1008)
143 HBRUSH16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col,
144 WING_DITHER_TYPE type)
146 TRACE(wing, "(%d,%ld,%d)\n", winDC, col, type);
147 return CreateSolidBrush16(col);
150 /***********************************************************************
151 * WinGStretchBlt16 (WING.1009)
153 BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
154 INT16 widDest, INT16 heiDest,
155 HDC16 srcDC, INT16 xSrc, INT16 ySrc,
156 INT16 widSrc, INT16 heiSrc)
158 TRACE(wing, "(%d,%d,...)\n", destDC, srcDC);
159 return StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC,
160 xSrc, ySrc, widSrc, heiSrc, SRCCOPY);
163 /***********************************************************************
164 * WinGBitBlt16 (WING.1010)
166 BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
167 INT16 widDest, INT16 heiDest, HDC16 srcDC,
168 INT16 xSrc, INT16 ySrc)
170 TRACE(wing, "(%d,%d,...)\n", destDC, srcDC);
171 return BitBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC,
172 xSrc, ySrc, SRCCOPY);