-
Notifications
You must be signed in to change notification settings - Fork 1
/
impressionistUI.h
272 lines (242 loc) · 8.26 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
//
// impressionistUI.h
//
// The header file for the UI part
//
#ifndef ImpressionistUI_h
#define ImpressionistUI_h
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/fl_file_chooser.H> // FLTK file chooser
#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_Light_Button.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_Float_Input.H>
#include <string>
#include <vector>
#include "Impressionist.h"
#include "OriginalView.h"
#include "PaintView.h"
#include "ImpBrush.h"
using namespace std;
//painterly style and stroke enum
enum {IMPRESSIONIST = 0,EXPRESSIONIST,COLOR_WASH,POINTILLIST,CUSTOMIZE};
class ImpressionistUI {
public:
ImpressionistUI();
// The FLTK widgets
Fl_Window* m_mainWindow;
Fl_Menu_Bar* m_menubar;
PaintView* m_paintView;
OriginalView* m_origView;
//for color dialog
Fl_Window* m_colorDialog;
Fl_Slider* m_RedColorSlider;
Fl_Slider* m_GreenColorSlider;
Fl_Slider* m_BlueColorSlider;
Fl_Button* m_ApplyScalingButton;
float m_nRedScale;
float m_nGreenScale;
float m_nBlueScale;
// for dimmed view dialog
Fl_Window* m_dimDialog;
Fl_Slider* m_dimAlphaSlider;
Fl_Button* m_dimButton;
float m_nDimAlpha;
bool m_nShowDimImage;
// for brush dialog
Fl_Window* m_brushDialog;
Fl_Choice* m_BrushTypeChoice;
Fl_Slider* m_BrushSizeSlider;
Fl_Slider* m_LineWidthSlider;
Fl_Slider* m_LineAngleSlider;
Fl_Slider* m_AlphaSlider;
Fl_Slider* m_AutoPaintSpacingSlider;
Fl_Slider* m_ThresholdSlider;
Fl_Button* m_ClearCanvasButton;
Fl_Button* m_RandomAttrButton;
Fl_Button* m_AutoPaintButton;
Fl_Button* m_EdgeClipingButton;
Fl_Button* m_AnotherGradientButton;
Fl_Button* m_DoItButton;
// for filter kernel setting dialog
Fl_Window* m_FilterKernelSettingDialog;
Fl_Int_Input* m_NumRowsInput;
Fl_Int_Input* m_NumColsInput;
Fl_Button* m_ConfirmKernelSettingButton;
// for filter kernel dialog
Fl_Window* m_FilterKernelDialog;
vector<Fl_Float_Input*> m_filterKernelInputMatrix;
Fl_Button* m_ApplyFilterKernel;
Fl_Button* m_Normalize;
//painterly dialog
Fl_Window* m_painterlylDialog;
//dropdown and button
Fl_Choice* m_painterlyStyle;
Fl_Choice* m_painterlyStroke;
Fl_Button* m_painterlyRun;
//horizontal sliders
Fl_Slider* m_painterlyThreshold;
Fl_Slider* m_painterlyCurvature;
Fl_Slider* m_painterlyBlur;
Fl_Slider* m_painterlyGridSize;
Fl_Slider* m_painterlyMinStrokeL;
Fl_Slider* m_painterlyMaxStrokeL;
Fl_Slider* m_painterlyAlpha;
Fl_Slider* m_painterlyLayers;
Fl_Slider* m_painterlyR0Level;
//vertical sliders
/*
Fl_Slider* m_painterlyJr;
Fl_Slider* m_painterlyJg;
Fl_Slider* m_painterlyJb;
Fl_Slider* m_painterlyJh;
Fl_Slider* m_painterlyJs;
Fl_Slider* m_painterlyJv;
*/
//painterly variables
int m_nPainterlyCurrentStyle;
int m_nPainterlyCurrentStroke;
int m_nPainterlyThreshold;
float m_nPainterlyCurvature;
float m_nPainterlyBlur;
bool m_nPainterlyBlurChanged;
bool m_nPainterlyRun;
bool m_nPaintrelyIsInitialized;
float m_nPainterlyGirdSize;
int m_nPainterlyMinStrokeL;
int m_nPainterlyMaxStrokeL;
float m_nPainterlyAlpha;
int m_nPainterlyLayers;
int m_nPainterlyR0Level;
/*
float m_nPainterlyJr;
float m_nPainterlyJg;
float m_nPainterlyJb;
float m_nPainterlyJh;
float m_nPainterlyJs;
float m_nPainterlyJv;
*/
int m_nPainterlyBrushSize;
// Member functions
void setDocument(ImpressionistDoc* doc);
ImpressionistDoc* getDocument();
void show();
void resize_windows(int w, int h);
int getSpacing();
bool getRandomAttr();
// Interface to get attribute
int getSize();
int getLineWidth();
int getLineAngle();
double getAlpha();
void setSize(int size);
void setLineAngle(int angle);
void setLineWidth(int width);
void passCursorPoint(const Point& p);
bool getEnableAutoDraw();
void setEnableAutoDraw(bool value);
bool getEnableNormalize();
int getKernelWidth();
int getKernelHeight();
int getThreshold();
bool getEnableEdgeCliping();
bool getAnotherGradient();
private:
ImpressionistDoc* m_pDoc; // pointer to document to communicate with the document
// All attributes here
int m_nSize;
int m_nLineWidth;
int m_nLineAngle;
float m_nAlpha;
int m_nSpacing;
bool m_nRandomAttr;
bool m_nEnableAutoDraw;
bool m_nEnableNormalize;
int m_nKernelWidth;
int m_nKernelHeight;
int m_nThreshold;
bool m_nEnableEdgeClipping;
bool m_nAnotherGradient;
int m_nBrushDirectionTypeCatche;
// Static class members
static Fl_Menu_Item menuitems[];
static Fl_Menu_Item brushTypeMenu[NUM_BRUSH_TYPE+1];
static Fl_Menu_Item brushDirectionControlType[3];
static Fl_Menu_Item painterlyStyleType[5];
static Fl_Menu_Item painterlyStrokeType[4];
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_save_image(Fl_Menu_* o, void* v);
static void cb_brushes(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_SwapWindows(Fl_Menu_* o, void* v);
static void cb_colors(Fl_Menu_* o, void* v);
static void cb_undo(Fl_Menu_* o, void* v);
static void cb_dissolve_image(Fl_Menu_* o,void* v);
static void cb_mural_image(Fl_Menu_* o, void* v);
static void cb_load_alpha_map(Fl_Menu_* o, void* v);
static void cb_ShowDimDialog(Fl_Menu_* o, void* v);
static void cb_filter_kernel_setting(Fl_Menu_* o, void* v);
static void cb_switch_view_type(Fl_Menu_* o, void* v);
static void cb_load_another_image(Fl_Menu_* o, void* v);
static void cb_load_edge_image(Fl_Menu_* o, void* v);
static void cb_painterly(Fl_Menu_* o, void* v);
static void cb_brushChoice(Fl_Widget* o, void* v);
static void cb_brushDirectionType(Fl_Widget* o, void* v);
static void cb_clear_canvas_button(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_RedSlides(Fl_Widget* o, void* v);
static void cb_GreenSlides(Fl_Widget* o, void* v);
static void cb_BlueSlides(Fl_Widget* o, void* v);
static void cb_ApplyColorScaling(Fl_Widget* o, void* v);
static void cb_dimAlphaSlides(Fl_Widget* o, void* v);
static void cb_dim_button(Fl_Widget* o, void* v);
static void cb_AutoPaintSpacingSlides(Fl_Widget* o, void* v);
static void cb_Rand_Attr_button(Fl_Widget* o, void* v);
static void cb_Auto_Paint_button(Fl_Widget* o, void* v);
static void cb_confirm_kernel_button(Fl_Widget* o, void* v);
static void cb_ApplyFilterKernel(Fl_Widget* o, void* v);
static void cb_normalize_toggle_button(Fl_Widget* o, void* v);
static void cb_ThresholdSlides(Fl_Widget* o, void* v);
static void cb_Generating_Edge_Image_button(Fl_Widget* o, void* v);
static void cb_toggle_cliping_button(Fl_Widget* o, void* v);
static void cb_another_gradient_button(Fl_Widget* o, void* v);
//painterly
/*
static void cb_painterly_Type(Fl_Widget* o, void* v);
static void cb_painterlyJrSlides(Fl_Widget* o, void* v);
static void cb_painterlyJgSlides(Fl_Widget* o, void* v);
static void cb_painterlyJbSlides(Fl_Widget* o, void* v);
static void cb_painterlyJhSlides(Fl_Widget* o, void* v);
static void cb_painterlyJsSlides(Fl_Widget* o, void* v);
static void cb_painterlyJvSlides(Fl_Widget* o, void* v);
*/
static void cb_painterlyStrokeType(Fl_Widget* o, void* v);
static void cb_painterly_run_button(Fl_Widget* o, void* v);
static void cb_painterlyThresholdSlides(Fl_Widget* o, void* v);
static void cb_paintlyCurvatureSlides(Fl_Widget* o, void* v);
static void cb_painterlyBlurSlides(Fl_Widget* o, void* v);
static void cb_painterlyGridSizeSlides(Fl_Widget* o, void* v);
static void cb_painterlyMinStrokeSlides(Fl_Widget* o, void* v);
static void cb_painterlyMaxStrokeSlides(Fl_Widget* o, void* v);
static void cb_painterlyAlphaSlides(Fl_Widget* o, void* v);
static void cb_painterlyLayerSlides(Fl_Widget* o, void* v);
static void cb_painterlyR0LevelSlides(Fl_Widget* o, void* v);
};
#endif
/*swap original view and paint view
m_paintView->position();
m_paintView->x();
m_paintView->y();
*/