| 1 | // Aseprite |
|---|---|
| 2 | // Copyright (C) 2019-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_EXTRA_CEL_H_INCLUDED |
| 9 | #define APP_EXTRA_CEL_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "app/tilemap_mode.h" |
| 13 | #include "base/disable_copying.h" |
| 14 | #include "doc/blend_mode.h" |
| 15 | #include "doc/cel.h" |
| 16 | #include "doc/frame.h" |
| 17 | #include "doc/image_buffer.h" |
| 18 | #include "doc/image_ref.h" |
| 19 | #include "gfx/rect.h" |
| 20 | #include "render/extra_type.h" |
| 21 | |
| 22 | #include <memory> |
| 23 | |
| 24 | namespace doc { |
| 25 | class Sprite; |
| 26 | } |
| 27 | |
| 28 | namespace app { |
| 29 | |
| 30 | class ExtraCel { |
| 31 | public: |
| 32 | ExtraCel(); |
| 33 | |
| 34 | void create(const TilemapMode tilemapMode, |
| 35 | doc::Sprite* sprite, |
| 36 | const gfx::Rect& bounds, |
| 37 | const gfx::Size& imageSize, |
| 38 | const doc::frame_t frame, |
| 39 | const int opacity); |
| 40 | void reset(); |
| 41 | |
| 42 | render::ExtraType type() const { return m_type; } |
| 43 | void setType(render::ExtraType type) { m_type = type; } |
| 44 | |
| 45 | doc::Cel* cel() const { return m_cel.get(); } |
| 46 | doc::Image* image() const { return m_image.get(); } |
| 47 | |
| 48 | doc::BlendMode blendMode() const { return m_blendMode; } |
| 49 | void setBlendMode(doc::BlendMode mode) { m_blendMode = mode; } |
| 50 | |
| 51 | private: |
| 52 | render::ExtraType m_type; |
| 53 | std::unique_ptr<doc::Cel> m_cel; |
| 54 | doc::ImageRef m_image; |
| 55 | doc::ImageBufferPtr m_imageBuffer; |
| 56 | doc::BlendMode m_blendMode; |
| 57 | |
| 58 | DISABLE_COPYING(ExtraCel); |
| 59 | }; |
| 60 | |
| 61 | typedef std::shared_ptr<ExtraCel> ExtraCelRef; |
| 62 | |
| 63 | } // namespace app |
| 64 | |
| 65 | #endif |
| 66 |