1// Aseprite
2// Copyright (C) 2019 Igara Studio S.A.
3// Copyright (C) 2016 David Capello
4//
5// This program is distributed under the terms of
6// the End-User License Agreement for Aseprite.
7
8#ifndef APP_CMD_CROP_CEL_H_INCLUDED
9#define APP_CMD_CROP_CEL_H_INCLUDED
10#pragma once
11
12#include "app/cmd.h"
13#include "app/cmd/with_cel.h"
14#include "gfx/point.h"
15#include "gfx/rect.h"
16
17namespace app {
18namespace cmd {
19
20 class CropCel : public Cmd
21 , public WithCel {
22 public:
23 CropCel(doc::Cel* cel, const gfx::Rect& newBounds);
24
25 protected:
26 void onExecute() override;
27 void onUndo() override;
28 size_t onMemSize() const override {
29 return sizeof(*this);
30 }
31
32 private:
33 void cropImage(const gfx::Point& origin,
34 const gfx::Rect& bounds);
35
36 gfx::Point m_oldOrigin;
37 gfx::Point m_newOrigin;
38 gfx::Rect m_oldBounds;
39 gfx::Rect m_newBounds;
40 };
41
42} // namespace cmd
43} // namespace app
44
45#endif
46