1 // Aseprite 2 // Copyright (C) 2001-2016 David Capello 3 // 4 // This program is distributed under the terms of 5 // the End-User License Agreement for Aseprite. 6 7 #ifndef APP_CMD_CLEAR_MASK_H_INCLUDED 8 #define APP_CMD_CLEAR_MASK_H_INCLUDED 9 #pragma once 10 11 #include "app/cmd.h" 12 #include "app/cmd/with_cel.h" 13 #include "app/cmd/with_image.h" 14 #include "app/cmd_sequence.h" 15 #include "base/unique_ptr.h" 16 #include "doc/image_ref.h" 17 18 namespace app { 19 namespace cmd { 20 using namespace doc; 21 22 class ClearMask : public Cmd 23 , public WithCel { 24 public: 25 ClearMask(Cel* cel); 26 27 protected: 28 void onExecute() override; 29 void onUndo() override; 30 void onRedo() override; onMemSize()31 size_t onMemSize() const override { 32 return sizeof(*this) + m_seq.memSize() + 33 (m_copy ? m_copy->getMemSize(): 0); 34 } 35 36 private: 37 void clear(); 38 void restore(); 39 40 CmdSequence m_seq; 41 base::UniquePtr<WithImage> m_dstImage; 42 ImageRef m_copy; 43 gfx::Point m_offset; 44 int m_boundsX, m_boundsY; 45 color_t m_bgcolor; 46 }; 47 48 } // namespace cmd 49 } // namespace app 50 51 #endif 52