mirrored from git://source.winehq.org/git/wine.git
/
wing32.c
143 lines (125 loc) · 4.33 KB
/
wing32.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* WinG support
*
* Copyright 2007 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
/***********************************************************************
* WinGCreateDC (WING32.@)
*/
HDC WINAPI WinGCreateDC( void )
{
return CreateCompatibleDC( 0 );
}
/***********************************************************************
* WinGRecommendDIBFormat (WING32.@)
*/
BOOL WINAPI WinGRecommendDIBFormat( BITMAPINFO *bmi )
{
if (!bmi) return FALSE;
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = 320;
bmi->bmiHeader.biHeight = 1;
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = 8;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = 0;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;
return TRUE;
}
/***********************************************************************
* WinGCreateBitmap (WING32.@)
*/
HBITMAP WINAPI WinGCreateBitmap( HDC hdc, BITMAPINFO *bmi, void **bits )
{
return CreateDIBSection( hdc, bmi, DIB_RGB_COLORS, bits, 0, 0 );
}
/***********************************************************************
* WinGGetDIBPointer (WING32.@)
*/
void * WINAPI WinGGetDIBPointer( HBITMAP hbmp, BITMAPINFO *bmi )
{
DIBSECTION ds;
if (GetObjectW( hbmp, sizeof(ds), &ds ) == sizeof(ds))
{
if (bmi) bmi->bmiHeader = ds.dsBmih;
return ds.dsBm.bmBits;
}
return NULL;
}
/***********************************************************************
* WinGSetDIBColorTable (WING32.@)
*/
UINT WINAPI WinGSetDIBColorTable( HDC hdc, UINT start, UINT end, RGBQUAD *colors )
{
return SetDIBColorTable( hdc, start, end, colors );
}
/***********************************************************************
* WinGGetDIBColorTable (WING32.@)
*/
UINT WINAPI WinGGetDIBColorTable( HDC hdc, UINT start, UINT end, RGBQUAD *colors )
{
return GetDIBColorTable( hdc, start, end, colors );
}
/***********************************************************************
* WinGCreateHalftonePalette (WING32.@)
*/
HPALETTE WINAPI WinGCreateHalftonePalette( void )
{
HDC hdc;
HPALETTE hpal;
hdc = GetDC( 0 );
hpal = CreateHalftonePalette( hdc );
ReleaseDC( 0, hdc );
return hpal;
}
/***********************************************************************
* WinGCreateHalftoneBrush (WING32.@)
*/
HBRUSH WINAPI WinGCreateHalftoneBrush( HDC hdc, COLORREF color, INT type )
{
return CreateSolidBrush( color );
}
/***********************************************************************
* WinGStretchBlt (WING32.@)
*/
BOOL WINAPI WinGStretchBlt( HDC hdcDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
HDC hdcSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc )
{
INT old_blt_mode;
BOOL ret;
old_blt_mode = SetStretchBltMode( hdcDst, COLORONCOLOR );
ret = StretchBlt( hdcDst, xDst, yDst, widthDst, heightDst,
hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY );
SetStretchBltMode( hdcDst, old_blt_mode );
return ret;
}
/***********************************************************************
* WinGBitBlt (WING32.@)
*/
BOOL WINAPI WinGBitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
INT height, HDC hdcSrc, INT xSrc, INT ySrc )
{
return BitBlt( hdcDst, xDst, yDst, width, height, hdcSrc, xSrc, ySrc, SRCCOPY );
}