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-06-17 12:15:35 +00:00
|
|
|
COLORREF m_rgbBack = RGB(255, 255, 255);
|
2023-04-01 13:01:04 +00:00
|
|
|
BOOL m_bShow;
|
2023-06-18 22:51:19 +00:00
|
|
|
BOOL m_bContentChanged;
|
2023-04-01 13:01:04 +00:00
|
|
|
CRect m_rc; // in image pixel coordinates
|
|
|
|
POINT m_ptHit; // in image pixel coordinates
|
2023-06-17 12:15:35 +00:00
|
|
|
CRect m_rcOld; // in image pixel coordinates
|
2023-04-01 13:01:04 +00:00
|
|
|
|
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-06-17 12:15:35 +00:00
|
|
|
BOOL IsLanded() const;
|
|
|
|
void HideSelection();
|
|
|
|
void DeleteSelection();
|
2023-04-01 13:01:04 +00:00
|
|
|
|
2023-06-17 12:15:35 +00:00
|
|
|
HBITMAP CopyBitmap();
|
2023-04-01 13:01:04 +00:00
|
|
|
void GetSelectionContents(HDC hDCImage);
|
|
|
|
void DrawFramePoly(HDC hDCImage);
|
2023-06-18 22:51:19 +00:00
|
|
|
void DrawBackground(HDC hDCImage);
|
2015-07-09 09:48:01 +00:00
|
|
|
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
|
|
|
|
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg);
|
2023-06-17 12:15:35 +00:00
|
|
|
void DrawSelection(HDC hDCImage, 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);
|
2023-06-18 22:51:19 +00:00
|
|
|
void InvertSelection();
|
2023-04-01 13:01:04 +00:00
|
|
|
|
|
|
|
void Dragging(CANVAS_HITTEST hit, POINT pt);
|
|
|
|
void ClearMask();
|
|
|
|
void ClearColor();
|
2023-06-18 22:51:19 +00:00
|
|
|
void NotifyContentChanged();
|
2019-12-25 06:46:29 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SelectionModel(const SelectionModel&);
|
|
|
|
SelectionModel& operator=(const SelectionModel&);
|
2023-04-01 13:01:04 +00:00
|
|
|
|
2023-06-17 12:15:35 +00:00
|
|
|
void ShiftPtStack(INT dx, INT dy);
|
2023-06-18 22:51:19 +00:00
|
|
|
void SwapWidthAndHeight();
|
2015-07-09 09:48:01 +00:00
|
|
|
};
|