ReactOS 0.4.16-dev-141-g4c84e19
bitblt.c File Reference
#include <windows.h>
#include <string.h>
Include dependency graph for bitblt.c:

Go to the source code of this file.

Functions

LRESULT CALLBACK MainWndProc (HWND HWnd, UINT Msg, WPARAM WParam, LPARAM LParam)
 
int APIENTRY WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
 

Variables

HINSTANCE HInst
 
const charWndClassName = "GMainWnd"
 
BITMAP bmp
 
LPCSTR filename = TEXT("lena.bmp")
 
HDC HMemDC = NULL
 
HBITMAP HOldBmp = NULL
 

Function Documentation

◆ MainWndProc()

LRESULT CALLBACK MainWndProc ( HWND  HWnd,
UINT  Msg,
WPARAM  WParam,
LPARAM  LParam 
)

Definition at line 73 of file bitblt.c.

75{
76 switch (Msg)
77 {
78 case WM_CREATE:
79 {
80 /* create a memory DC */
82 if (HMemDC)
83 {
84 /* load a bitmap from file */
86 /* static_cast<HBITMAP> */(
88 0, 0, 0)
89 );
90 if (HBmp)
91 {
92 /* extract dimensions of the bitmap */
93 GetObject(HBmp, sizeof(BITMAP), &bmp);
94
95 /* associate the bitmap with the memory DC */
96 /* HOldBmp = static_cast<HBITMAP> */
98 );
99 }
100 }
101 }
102 case WM_PAINT:
103 {
104 PAINTSTRUCT ps;
105 const HDC Hdc = BeginPaint(HWnd, &ps);
106#if 0
107 try
108#endif
109 {
110
111 /* TODO: add palette support (see Chapter 9)... */
112
113
114 BitBlt(Hdc, 20, 15,
115 bmp.bmWidth, bmp.bmHeight,
116 HMemDC, 0, 0,
117 SRCCOPY);
118 }
119#if 0
120 catch (...)
121#endif
122 {
123 EndPaint(HWnd, &ps);
124 }
125 EndPaint(HWnd, &ps);
126 break;
127 }
128 case WM_DESTROY:
129 {
130 /* clean up */
133
135 return 0;
136 }
137 }
138 return DefWindowProc(HWnd, Msg, WParam, LParam);
139}
struct @1636 Msg[]
#define NULL
Definition: types.h:112
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
pKey DeleteObject()
BITMAP bmp
Definition: bitblt.c:68
HDC HMemDC
Definition: bitblt.c:70
HINSTANCE HInst
Definition: bitblt.c:17
HBITMAP HOldBmp
Definition: bitblt.c:71
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
#define DefWindowProc
Definition: ros2win.h:31
Definition: bl.h:1331
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define WM_PAINT
Definition: winuser.h:1623
#define IMAGE_BITMAP
Definition: winuser.h:211
#define WM_CREATE
Definition: winuser.h:1611
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LoadImage
Definition: winuser.h:5827
#define WM_DESTROY
Definition: winuser.h:1612
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
HBITMAP HBmp

Referenced by WinMain().

◆ WinMain()

int APIENTRY WinMain ( HINSTANCE  HInstance,
HINSTANCE  HPrevInstance,
LPTSTR  lpCmdLine,
int  nCmdShow 
)

Definition at line 23 of file bitblt.c.

25{
26 WNDCLASS wc;
27 MSG msg;
28
29 HInst = HInstance;
30
31 memset(&wc, 0, sizeof(WNDCLASS));
32
35 wc.hInstance = HInstance;
37 /* wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1); */
38 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
40
41 if (RegisterClass(&wc))
42 {
43 HWND HWnd =
45 WndClassName, TEXT("BitBlt Bitmap Rendering Demo"),
48 0, 0, 220, 230,
50 );
51
52 if (HWnd)
53 {
54 ShowWindow(HWnd, nCmdShow);
55 UpdateWindow(HWnd);
56
57 while (GetMessage(&msg, NULL, 0, 0))
58 {
61 }
62 }
63 }
64 return 0;
65}
#define msg(x)
Definition: auth_time.c:54
#define TEXT(s)
Definition: k32.h:26
const char * WndClassName
Definition: bitblt.c:18
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, LPARAM LParam)
Definition: bitblt.c:73
#define WS_CAPTION
Definition: pedump.c:624
#define WS_OVERLAPPED
Definition: pedump.c:615
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define memset(x, y, z)
Definition: compat.h:39
HBRUSH hbrBackground
Definition: winuser.h:3173
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
UINT style
Definition: winuser.h:3166
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
#define CreateWindow
Definition: winuser.h:5766
#define GetMessage
Definition: winuser.h:5802
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5824
#define RegisterClass
Definition: winuser.h:5848
#define DispatchMessage
Definition: winuser.h:5777
#define COLOR_BTNFACE
Definition: winuser.h:931
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Variable Documentation

◆ bmp

BITMAP bmp

Definition at line 68 of file bitblt.c.

Referenced by MainWndProc().

◆ filename

LPCSTR filename = TEXT("lena.bmp")

Definition at line 69 of file bitblt.c.

◆ HInst

HINSTANCE HInst

Definition at line 17 of file bitblt.c.

Referenced by MainWndProc(), and WinMain().

◆ HMemDC

HDC HMemDC = NULL

Definition at line 70 of file bitblt.c.

Referenced by MainWndProc().

◆ HOldBmp

HBITMAP HOldBmp = NULL

Definition at line 71 of file bitblt.c.

Referenced by MainWndProc().

◆ WndClassName

const char* WndClassName = "GMainWnd"

Definition at line 18 of file bitblt.c.

Referenced by WinMain().