ReactOS  0.4.12-dev-102-g4b7f1e0
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.

Referenced by SelectionModel::DrawBackgroundRect(), and SelectionModel::DrawSelection().

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 HDC
Definition: msvc.h:22
#define TRUE
Definition: types.h:120
#define PATINVERT
Definition: wingdi.h:326
#define HBITMAP
Definition: msvc.h:28
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static HDC hdcSrc
Definition: xlate.c:32
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteDC(_In_ HDC)
#define SRCAND
Definition: wingdi.h:328
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)
#define SRCCOPY
Definition: wingdi.h:331
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

◆ ForceRefreshSelectionContents()

void ForceRefreshSelectionContents ( )

Definition at line 56 of file selection.cpp.

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

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:1752
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
#define WM_LBUTTONUP
Definition: winuser.h:1753
#define WM_MOUSEMOVE
Definition: winuser.h:1751
CSelectionWindow selectionWindow
Definition: main.cpp:70