ReactOS 0.4.15-dev-8131-g4988de4
selectionmodel.h
Go to the documentation of this file.
1/*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4 * PURPOSE: Keep track of selection parameters, notify listeners
5 * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
6 * Copyright 2019-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7 */
8
9#pragma once
10
12{
13private:
16
17public:
21 CRect m_rc; // in image pixel coordinates
22 POINT m_ptHit; // in image pixel coordinates
23 CRect m_rcOld; // in image pixel coordinates
24
27
28 void SetRectFromPoints(const POINT& ptFrom, const POINT& ptTo);
29 void setMask(const CRect& rc, HBITMAP hbmMask);
30
31 BOOL TakeOff();
32 void Landing();
33 BOOL IsLanded() const;
34 void HideSelection();
35 void DeleteSelection();
36 HITTEST hitTest(POINT ptCanvas);
37 void drawFrameOnCanvas(HDC hCanvasDC);
38 void moveSelection(INT xDelta, INT yDelta);
39
41 void DrawBackground(HDC hDCImage, COLORREF crBg);
42 void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
43 void DrawBackgroundRect(HDC hDCImage, COLORREF crBg);
44
45 void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent, const CRect& rc, HBITMAP hbm);
46
47 void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent)
48 {
49 return DrawSelection(hDCImage, crBg, bBgTransparent, m_rc);
50 }
51
52 void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent, const CRect& rc)
53 {
54 return DrawSelection(hDCImage, crBg, bBgTransparent, rc, m_hbmColor);
55 }
56
57 void InsertFromHBITMAP(HBITMAP hbmColor, INT x = 0, INT y = 0, HBITMAP hbmMask = NULL);
58
59 // operation
60 void FlipHorizontally();
61 void FlipVertically();
62 void RotateNTimes90Degrees(int iN);
63 void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY);
64 void InvertSelection();
65
66 void Dragging(HITTEST hit, POINT pt);
67 void ClearMaskImage();
68 void ClearColorImage();
70
71 void StretchSelection(BOOL bShrink);
72
73private:
76
78 void SwapWidthAndHeight();
79};
HITTEST
Definition: precomp.h:55
HBITMAP m_hbmColor
void DrawBackground(HDC hDCImage, COLORREF crBg)
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg)
void RotateNTimes90Degrees(int iN)
void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent)
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY)
SelectionModel(const SelectionModel &)
HBITMAP GetSelectionContents()
void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent, const CRect &rc, HBITMAP hbm)
void ShiftPtStack(INT dx, INT dy)
void InsertFromHBITMAP(HBITMAP hbmColor, INT x=0, INT y=0, HBITMAP hbmMask=NULL)
COLORREF m_rgbBack
void NotifyContentChanged()
void moveSelection(INT xDelta, INT yDelta)
void drawFrameOnCanvas(HDC hCanvasDC)
SelectionModel & operator=(const SelectionModel &)
void Dragging(HITTEST hit, POINT pt)
void setMask(const CRect &rc, HBITMAP hbmMask)
void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent, const CRect &rc)
HITTEST hitTest(POINT ptCanvas)
BOOL IsLanded() const
void SetRectFromPoints(const POINT &ptFrom, const POINT &ptTo)
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg)
void StretchSelection(BOOL bShrink)
#define NULL
Definition: types.h:112
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
int32_t INT
Definition: typedefs.h:58
DWORD COLORREF
Definition: windef.h:300