ReactOS  0.4.15-dev-1367-g07cc0b5
selection.cpp File Reference
#include "precomp.h"
Include dependency graph for selection.cpp:

Go to the source code of this file.

Functions

BOOL ColorKeyedMaskBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, HBITMAP hbmMask, int xMask, int yMask, DWORD dwRop, COLORREF keyColor)
 
void ForceRefreshSelectionContents ()
 

Function Documentation

◆ ColorKeyedMaskBlt()

BOOL ColorKeyedMaskBlt ( HDC  hdcDest,
int  nXDest,
int  nYDest,
int  nWidth,
int  nHeight,
HDC  hdcSrc,
int  nXSrc,
int  nYSrc,
HBITMAP  hbmMask,
int  xMask,
int  yMask,
DWORD  dwRop,
COLORREF  keyColor 
)

Definition at line 25 of file selection.cpp.

26 {
27  HDC hTempDC;
28  HDC hTempDC2;
29  HBITMAP hTempBm;
30  HBRUSH hTempBrush;
31  HBITMAP hTempMask;
32 
33  hTempDC = CreateCompatibleDC(hdcSrc);
34  hTempDC2 = CreateCompatibleDC(hdcSrc);
35  hTempBm = CreateCompatibleBitmap(hTempDC, nWidth, nHeight);
36  SelectObject(hTempDC, hTempBm);
37  hTempBrush = CreateSolidBrush(keyColor);
38  SelectObject(hTempDC, hTempBrush);
39  BitBlt(hTempDC, 0, 0, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, SRCCOPY);
40  PatBlt(hTempDC, 0, 0, nWidth, nHeight, PATINVERT);
41  hTempMask = CreateBitmap(nWidth, nHeight, 1, 1, NULL);
42  SelectObject(hTempDC2, hTempMask);
43  BitBlt(hTempDC2, 0, 0, nWidth, nHeight, hTempDC, 0, 0, SRCCOPY);
44  SelectObject(hTempDC, hbmMask);
45  BitBlt(hTempDC2, 0, 0, nWidth, nHeight, hTempDC, xMask, yMask, SRCAND);
46  MaskBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, hTempMask, xMask, yMask, dwRop);
47  DeleteDC(hTempDC);
48  DeleteDC(hTempDC2);
49  DeleteObject(hTempBm);
50  DeleteObject(hTempBrush);
51  DeleteObject(hTempMask);
52  return TRUE;
53 }
#define PATINVERT
Definition: wingdi.h:327
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static HDC hdcSrc
Definition: xlate.c:32
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
BOOL WINAPI DeleteDC(_In_ HDC)
#define SRCAND
Definition: wingdi.h:329
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI MaskBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ HDC, _In_ int, _In_ int, _In_ HBITMAP, _In_ int, _In_ int, _In_ DWORD)
static HBITMAP
Definition: button.c:44
#define SRCCOPY
Definition: wingdi.h:332
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
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by SelectionModel::DrawSelection().

◆ ForceRefreshSelectionContents()

void ForceRefreshSelectionContents ( )

Definition at line 56 of file selection.cpp.

57 {
58  if (selectionWindow.IsWindowVisible())
59  {
60  selectionWindow.SendMessage(WM_LBUTTONDOWN, 0, MAKELPARAM(0, 0));
61  selectionWindow.SendMessage(WM_MOUSEMOVE, 0, MAKELPARAM(0, 0));
62  selectionWindow.SendMessage(WM_LBUTTONUP, 0, MAKELPARAM(0, 0));
63  }
64 }
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MOUSEMOVE
Definition: winuser.h:1757
CSelectionWindow selectionWindow
Definition: main.cpp:71

Referenced by endPaintingL(), CMainWindow::InsertSelectionFromHBITMAP(), CTextEditWindow::OnCommand(), CSelectionWindow::OnPaletteModelColorChanged(), CSelectionWindow::OnSelectionModelRefreshNeeded(), and CSelectionWindow::OnToolsModelSettingsChanged().