-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathworker.cpp
More file actions
executable file
·62 lines (53 loc) · 1.92 KB
/
worker.cpp
File metadata and controls
executable file
·62 lines (53 loc) · 1.92 KB
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
#include "worker.h"
Worker::Worker()
{
slider = new Sliders;
}
Worker::~Worker()
{
}
/*
* -----------------------------------------------------------------------------------------
* SLOT : UPDATE IMAGE
* -----------------------------------------------------------------------------------------
* Passes a QImage to the specified modify function
*
* @param QImage : the QImage object we wish to modify
* @param int : the value we currently have set on the slider
* @param QString : the setting value we want to return as an enum
* -----------------------------------------------------------------------------------------
*/
void Worker::updateImage(QImage image, int r_h, int g_s, int b_l, QString setting)
{
// Get the enum representation of QString
SETTING::option givenSetting = get_setting(setting);
// Check for H,S,L rendering
if(givenSetting == SETTING::HSL)
image = slider->modifyHSL(r_h, g_s, b_l, image);
// Check for R,G,B rendering
if(givenSetting == SETTING::RGB)
image = slider->modifyRGB(r_h, g_s, b_l, image);
// After process, emit the signal
emit imageUpdated(image);
}
/*
* -----------------------------------------------------------------------------------------
* GET SETTING
* -----------------------------------------------------------------------------------------
* Takes a QString which relates to a given enum and returns that enumerable to be used in
* the modify functions
*
* @param QString : the setting value we want to return as an enum
*
* @return SETTING : returns the setting from the given namespace, else return unset
* -----------------------------------------------------------------------------------------
*/
SETTING::option Worker::get_setting(QString setting)
{
if (setting == "RGB")
return SETTING::RGB;
if (setting == "HSL")
return SETTING::HSL;
// Default return value
return SETTING::UNSET;
}