-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWidget_Filter_Blur.h
102 lines (90 loc) · 2.04 KB
/
Widget_Filter_Blur.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
96
97
98
99
100
101
102
#ifndef WIDGET_FILTER_BLUR
#define WIDGET_FILTER_BLUR
/*
This header file contains User interaction for Filter_agent(Blur_agent);
*/
#include "Filters.h"
#include "Widget_SliderInput.h"
class Widget_UI_blur
{
ImageProcessor::Filters::Blur Blur_agent;
Widget::SliderInput Blur_pannel;
int saved_kernel_size;
//widget flags...
bool visible; //Render window or not?
bool kernel_size_updated; //weather user intrrupted an update or not?
bool flag_process_green; //weather to process image during draw calls
bool intrrupt; //weather user intrrupted an update or not??
public:
Widget_UI_blur()
{
Blur_pannel=Widget::SliderInput("kernel","Blur",0,50);
visible=false;
flag_process_green=false;
intrrupt=false;
}
void processWith(unsigned char *image_input,int h,int w,int c)
{
Blur_agent.setimage(image_input,h,w,c);
Blur_agent.process();
}
void render()
{
if(visible)
{
Blur_pannel.render();
if(saved_kernel_size!=Blur_pannel.getvalue()) //intrrupted an update..
{
intrrupt=true;
saved_kernel_size=Blur_pannel.getvalue();
Blur_agent.setKernelSize(saved_kernel_size);
//Blur_agent.process();
}
else if(Blur_pannel.isApplyButtonpressed())
{intrrupt=true;}
else;
}
else;
}
unsigned char *getProcessed()
{
return Blur_agent.getimage();
}
/*
-||- -||-
-|| -||-
-\\ (( )) -//-
-\\ // 01 \\-//-
|0 1 0| -
\0101010/-
=======|01010|=======
/0101001\-
-//-|101000100|-\\-
-//- \\\\01////- -\\-
-||- \/ -||-
-||- -||-
*/
void setVisiblity(bool _visiblity)
{
visible=_visiblity;
}
bool filterApply()
{
return Blur_pannel.isApplyButtonpressed();
}
bool isVisible()
{
return visible;
}
bool hasintrrupted()
{
if(intrrupt==true)
{
intrrupt=false;
return true;
}
else
return false;
}
};
#endif