2015-07-09 09:48:01 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL
|
2015-09-09 13:13:35 +00:00
|
|
|
* FILE: base/applications/mspaint/selectionmodel.h
|
2015-07-09 09:48:01 +00:00
|
|
|
* PURPOSE: Keep track of selection parameters, notify listeners
|
|
|
|
* PROGRAMMERS: Benedikt Freisen
|
2019-12-25 06:46:29 +00:00
|
|
|
* Katayama Hirofumi MZ
|
2015-07-09 09:48:01 +00:00
|
|
|
*/
|
|
|
|
|
2017-12-09 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-07-09 09:48:01 +00:00
|
|
|
class SelectionModel
|
|
|
|
{
|
|
|
|
private:
|
2023-04-01 13:01:04 +00:00
|
|
|
HBITMAP m_hbmColor;
|
|
|
|
HBITMAP m_hbmMask;
|
2015-07-09 09:48:01 +00:00
|
|
|
POINT *m_ptStack;
|
|
|
|
int m_iPtSP;
|
|
|
|
|
|
|
|
public:
|
2023-04-01 13:01:04 +00:00
|
|
|
BOOL m_bShow;
|
|
|
|
CRect m_rc; // in image pixel coordinates
|
|
|
|
POINT m_ptHit; // in image pixel coordinates
|
|
|
|
|
2015-07-09 09:48:01 +00:00
|
|
|
SelectionModel();
|
2019-12-25 06:46:29 +00:00
|
|
|
~SelectionModel();
|
2023-04-01 13:01:04 +00:00
|
|
|
|
2015-07-09 09:48:01 +00:00
|
|
|
void ResetPtStack();
|
2023-04-01 13:01:04 +00:00
|
|
|
void PushToPtStack(POINT pt);
|
|
|
|
int PtStackSize() const;
|
|
|
|
void SetRectFromPoints(const POINT& ptFrom, const POINT& ptTo);
|
|
|
|
void BuildMaskFromPtStack();
|
|
|
|
|
|
|
|
BOOL TakeOff();
|
|
|
|
void Landing();
|
|
|
|
|
2023-04-09 00:14:32 +00:00
|
|
|
HBITMAP GetBitmap();
|
2023-04-01 13:01:04 +00:00
|
|
|
void GetSelectionContents(HDC hDCImage);
|
|
|
|
void DrawFramePoly(HDC hDCImage);
|
2015-07-09 09:48:01 +00:00
|
|
|
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
|
|
|
|
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg);
|
2023-04-01 13:01:04 +00:00
|
|
|
void DrawSelection(HDC hDCImage, LPCRECT prc, COLORREF crBg = 0, BOOL bBgTransparent = FALSE);
|
2022-02-14 03:08:34 +00:00
|
|
|
void InsertFromHBITMAP(HBITMAP hBm, INT x = 0, INT y = 0);
|
2023-04-01 13:01:04 +00:00
|
|
|
|
|
|
|
// operation
|
2015-07-09 09:48:01 +00:00
|
|
|
void FlipHorizontally();
|
|
|
|
void FlipVertically();
|
|
|
|
void RotateNTimes90Degrees(int iN);
|
2023-04-01 13:01:04 +00:00
|
|
|
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY);
|
|
|
|
|
|
|
|
void CancelSelection();
|
|
|
|
void Dragging(CANVAS_HITTEST hit, POINT pt);
|
|
|
|
void ClearMask();
|
|
|
|
void ClearColor();
|
2019-12-25 06:46:29 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SelectionModel(const SelectionModel&);
|
|
|
|
SelectionModel& operator=(const SelectionModel&);
|
2023-04-01 13:01:04 +00:00
|
|
|
|
|
|
|
void ShiftPtStack(BOOL bPlus);
|
2015-07-09 09:48:01 +00:00
|
|
|
};
|