-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWidget_Filter_Sharp.h
95 lines (82 loc) · 1.68 KB
/
Widget_Filter_Sharp.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
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef _WIDGET_FILTER_SHARP_H
#define _WIDGET_FILTER_SHARP_H
#include "Filters.h"
#include "Widget_SliderInput.h"
/*
This headerfile combine user-interface and filter operation as one..so that user could..
apply filter via UI provided..
This class hold interaction with user and manage to implement filter operation over data
fed..
*/
class Widget_UI_Sharpness
{
float min,max;
ImageProcessor::Filters::Sharp Sharp_agent;
Widget::SliderInput_float ui_pannel;
//flags..
bool visible;
bool intrrupt;
//accumulator..
float saved_sharpness;
public:
Widget_UI_Sharpness()
{
min=0; max=5.0;
visible=false;
intrrupt=false;
ui_pannel=Widget::SliderInput_float(" ","Sharpness",0.0,5.0,"%0.5f");
}
bool applyFilter()
{
if(ui_pannel.isApplyButtonpressed())
ui_pannel.setVal(0.0);
return ui_pannel.isApplyButtonpressed();
}
void render()
{
if(visible)
{
ui_pannel.render();
if(saved_sharpness!=ui_pannel.getvalue())
{
intrrupt=true;
saved_sharpness=ui_pannel.getvalue();
Sharp_agent.setSharpnessParameter(saved_sharpness);
}
else if(ui_pannel.isApplyButtonpressed())
{
intrrupt=true;
}
else
intrrupt=false;
}
}
bool hasintrrupted()
{
if(intrrupt)
{
intrrupt=false;
return true;
}
else
return intrrupt;
}
void processWith(unsigned char *image_input,int h,int w,int c)
{
Sharp_agent.setimage(image_input,h,w,c);
Sharp_agent.process();
}
void setVisiblity(bool visible_)
{
visible=visible_;
}
unsigned char* getProcessed()
{
return Sharp_agent.getimage();
}
bool isVisible()
{
return visible;
}
};
#endif