ReactOS  0.4.15-dev-2153-g62b4c61
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 DispatchMessage
Definition: winuser.h:5740
BOOL WINAPI TranslateMessage(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
static ATOM MyRegisterClass(HINSTANCE hInstance)
Definition: bltrop.c:145
static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
Definition: bltrop.c:168
#define NULL
Definition: types.h:112
#define GetMessage
Definition: winuser.h:5765
#define msg(x)
Definition: auth_time.c:54

◆ InitInstance()

static BOOL InitInstance ( HINSTANCE  hInstance,
int  nCmdShow 
)
static

Definition at line 168 of file bltrop.c.

169 {
170  HWND hWnd;
171 
172  hInst = hInstance;
173 
174  hWnd = CreateWindowEx(0,
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 }
#define TRUE
Definition: types.h:120
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
HINSTANCE hInst
Definition: bltrop.c:11
#define CreateWindowEx
Definition: winuser.h:5730
#define CW_USEDEFAULT
Definition: winuser.h:225
TCHAR szWindowClass[]
Definition: bltrop.c:12
#define _T(x)
Definition: vfdio.h:22
#define NULL
Definition: types.h:112
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637

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;
157  wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
158  wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
159  wcex.lpszMenuName = NULL;
161  wcex.hIconSm = NULL;
162 
163  return RegisterClassEx(&wcex);
164 }
UINT style
Definition: winuser.h:3177
LPCSTR lpszMenuName
Definition: winuser.h:3185
#define RegisterClassEx
Definition: winuser.h:5812
HCURSOR hCursor
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3178
LPCSTR lpszClassName
Definition: winuser.h:3186
#define CS_HREDRAW
Definition: winuser.h:648
HICON hIconSm
Definition: winuser.h:3187
#define COLOR_WINDOW
Definition: winuser.h:908
HINSTANCE hInstance
Definition: charmap.c:20
HINSTANCE hInstance
Definition: winuser.h:3181
UINT cbSize
Definition: winuser.h:3176
TCHAR szWindowClass[]
Definition: bltrop.c:12
HBRUSH hbrBackground
Definition: winuser.h:3184
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3180
HICON hIcon
Definition: winuser.h:3182
#define LoadCursor
Definition: winuser.h:5787
int cbClsExtra
Definition: winuser.h:3179
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: bltrop.c:15

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;
31  BITMAP bitmap;
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);
129  DeleteDC(hdcMem);
130  EndPaint(hWnd, &ps);
131  break;
132  }
133 
134  case WM_DESTROY:
135  PostQuitMessage(0);
136  break;
137  default:
139  }
140  return 0;
141 }
#define SRCPAINT
Definition: wingdi.h:333
#define MAKEINTRESOURCE
Definition: winuser.h:591
Definition: tftpd.h:59
#define PATINVERT
Definition: wingdi.h:327
HBRUSH WINAPI CreateHatchBrush(_In_ int, _In_ COLORREF)
#define RGB(r, g, b)
Definition: precomp.h:62
#define NOTSRCERASE
Definition: wingdi.h:323
#define HS_HORIZONTAL
Definition: wingdi.h:579
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int32_t INT
Definition: typedefs.h:58
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)
WPARAM wParam
Definition: combotst.c:138
#define MERGECOPY
Definition: wingdi.h:331
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:977
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
HINSTANCE hInst
Definition: bltrop.c:11
#define NOTSRCCOPY
Definition: wingdi.h:324
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define DSTINVERT
Definition: wingdi.h:326
r l[0]
Definition: byte_order.h:167
Definition: uimain.c:88
#define GetObject
Definition: wingdi.h:4467
#define WM_PAINT
Definition: winuser.h:1602
#define HS_BDIAGONAL
Definition: wingdi.h:575
HDC hdc
Definition: main.c:9
#define WHITENESS
Definition: wingdi.h:336
#define PATCOPY
Definition: wingdi.h:334
#define SRCERASE
Definition: wingdi.h:325
#define BLACKNESS
Definition: wingdi.h:322
BOOL WINAPI DeleteDC(_In_ HDC)
#define HS_FDIAGONAL
Definition: wingdi.h:578
Definition: bl.h:1331
#define HS_CROSS
Definition: wingdi.h:576
#define HS_DIAGCROSS
Definition: wingdi.h:577
#define SRCAND
Definition: wingdi.h:329
#define NULL
Definition: types.h:112
#define IMAGE_BITMAP
Definition: winuser.h:211
#define MERGEPAINT
Definition: wingdi.h:330
#define HS_VERTICAL
Definition: wingdi.h:580
#define WM_CREATE
Definition: winuser.h:1590
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
#define LoadImage
Definition: winuser.h:5790
static HBITMAP bitmap
Definition: clipboard.c:1344
static HBITMAP
Definition: button.c:44
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
#define SRCINVERT
Definition: wingdi.h:328
static VOID NTAPI 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:49
#define PATPAINT
Definition: wingdi.h:335

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().