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_COMMANDS_CMD_EYEDROPPER_H_INCLUDED |
9 | #define APP_COMMANDS_CMD_EYEDROPPER_H_INCLUDED |
10 | #pragma once |
11 | |
12 | #include "app/color.h" |
13 | #include "app/commands/command.h" |
14 | #include "gfx/point.h" |
15 | |
16 | namespace render { |
17 | class Projection; |
18 | } |
19 | |
20 | namespace app { |
21 | class Editor; |
22 | class Site; |
23 | |
24 | class EyedropperCommand : public Command { |
25 | public: |
26 | EyedropperCommand(); |
27 | |
28 | // Returns the color in the given sprite pos. |
29 | void pickSample(const Site& site, |
30 | const gfx::PointF& pixelPos, |
31 | const render::Projection& proj, |
32 | app::Color& color, |
33 | doc::tile_t& tile); |
34 | |
35 | void executeOnMousePos(Context* context, |
36 | Editor* editor, |
37 | const gfx::Point& mousePos, |
38 | const bool foreground); |
39 | |
40 | protected: |
41 | void onLoadParams(const Params& params) override; |
42 | void onExecute(Context* context) override; |
43 | |
44 | // True means "pick background color", false the foreground color. |
45 | bool m_background; |
46 | }; |
47 | |
48 | } // namespace app |
49 | |
50 | #endif // APP_COMMANDS_CMD_EYEDROPPER_H_INCLUDED |
51 | |