| 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_COLOR_PICKER_H_INCLUDED |
| 9 | #define APP_COLOR_PICKER_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "app/color.h" |
| 13 | #include "doc/layer.h" |
| 14 | #include "doc/tile.h" |
| 15 | #include "gfx/point.h" |
| 16 | |
| 17 | namespace render { |
| 18 | class Projection; |
| 19 | } |
| 20 | |
| 21 | namespace app { |
| 22 | class Site; |
| 23 | |
| 24 | class ColorPicker { |
| 25 | public: |
| 26 | enum Mode { |
| 27 | FromComposition, |
| 28 | FromActiveLayer, |
| 29 | FromFirstReferenceLayer |
| 30 | }; |
| 31 | |
| 32 | ColorPicker(); |
| 33 | |
| 34 | void pickColor(const Site& site, |
| 35 | const gfx::PointF& pos, |
| 36 | const render::Projection& proj, |
| 37 | const Mode mode); |
| 38 | |
| 39 | app::Color color() const { return m_color; } |
| 40 | doc::tile_t tile() const { return m_tile; } |
| 41 | int alpha() const { return m_alpha; } |
| 42 | doc::Layer* layer() const { return m_layer; } |
| 43 | |
| 44 | private: |
| 45 | app::Color m_color; |
| 46 | doc::tile_t m_tile; |
| 47 | int m_alpha; |
| 48 | doc::Layer* m_layer; |
| 49 | }; |
| 50 | |
| 51 | } // namespace app |
| 52 | |
| 53 | #endif |
| 54 | |