1// Aseprite
2// Copyright (C) 2022 Igara Studio S.A.
3// Copyright (C) 2016-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_UI_COLOR_TINT_SHADE_TONE_H_INCLUDED
9#define APP_UI_COLOR_TINT_SHADE_TONE_H_INCLUDED
10#pragma once
11
12#include "app/ui/color_selector.h"
13#include "obs/connection.h"
14
15namespace app {
16 class Color;
17
18 class ColorTintShadeTone : public ColorSelector {
19 public:
20 ColorTintShadeTone();
21
22 protected:
23#if SK_ENABLE_SKSL
24 const char* getMainAreaShader() override;
25 const char* getBottomBarShader() override;
26 void setShaderParams(SkRuntimeShaderBuilder& builder, bool main) override;
27#endif
28 app::Color getMainAreaColor(const int u, const int umax,
29 const int v, const int vmax) override;
30 app::Color getBottomBarColor(const int u, const int umax) override;
31
32 void onPaint(ui::PaintEvent& ev) override;
33 void onPaintMainArea(ui::Graphics* g, const gfx::Rect& rc) override;
34 void onPaintBottomBar(ui::Graphics* g, const gfx::Rect& rc) override;
35 void onPaintSurfaceInBgThread(os::Surface* s,
36 const gfx::Rect& main,
37 const gfx::Rect& bottom,
38 const gfx::Rect& alpha,
39 bool& stop) override;
40 int onNeedsSurfaceRepaint(const app::Color& newColor) override;
41
42 private:
43#if SK_ENABLE_SKSL
44 std::string m_mainShader;
45 std::string m_bottomShader;
46#endif
47 bool m_hueWithSatValue = false;
48 obs::scoped_connection m_conn;
49 };
50
51} // namespace app
52
53#endif
54