-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWidget_Filter_Retro.h
109 lines (89 loc) · 2.09 KB
/
Widget_Filter_Retro.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
103
104
105
106
107
108
109
#ifndef _WIDGET_FILTER_RETRO
#define _WIDGET_FILTER_RETRO
#include "Filters.h"
#include "Widget_SliderInput.h"
//This headerfile implement UI for filter operators;;
class Widget_UI_Retro
{
int min,max;
ImageProcessor::Filters::Retro Retro_agent;
Widget::SliderInput Retro_pannel;
int saved_filter_strength;
//widget flags...
bool visible;
bool intrrupt;
//no-copy flags..
bool kernel_size_updated;
public:
Widget_UI_Retro()
{
min=0;max=50;
visible=false;
Retro_pannel=Widget::SliderInput("Retro","strength",min,max);
intrrupt=false;
}
void processWith(unsigned char *image_input,int h,int w,int c)
{
Retro_agent.setimage(image_input,h,w,c);
Retro_agent.process();
}
void render()
{
if(visible)
{
Retro_pannel.render();
if(saved_filter_strength!=Retro_pannel.getvalue()) //intrrupted an update..
{
intrrupt=true;
saved_filter_strength=Retro_pannel.getvalue();
Retro_agent.setFilterStrength(saved_filter_strength);
//Retro_agent.process();
}
else if(applyFilter()) //if user pressed apply button to apply filter thats also a kind of intrrupt..
{
intrrupt=true;
}
else{intrrupt=false;}
//Retro_pannel.render(); dont destroy order of execution ...it will cause un-predictable malfunction..
}
else;
}
unsigned char *getProcessed()
{
return Retro_agent.getimage();
}
/*
-||- -||-
-|| -||-
-\\ (( )) -//-
-\\ // 01 \\-//-
|0 1 0| -
\0101010/-
=======|01010|=======
/0101001\-
-//-|101000100|-\\-
-//- \\\\01////- -\\-
-||- \/ -||-
-||- -||-
*/
void setVisiblity(bool _visiblity)
{
visible=_visiblity;
}
bool isVisible()
{
return visible;
}
bool hasintrrupted()
{
if(intrrupt==true)
{intrrupt=false;return true;}
else
return false;
}
bool applyFilter()
{
return Retro_pannel.isApplyButtonpressed();
}
};
#endif