| 1 | // Aseprite |
| 2 | // Copyright (C) 2001-2015 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_FLIP_IMAGE_H_INCLUDED |
| 8 | #define APP_CMD_FLIP_IMAGE_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "app/cmd.h" |
| 12 | #include "app/cmd/with_image.h" |
| 13 | #include "doc/algorithm/flip_type.h" |
| 14 | #include "gfx/rect.h" |
| 15 | |
| 16 | #include <vector> |
| 17 | |
| 18 | namespace doc { |
| 19 | class Image; |
| 20 | } |
| 21 | |
| 22 | namespace app { |
| 23 | namespace cmd { |
| 24 | using namespace doc; |
| 25 | |
| 26 | class FlipImage : public Cmd |
| 27 | , public WithImage { |
| 28 | public: |
| 29 | FlipImage(Image* image, const gfx::Rect& bounds, |
| 30 | doc::algorithm::FlipType flipType); |
| 31 | |
| 32 | protected: |
| 33 | void onExecute() override; |
| 34 | void onUndo() override; |
| 35 | size_t onMemSize() const override { |
| 36 | return sizeof(*this); |
| 37 | } |
| 38 | |
| 39 | private: |
| 40 | void swap(); |
| 41 | |
| 42 | gfx::Rect m_bounds; |
| 43 | doc::algorithm::FlipType m_flipType; |
| 44 | }; |
| 45 | |
| 46 | } // namespace cmd |
| 47 | } // namespace app |
| 48 | |
| 49 | #endif |
| 50 | |