ReactOS 0.4.15-dev-7942-gd23573b
bltrop.c File Reference
#include <windows.h>
#include <tchar.h>
Include dependency graph for bltrop.c:

Go to the source code of this file.

Functions

static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static ATOM MyRegisterClass (HINSTANCE hInstance)
 
static BOOL InitInstance (HINSTANCE hInstance, int nCmdShow)
 
int WINAPI _tWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
 

Variables

HINSTANCE hInst
 
TCHAR szWindowClass [] = _T("testclass")
 

Function Documentation

◆ _tWinMain()

int WINAPI _tWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPTSTR  lpCmdLine,
int  nCmdShow 
)

Definition at line 200 of file bltrop.c.

204{
205 MSG msg;
206
208
209 if (!InitInstance(hInstance, nCmdShow))
210 {
211 return FALSE;
212 }
213
214 while (GetMessage(&msg, NULL, 0, 0))
215 {
218 }
219
220 return (int)msg.wParam;
221}
#define msg(x)
Definition: auth_time.c:54
static ATOM MyRegisterClass(HINSTANCE hInstance)
Definition: bltrop.c:145
static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
Definition: bltrop.c:168
HINSTANCE hInstance
Definition: charmap.c:19
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define GetMessage
Definition: winuser.h:5790
#define DispatchMessage
Definition: winuser.h:5765

◆ InitInstance()

static BOOL InitInstance ( HINSTANCE  hInstance,
int  nCmdShow 
)
static

Definition at line 168 of file bltrop.c.

169{
170 HWND hWnd;
171
173
176 _T("BitBlt raster operation test"),
180 840,
181 440,
182 NULL,
183 NULL,
184 hInstance,
185 NULL);
186
187 if (!hWnd)
188 {
189 return FALSE;
190 }
191
192 ShowWindow(hWnd, nCmdShow);
194
195 return TRUE;
196}
HWND hWnd
Definition: settings.c:17
TCHAR szWindowClass[]
Definition: bltrop.c:12
HINSTANCE hInst
Definition: bltrop.c:11
#define TRUE
Definition: types.h:120
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define _T(x)
Definition: vfdio.h:22
#define CreateWindowEx
Definition: winuser.h:5755
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UpdateWindow(_In_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by _tWinMain().

◆ MyRegisterClass()

static ATOM MyRegisterClass ( HINSTANCE  hInstance)
static

Definition at line 145 of file bltrop.c.

146{
147 WNDCLASSEX wcex;
148
149 wcex.cbSize = sizeof(WNDCLASSEX);
150
151 wcex.style = CS_HREDRAW | CS_VREDRAW;
152 wcex.lpfnWndProc = WndProc;
153 wcex.cbClsExtra = 0;
154 wcex.cbWndExtra = 0;
155 wcex.hInstance = hInstance;
156 wcex.hIcon = NULL;
158 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
159 wcex.lpszMenuName = NULL;
161 wcex.hIconSm = NULL;
162
163 return RegisterClassEx(&wcex);
164}
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: bltrop.c:15
int cbClsExtra
Definition: winuser.h:3204
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
LPCSTR lpszMenuName
Definition: winuser.h:3210
HICON hIconSm
Definition: winuser.h:3212
UINT style
Definition: winuser.h:3202
int cbWndExtra
Definition: winuser.h:3205
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3207
HBRUSH hbrBackground
Definition: winuser.h:3209
#define CS_VREDRAW
Definition: winuser.h:658
#define COLOR_WINDOW
Definition: winuser.h:918
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define RegisterClassEx
Definition: winuser.h:5837
#define LoadCursor
Definition: winuser.h:5812
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5719

Referenced by _tWinMain().

◆ WndProc()

static LRESULT CALLBACK WndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 15 of file bltrop.c.

16{
17 static HBITMAP hBmpTest;
18
19 switch (message)
20 {
21 case WM_CREATE:
22 {
24 break;
25 }
26
27 case WM_PAINT:
28 {
29 PAINTSTRUCT ps;
30 HDC hdc, hdcMem;
32 HBRUSH brush, brush2;
33 INT l;
34
35 hdc = BeginPaint(hWnd, &ps);
37
38 GetObject(hBmpTest, sizeof(BITMAP), &bitmap);
39
40 /* fill destination with brush */
41 brush = CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,0));
42 SelectObject(hdc, brush);
43 PatBlt(hdc, 30, 0, 4*bitmap.bmWidth*2, 4*bitmap.bmHeight, PATCOPY);
44
45 /* hatched brushes */
46 l = 66;
47 brush = CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,0));
48 SelectObject(hdc, brush);
49 PatBlt(hdc, 0, 0, 30, l, PATCOPY);
50 DeleteObject(brush);
51
52 brush = CreateHatchBrush(HS_CROSS, RGB(255,0,0));
53 SelectObject(hdc, brush);
54 PatBlt(hdc, 0, 1*l, 30, l, PATCOPY);
55 DeleteObject(brush);
56
57 brush = CreateHatchBrush(HS_FDIAGONAL, RGB(255,0,0));
58 SelectObject(hdc, brush);
59 PatBlt(hdc, 0, 2*l, 30, l, PATCOPY);
60 DeleteObject(brush);
61
62 brush = CreateHatchBrush(HS_BDIAGONAL, RGB(255,0,0));
63 SelectObject(hdc, brush);
64 PatBlt(hdc, 0, 3*l, 30, l, PATCOPY);
65 DeleteObject(brush);
66
67 brush = CreateHatchBrush(HS_VERTICAL, RGB(255,0,0));
68 SelectObject(hdc, brush);
69 PatBlt(hdc, 0, 4*l, 30, l, PATCOPY);
70 DeleteObject(brush);
71
72 brush = CreateHatchBrush(HS_HORIZONTAL, RGB(255,0,0));
73 SelectObject(hdc, brush);
74 PatBlt(hdc, 0, 5*l, 30, l, PATCOPY);
75 DeleteObject(brush);
76
77 /* set up a second brush */
78 brush2 = CreateHatchBrush(HS_VERTICAL, RGB(127,127,127));
79
80 /* first select brush, then set bk color */
81 SelectObject(hdc, brush2);
82 SetBkColor(hdc, RGB(0, 255, 0));
83
84 /* 15 blt op's with bitblt */
85 SelectObject(hdcMem, hBmpTest);
86 /* offset coordinates */
87 SetWindowOrgEx(hdc, -10, -10, NULL);
88 BitBlt(hdc, 30, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
89 BitBlt(hdc, 130, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, DSTINVERT);
90 BitBlt(hdc, 230, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, MERGECOPY);
91 BitBlt(hdc, 330, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, MERGEPAINT);
92
93 BitBlt(hdc, 30, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, NOTSRCCOPY);
94 BitBlt(hdc, 130, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, NOTSRCERASE);
95 BitBlt(hdc, 230, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, PATCOPY);
96 BitBlt(hdc, 330, 100, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, PATINVERT);
97
98 BitBlt(hdc, 30, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, PATPAINT);
99 BitBlt(hdc, 130, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCAND);
100 BitBlt(hdc, 230, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCERASE);
101 BitBlt(hdc, 330, 200, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCINVERT);
102
103 BitBlt(hdc, 30, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, BLACKNESS);
104 BitBlt(hdc, 130, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCPAINT);
105 BitBlt(hdc, 230, 300, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, WHITENESS);
106
107 /* 15 blt op's with stretchblt */
108 StretchBlt(hdc, 30+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
109 StretchBlt(hdc, 130+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, DSTINVERT);
110 StretchBlt(hdc, 230+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, MERGECOPY);
111 StretchBlt(hdc, 330+400, 0, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, MERGEPAINT);
112
113 StretchBlt(hdc, 30+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, NOTSRCCOPY);
114 StretchBlt(hdc, 130+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, NOTSRCERASE);
115 StretchBlt(hdc, 230+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, PATCOPY);
116 StretchBlt(hdc, 330+400, 100, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, PATINVERT);
117
118 StretchBlt(hdc, 30+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, PATPAINT);
119 StretchBlt(hdc, 130+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCAND);
120 StretchBlt(hdc, 230+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCERASE);
121 StretchBlt(hdc, 330+400, 200, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCINVERT);
122
123 StretchBlt(hdc, 30+400, 300, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, BLACKNESS);
124 StretchBlt(hdc, 130+400, 300, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCPAINT);
125 StretchBlt(hdc, 230+400, 300, bitmap.bmWidth/2, bitmap.bmHeight/2, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, WHITENESS);
126
127 DeleteObject(brush);
128 DeleteObject(brush2);
130 EndPaint(hWnd, &ps);
131 break;
132 }
133
134 case WM_DESTROY:
136 break;
137 default:
139 }
140 return 0;
141}
r l[0]
Definition: byte_order.h:168
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
#define DefWindowProc
Definition: ros2win.h:31
Definition: bl.h:1331
Definition: uimain.c:89
Definition: tftpd.h:60
int32_t INT
Definition: typedefs.h:58
HDC hdcMem
Definition: welcome.c:104
#define BLACKNESS
Definition: wingdi.h:323
#define PATPAINT
Definition: wingdi.h:336
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define PATINVERT
Definition: wingdi.h:328
#define HS_DIAGCROSS
Definition: wingdi.h:578
#define WHITENESS
Definition: wingdi.h:337
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
HBRUSH WINAPI CreateHatchBrush(_In_ int, _In_ COLORREF)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCERASE
Definition: wingdi.h:326
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define HS_CROSS
Definition: wingdi.h:577
#define SRCINVERT
Definition: wingdi.h:329
#define SRCCOPY
Definition: wingdi.h:333
#define PATCOPY
Definition: wingdi.h:335
#define DSTINVERT
Definition: wingdi.h:327
#define HS_VERTICAL
Definition: wingdi.h:581
#define SRCPAINT
Definition: wingdi.h:334
#define HS_FDIAGONAL
Definition: wingdi.h:579
#define MERGEPAINT
Definition: wingdi.h:331
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define MERGECOPY
Definition: wingdi.h:332
#define NOTSRCCOPY
Definition: wingdi.h:325
#define HS_BDIAGONAL
Definition: wingdi.h:576
#define HS_HORIZONTAL
Definition: wingdi.h:580
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define NOTSRCERASE
Definition: wingdi.h:324
#define SRCAND
Definition: wingdi.h:330
#define WM_PAINT
Definition: winuser.h:1620
#define IMAGE_BITMAP
Definition: winuser.h:211
#define WM_CREATE
Definition: winuser.h:1608
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LoadImage
Definition: winuser.h:5815
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define WM_DESTROY
Definition: winuser.h:1609
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by MyRegisterClass().

Variable Documentation

◆ hInst

HINSTANCE hInst

Definition at line 11 of file bltrop.c.

Referenced by InitInstance(), and WndProc().

◆ szWindowClass

TCHAR szWindowClass[] = _T("testclass")

Definition at line 12 of file bltrop.c.

Referenced by InitInstance(), and MyRegisterClass().