-
Notifications
You must be signed in to change notification settings - Fork 3
/
impressionistUI.h
215 lines (181 loc) · 6.47 KB
/
impressionistUI.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
//
// impressionistUI.h
//
// The header file for the UI part
//
#ifndef ImpressionistUI_h
#define ImpressionistUI_h
#include <FL/Fl_Window.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Color_Chooser.H>
#include "OriginalView.h"
#include "PaintView.h"
#include "ImpBrush.h"
#include <vector>
class ImpressionistUI {
public:
ImpressionistUI();
// The FLTK widgets
Fl_Window* m_mainWindow;
Fl_Menu_Bar* m_menubar;
PaintView* m_paintView;
OriginalView* m_origView;
// for brush dialog
Fl_Window* m_brushDialog;
Fl_Choice* m_BrushTypeChoice;
Fl_Choice* m_BrushDirectionChoice;
Fl_Slider* m_BrushSizeSlider;
Fl_Slider* m_LineWidthSlider;
Fl_Slider* m_LineAngleSlider;
Fl_Slider* m_AlphaSlider;
Fl_Slider* m_AutoFillStrikeSlider;
Fl_Slider* m_AutoFillRandomSlider;
Fl_Button* m_ClearCanvasButton;
Fl_Button* m_AutoFillButton;
Fl_Check_Button* m_AutoFillEnableRandomButton;
Fl_Slider* m_EdgeThresholdSlider;
Fl_Button* m_FindEdgeButton;
Fl_Check_Button* m_EdgeClipButton;
Fl_Input* m_KernelInput;
Fl_Button* m_KernelApplyButton;
Fl_Check_Button* m_KernelNormalizeButton;
char* m_KernelStr;
Fl_Slider* m_WarpStrengthSlider;
//for painterly
Fl_Window* m_painterlyDialog;
Fl_Choice* m_painterlyBrushTypeChoice;
Fl_Slider* m_painterlyThresholdSlider;
Fl_Slider* m_painterlyCurvatureSlider;
Fl_Slider* m_painterlyBlurSlider;
Fl_Slider* m_painterlyGridSizeSlider;
Fl_Slider* m_painterlyMinStrokeSlider;
Fl_Slider* m_painterlyMaxStrokeSlider;
Fl_Slider* m_painterlyAlphaSlider;
Fl_Slider* m_painterlyLayersSlider;
Fl_Slider* m_painterlyR0Slider;
Fl_Button* m_painterlyButton;
Fl_Window* m_colorPickerDialog;
Fl_Color_Chooser* m_colorChooser;
Fl_Window* m_tracerDialog;
Fl_Value_Slider* m_tracerOpacitySlider;
Fl_Window* m_dissolveDialog;
Fl_Value_Slider* m_dissolveOpacitySlider;
Fl_Button* m_dissolveLoadImageBtn;
// Member functions
void setDocument(ImpressionistDoc* doc);
ImpressionistDoc* getDocument();
void show();
void resize_windows(int w, int h);
// Interface to get attribute
int getSize();
void setSize(int size);
int getLineWidth();
void setLineWidth(int width);
int getLineAngle();
void setLineAngle(int angle);
double getAlpha();
void setAlpha(double alpha);
int getAutoFillStrike();
void setAutoFillStrike(int strike);
double getAutoFillRandom() const;
void setAutoFillRandom(double auto_fill_random);
bool getAutoFillEnableRandom();
void setAutoFillEnableRandom(bool flag);
int getEdgeThreshold();
void setEdgeThreshold(int threshold);
bool getEdgeClip();
void setEdgeClip(bool flag);
bool getIsNormalizedKernel();
std::vector<std::vector<float>> kernel;
private:
ImpressionistDoc* m_pDoc; // pointer to document to communicate with the document
// All attributes here
int m_nSize;
int m_LineWidth;
int m_LineAngle;
double m_Alpha;
int m_AutoFillStrike = 1;
double m_AutoFillRandom = 0;
bool m_AutoFillEnableRandom = true;
int m_EdgeThreshold = 0;
bool m_EdgeClip = true;
bool parseKernel(); //return total
bool m_IsNormalizedKernel = false;
// painterly attributes
public:
int m_painterlyThreshold = 100;
double m_painterlyCurvature = 1;
double m_painterlyBlur = 0.5;
double m_painterlyGridSize = 1;
int m_painterlyMinStroke = 4;
int m_painterlyMaxStroke = 16;
double m_painterlyAlpha = 1;
int m_painterlyLayers = 3;
int m_painterlyR0 = 3;
double m_warpStrength = 1;
private:
// Static class members
static Fl_Menu_Item menuitems[];
static Fl_Menu_Item brushTypeMenu[NUM_BRUSH_TYPE+1];
static Fl_Menu_Item brushDirectionMenu[NUM_DIRECTION_TYPE+1];
static ImpressionistUI* whoami(Fl_Menu_* o);
// All callbacks here. Callbacks are declared
// static
static void cb_load_image(Fl_Menu_* o, void* v);
static void cb_load_another_image(Fl_Menu_* o, void* v);
static void cb_load_mural_image(Fl_Menu_* o, void* v);
static void cb_load_alpha_map_image(Fl_Menu_* o, void* v);
static void cb_save_image(Fl_Menu_* o, void* v);
static void cb_brushes(Fl_Menu_* o, void* v);
static void cb_painterly(Fl_Menu_* o, void* v);
static void cb_clear_canvas(Fl_Menu_* o, void* v);
static void cb_exit(Fl_Menu_* o, void* v);
static void cb_about(Fl_Menu_* o, void* v);
static void cb_brushChoice(Fl_Widget* o, void* v);
static void cb_directionChoice(Fl_Widget* o, void* v);
static void cb_clear_canvas_button(Fl_Widget* o, void* v);
static void cb_auto_fill(Fl_Widget* o, void* v);
static void cb_sizeSlides(Fl_Widget* o, void* v);
static void cb_lineWidthSlides(Fl_Widget* o, void* v);
static void cb_lineAngleSlides(Fl_Widget* o, void* v);
static void cb_alphaSlides(Fl_Widget* o, void* v);
static void cb_undo(Fl_Menu_* o, void* v);
static void cb_swap_content(Fl_Menu_* o, void* v);
static void cb_auto_fill_menu(Fl_Menu_* o, void* v);
static void cb_autoFillStrikeSlides(Fl_Widget* o, void* v);
static void cb_autoFillRandomSlides(Fl_Widget* o, void* v);
static void cb_enable_random(Fl_Widget* o, void* v);
static void cb_edge_clip(Fl_Widget* o, void* v);
static void cb_edgeThresholdSlides(Fl_Widget* o, void* v);
static void cb_find_edge(Fl_Widget* o, void* v);
static void cb_view_original(Fl_Menu_* o, void* v);
static void cb_view_another(Fl_Menu_* o, void* v);
static void cb_view_edge(Fl_Menu_* o, void* v);
static void cb_edit_kernel(Fl_Widget* o, void* v);
static void cb_apply_kernel(Fl_Widget* o, void* v);
static void cb_normalize_kernel(Fl_Widget* o, void* v);
static void cb_warpStrengthSlides(Fl_Widget* o, void* v);
//painterly callback functions
static void cb_painterly_paint(Fl_Widget* o, void* v);
static void cb_painterly_threshold(Fl_Widget* o, void* v);
static void cb_painterly_curvature(Fl_Widget* o, void* v);
static void cb_painterly_blur(Fl_Widget* o, void* v);
static void cb_painterly_grid_size(Fl_Widget* o, void* v);
static void cb_painterly_min_stroke(Fl_Widget* o, void* v);
static void cb_painterly_max_stroke(Fl_Widget* o, void* v);
static void cb_painterly_alpha(Fl_Widget* o, void* v);
static void cb_painterly_layers(Fl_Widget* o, void* v);
static void cb_painterly_r0(Fl_Widget* o, void* v);
//bayesian
static void cb_bayesian_open_and_solve(Fl_Menu_* o, void* v);
static Fl_Callback cb_open_colors_dialog;
static Fl_Callback cb_open_tracer_dialog;
static Fl_Callback cb_tracer_update;
static Fl_Callback cb_open_dissolve_dialog;
static Fl_Callback cb_dissolve;
};
#endif