| 1 | // Aseprite |
|---|---|
| 2 | // Copyright (C) 2018-2020 Igara Studio S.A. |
| 3 | // |
| 4 | // This program is distributed under the terms of |
| 5 | // the End-User License Agreement for Aseprite. |
| 6 | |
| 7 | #ifndef APP_CMD_CONVERT_COLOR_PROFILE_H_INCLUDED |
| 8 | #define APP_CMD_CONVERT_COLOR_PROFILE_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "app/cmd.h" |
| 12 | #include "app/cmd/with_sprite.h" |
| 13 | #include "app/cmd_sequence.h" |
| 14 | #include "gfx/color_space.h" |
| 15 | |
| 16 | namespace gfx { |
| 17 | class ColorSpace; |
| 18 | } |
| 19 | |
| 20 | namespace doc { |
| 21 | class Image; |
| 22 | class Palette; |
| 23 | } |
| 24 | |
| 25 | namespace app { |
| 26 | namespace cmd { |
| 27 | |
| 28 | class ConvertColorProfile : public Cmd, |
| 29 | public WithSprite { |
| 30 | public: |
| 31 | ConvertColorProfile(doc::Sprite* sprite, const gfx::ColorSpaceRef& newCS); |
| 32 | |
| 33 | protected: |
| 34 | void onExecute() override; |
| 35 | void onUndo() override; |
| 36 | void onRedo() override; |
| 37 | size_t onMemSize() const override { |
| 38 | return sizeof(*this) + m_seq.memSize(); |
| 39 | } |
| 40 | |
| 41 | private: |
| 42 | CmdSequence m_seq; |
| 43 | }; |
| 44 | |
| 45 | // Converts the sprite to the new color profile without undo information. |
| 46 | // TODO how to merge this function with cmd::ConvertColorProfile |
| 47 | void convert_color_profile(doc::Sprite* sprite, |
| 48 | const gfx::ColorSpaceRef& newCS); |
| 49 | |
| 50 | void convert_color_profile(doc::Image* image, |
| 51 | doc::Palette* palette, |
| 52 | const gfx::ColorSpaceRef& oldCS, |
| 53 | const gfx::ColorSpaceRef& newCS); |
| 54 | |
| 55 | } // namespace cmd |
| 56 | } // namespace app |
| 57 | |
| 58 | #endif |
| 59 |