| 1 | // Aseprite |
|---|---|
| 2 | // Copyright (C) 2020 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2018 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_CLEAR_MASK_H_INCLUDED |
| 9 | #define APP_CMD_CLEAR_MASK_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "app/cmd.h" |
| 13 | #include "app/cmd/with_cel.h" |
| 14 | #include "app/cmd/with_image.h" |
| 15 | #include "app/cmd_sequence.h" |
| 16 | #include "doc/image_ref.h" |
| 17 | #include "gfx/rect.h" |
| 18 | |
| 19 | #include <memory> |
| 20 | |
| 21 | namespace app { |
| 22 | namespace cmd { |
| 23 | using namespace doc; |
| 24 | |
| 25 | class ClearMask : public Cmd |
| 26 | , public WithCel { |
| 27 | public: |
| 28 | ClearMask(Cel* cel); |
| 29 | |
| 30 | protected: |
| 31 | void onExecute() override; |
| 32 | void onUndo() override; |
| 33 | void onRedo() override; |
| 34 | size_t onMemSize() const override { |
| 35 | return sizeof(*this) + m_seq.memSize() + |
| 36 | (m_copy ? m_copy->getMemSize(): 0); |
| 37 | } |
| 38 | |
| 39 | private: |
| 40 | void clear(); |
| 41 | void restore(); |
| 42 | |
| 43 | CmdSequence m_seq; |
| 44 | ImageRef m_copy; |
| 45 | gfx::Point m_cropPos; |
| 46 | color_t m_bgcolor; |
| 47 | }; |
| 48 | |
| 49 | } // namespace cmd |
| 50 | } // namespace app |
| 51 | |
| 52 | #endif |
| 53 |