2015-05-08 16:02:36 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL
|
2015-09-09 13:13:35 +00:00
|
|
|
* FILE: base/applications/mspaint/history.h
|
2015-05-08 16:02:36 +00:00
|
|
|
* PURPOSE: Undo and redo functionality
|
|
|
|
* PROGRAMMERS: Benedikt Freisen
|
|
|
|
*/
|
|
|
|
|
2017-12-09 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-12-28 01:44:56 +00:00
|
|
|
/* HISTORYSIZE = number of possible undo-steps + 1 */
|
|
|
|
#define HISTORYSIZE 11
|
|
|
|
|
2015-07-07 11:56:37 +00:00
|
|
|
class ImageModel
|
|
|
|
{
|
2015-07-23 13:11:54 +00:00
|
|
|
public:
|
2015-07-23 07:48:32 +00:00
|
|
|
ImageModel();
|
2023-06-13 14:23:48 +00:00
|
|
|
virtual ~ImageModel();
|
|
|
|
|
|
|
|
HDC GetDC();
|
|
|
|
BOOL CanUndo() const { return undoSteps > 0; }
|
|
|
|
BOOL CanRedo() const { return redoSteps > 0; }
|
|
|
|
void PushImageForUndo(HBITMAP hbm = NULL);
|
|
|
|
void ResetToPrevious(void);
|
2022-01-30 03:05:23 +00:00
|
|
|
void Undo(BOOL bClearRedo = FALSE);
|
2015-07-07 11:56:37 +00:00
|
|
|
void Redo(void);
|
|
|
|
void ClearHistory(void);
|
|
|
|
void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0);
|
2023-06-13 14:23:48 +00:00
|
|
|
void SaveImage(LPCTSTR lpFileName);
|
2021-12-28 00:49:36 +00:00
|
|
|
BOOL IsImageSaved() const;
|
2015-07-07 11:56:37 +00:00
|
|
|
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0);
|
2021-12-28 00:49:36 +00:00
|
|
|
int GetWidth() const;
|
|
|
|
int GetHeight() const;
|
2015-07-07 11:56:37 +00:00
|
|
|
void InvertColors();
|
2015-07-23 13:52:02 +00:00
|
|
|
void FlipHorizontally();
|
|
|
|
void FlipVertically();
|
|
|
|
void RotateNTimes90Degrees(int iN);
|
2022-01-30 03:05:23 +00:00
|
|
|
void DeleteSelection();
|
|
|
|
void Bound(POINT& pt);
|
2023-06-13 14:23:48 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
HDC hDrawingDC; // The device context for this class
|
|
|
|
int currInd; // The current index
|
|
|
|
int undoSteps; // The undo-able count
|
|
|
|
int redoSteps; // The redo-able count
|
|
|
|
HBITMAP hBms[HISTORYSIZE]; // A rotation buffer of HBITMAPs
|
|
|
|
|
|
|
|
void NotifyImageChanged();
|
2015-07-07 11:56:37 +00:00
|
|
|
};
|