-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenRGBAmbientPlugin.h
83 lines (55 loc) · 1.89 KB
/
OpenRGBAmbientPlugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// Created by Kamil Rojewski on 15.07.2021.
//
#ifndef OPENRGB_AMBIENT_OPENRGBAMBIENTPLUGIN_H
#define OPENRGB_AMBIENT_OPENRGBAMBIENTPLUGIN_H
#include <atomic>
#include <thread>
#include <vector>
#include <array>
#include <d3d11.h>
#include <QObject>
#include <OpenRGBPluginInterface.h>
#include "ImageProcessor.h"
#include "Settings.h"
class LedUpdateEvent;
class OpenRGBAmbientPlugin
: public QObject, public OpenRGBPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID OpenRGBPluginInterface_IID)
Q_INTERFACES(OpenRGBPluginInterface)
public:
OpenRGBAmbientPlugin() = default;
~OpenRGBAmbientPlugin() override;
bool event(QEvent *event) override;
OpenRGBPluginInfo GetPluginInfo() override;
unsigned int GetPluginAPIVersion() override;
void Load(bool dark_theme, ResourceManager *resource_manager_ptr) override;
QWidget *GetWidget() override;
QMenu *GetTrayMenu() override;
void Unload() override;
void turnOffLeds();
public slots:
void setPreview(bool enabled);
void setPauseCapture(bool enabled);
void updateProcessors();
signals:
void previewUpdated(const QImage &image);
private:
static const char *END_SESSION_WND_CLASS;
ResourceManager *resourceManager = nullptr;
Settings *settings = nullptr;
std::atomic_bool stopFlag{false};
std::atomic_bool preview{false};
std::atomic_bool pauseCapture{false};
std::vector<std::unique_ptr<ImageProcessorBase>> processors;
std::thread captureThread;
void startCapture();
void stopCapture();
void processImage(const std::shared_ptr<ID3D11Texture2D> &image);
void processUpdate(const LedUpdateEvent &event);
template<ColorPostProcessor CPP>
std::unique_ptr<ImageProcessorBase> createProcessor(RGBController *controller, std::array<float, 3> colorFactors, CPP colorPostProcessor);
};
#endif //OPENRGB_AMBIENT_OPENRGBAMBIENTPLUGIN_H