1// Aseprite
2// Copyright (C) 2022 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_FILTERS_FILTER_PREVIEW_H_INCLUDED
9#define APP_COMMANDS_FILTERS_FILTER_PREVIEW_H_INCLUDED
10#pragma once
11
12#include "base/thread.h"
13#include "ui/timer.h"
14#include "ui/widget.h"
15
16#include <mutex>
17
18namespace app {
19
20 class FilterManagerImpl;
21
22 // Invisible widget to control a effect-preview in the current editor.
23 class FilterPreview : public ui::Widget {
24 public:
25 FilterPreview(FilterManagerImpl* filterMgr);
26 ~FilterPreview();
27
28 void setEnablePreview(bool state);
29
30 void stop();
31 void restartPreview();
32
33 protected:
34 bool onProcessMessage(ui::Message* msg) override;
35
36 private:
37 void onFilterThread();
38
39 FilterManagerImpl* m_filterMgr;
40 ui::Timer m_timer;
41 std::mutex m_filterMgrMutex;
42 std::unique_ptr<base::thread> m_filterThread;
43 bool m_filterIsDone;
44 };
45
46} // namespace app
47
48#endif
49