1 /* img_process_dialog.h - headers for image dialog class - filters and other transformations
2  *
3  * Copyright (C) 2001 Patrice St-Gelais
4  *         patrstg@users.sourceforge.net
5  *         http://geomorph.sourceforge.net
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef _IMGPROCESS_DIALOG
23 #define _IMGPROCESS_DIALOG 1
24 
25 #include <gtk/gtk.h>
26 #include "../utils/menus_n_tools.h"
27 #include "globals.h"
28 #include "img_process.h"
29 #include "hf_filters_dialog.h"
30 #include "waves_dialog.h"
31 #include "waves.h"
32 #include "merge_dialog.h"
33 #include "erode_dialog.h"
34 #include "wind.h"
35 #include "wind_dialog.h"
36 #include "geom_transform_dialog.h"
37 #include "craters.h"
38 #include "erode.h"
39 #include "erode_dialog.h"
40 #include "voronoi.h"
41 #include "voronoi_dialog.h"
42 
43 typedef struct {
44 	GtkWidget *img_dialog;		// Master dialog (a toolbar)
45 	GtkWidget *current_subdialog;	// Could be any of the next
46 	void (*set_fn) (gpointer);		// Sets default values for the current dialog
47 					// For use in accept / reset callbacks
48 	GtkWidget *accept_wdg;		// Current accept button,
49 					// for use in accept / reset callbacks
50 
51 // Brightness - contrast
52 	GtkWidget *br_contr_dialog;
53 	gint brightness_level;
54 	gint contrast_level;
55 	GtkObject *adj_brightness;
56 	GtkObject *adj_contrast;
57 	GtkWidget *overflow_radio_button;
58 	gboolean brightness_bound_overflow;
59 	GtkWidget *contrast_keep_luminosity_check_box;
60 	GtkWidget *br_contr_accept;
61 
62 // Smooth
63 	GtkObject *adj_smooth_radius;
64 	GtkObject *adj_smooth_box;
65 	GtkWidget *smooth_dialog;
66 	gint smooth_radius;
67 	gboolean smooth_direct;
68 	// Merge struct. containing operation (+,*,.-...) and parameters
69 	merge_dialog_struct *smooth_merge;
70 	GtkWidget *smooth_accept;
71 	gint smooth_wrap;
72 
73 // Sharpen (increase noise)
74 	GtkObject *adj_sharpen_radius;
75 	GtkObject *adj_sharpen_level;
76 	GtkWidget *sharpen_dialog;
77 	gint sharpen_radius;
78 	gdouble sharpen_level;
79 	// Merge struct. containing operation (+,*,.-...) and parameters
80 	merge_dialog_struct *sharpen_merge;
81 	GtkWidget *sharpen_accept;
82 	gint sharpen_wrap;
83 
84 // Slider
85 	GtkWidget *slide_dialog;
86 	GtkObject *adj_slidev;
87 	GtkObject *adj_slideh;
88 	GtkWidget *slide_accept;
89 	gint slidev;	// From 0 to 100 %
90 	gint slideh;
91 
92 // Rotate
93 	GtkWidget *rotate_dialog;
94 	GtkObject *adj_rotate;
95 	gint angle;
96 	gint rotate_overflow_tiling ;
97 	gint rotate_overflow_notiling ;
98 	GtkWidget *rotate_accept;
99 	GtkWidget *auto_rotate;
100 
101 // Terraces
102 	GtkWidget *terrace_dialog;
103 	gint terrace_levels;
104 	GtkObject *adj_terrace_levels;
105 	gint terrace_seed;
106 	gint terrace_percent_random;
107 	GtkObject *adj_terrace_percent_random;
108 	// Merge struct. containing operation (+,*,.-...) and parameters
109 	merge_dialog_struct *terrace_merge;
110 	// Smooth parameters, applied on the result
111 	gint terrace_smooth_radius;
112 	GtkObject *adj_terrace_smooth_radius;
113 	gint terrace_wrap;
114 	// Artifact removal
115 	gint terrace_artifact_radius;
116 	GtkObject *adj_terrace_artifact_radius;
117 	// Flag controlling if we apply smooth or artifact removal
118 	gboolean terrace_apply_postprocess;
119 	GtkWidget *terrace_accept;
120 
121 // Threshold (cut off)
122 	GtkWidget *threshold_dialog;
123 	GtkObject *adj_threshold_min;
124 	hf_type threshold_min;
125 	GtkObject *adj_threshold_max;
126 	hf_type threshold_max;
127 	GtkObject *adj_threshold_percent;
128 	gint threshold_percent;
129 	GtkWidget *threshold_accept;
130 
131 // Revert
132 	GtkWidget *revert_dialog;
133 
134 // Cityscape
135 	GtkWidget *city_dialog;
136 	GtkObject *adj_skyscraper_width;
137 	gint skyscraper_width;
138 	GtkObject *adj_skyscraper_width_var;
139 	gint skyscraper_width_var;	// In %, upper boundary of random skyscraper width var.
140 	GtkObject *adj_streets_width;
141 	gint streets_width;		// In % of skyscrapers width, from 0 to 50
142 	GtkWidget *cityscape_accept;
143 	merge_dialog_struct *cityscape_merge;
144 
145 // Precompiled waves
146 	shape_type* wav_shapes[NBWAVES];
147 
148 // Linear & circular waves
149 	GtkWidget *wav_dialog;		// A frame containing a notebook with nb_lin_wav pages
150 					// plus control buttons (new / delete / reset...)
151 	GtkNotebook *wav_notebook;	// The child notebook
152 	gint nb_wav;
153 	GList *wav_pages;		// A list of wave_page_struct
154 	GList *wav_data;			// A list of wave_struct
155 	GtkWidget *wav_accept;
156 	gboolean wav_direct;
157 	gboolean wav_to_calc;	// FALSE if the amplitude widgets must be inactivated
158 						// Then we are committing the changes and
159 						// we don't want the callbacks to be reexecuted
160 
161 // Shape filter
162 	filter_dialog_struct *fd_struct;
163 	GtkWidget *filter_accept;
164 // Noise
165 	GtkWidget *noise_dialog;
166 	GtkWidget *noise_accept;
167 	GtkObject *adj_noise_level;
168 	gint noise_level;
169 	gint noise_merge;
170 	gpointer *hf_noise;	// hf_wrapper_struct *
171 	hf_struct_type *noise_to_apply;
172 
173 // Stretch-compress
174 	GtkWidget *stretch_dialog;
175 	GtkWidget *stretch_accept;
176 
177 // Hexagonal quantization (Giant Causeway)
178 	GtkWidget *hexagon_dialog;
179 	gint hexagon_radius;
180 	GtkObject *adj_hexagon_radius;
181 	gint hexagon_border;
182 	GtkObject *adj_hexagon_border;
183 	// Smooth parameters, applied on the result
184 	gint hexagon_smooth_radius;
185 	GtkObject *adj_hexagon_smooth_radius;
186 	gboolean hexagon_apply_postprocess;
187 	merge_dialog_struct *hexagon_merge;
188 	GtkWidget *hexagon_accept;
189 
190 // Mirrors
191 	GtkWidget *mirror_horizontal_dialog;
192 	GtkWidget *mirror_vertical_dialog;
193 
194 // Generic merge
195 	// Merge struct. containing operation (+,*,.-...) and parameters
196 	GtkWidget *merge_dialog;
197 	merge_dialog_struct *merge;
198 	GtkWidget *merge_accept;
199 	hf_struct_type *hf_to_merge;
200 	gboolean merge_scaled;
201 	hf_struct_type *hf_to_merge_scaled;
202 	GtkWidget *merging_image_frame;
203 	img_listbox_struct *merge_listbox;
204 //	gpointer hfw_merge_display;
205 	view_struct *merge_preview;
206 
207 // Mathematical transformations (power, log, etc.)
208 	GtkWidget *math_fn_dialog;
209 	GtkWidget *math_fn_accept;
210 	gint math_fn;
211 	gdouble math_fn_param;
212 	GtkObject *adj_math_fn;
213 
214 // Lift edges (for instance, for emulating drying mud)
215 
216 	GtkWidget *lift_edges_dialog;
217 	GtkWidget *lift_edges_accept;
218 	gint lift_edges_radius;
219 	GtkObject *adj_lift_edges_radius;
220 	gint lift_edges_level;
221 	GtkObject *adj_lift_edges_level;
222 	GtkWidget *lift_edges_level_dialog;
223 	gint lift_edges_wrap;
224 	gboolean lift_edges_merge_done;
225 	gboolean lift_edges_use_black_point;
226 
227 // Crack networks
228 
229 	voronoi_struct *voronoi;
230 	voronoi_dialog_struct *voronoi_dialog;
231 
232 // Structures for erosion processes
233 
234 	rain_erosion_struct *rain_erosion;
235 	rain_erosion_dialog_struct *rain_erosion_dialog;
236 
237 	gravity_struct *gravity;
238 	gravity_dialog_struct *gravity_dialog;
239 
240 	oriented_gravity_struct *oriented_gravity;
241 	oriented_gravity_dialog_struct *oriented_gravity_dialog;
242 
243 	gravity_struct *crests;
244 	gravity_dialog_struct *crests_dialog;
245 
246 	whimsical_erosion_struct *whimsical_erosion;
247 	whimsical_erosion_dialog_struct *whimsical_erosion_dialog;
248 
249 	craters_erosion_struct *craters_erosion;
250 	craters_erosion_dialog_struct *craters_erosion_dialog;
251 
252 // Wind (ripples, dunes)
253 
254 	wind_dialog_struct *ripples_dialog;
255 	wind_struct *ripples;
256 
257 	wind_dialog_struct *dunes_dialog;
258 	wind_struct *dunes;
259 
260 } img_dialog_struct;
261 
262 img_dialog_struct *img_struct_new(GtkWidget *img_dialog, gpointer parent_data);
263 
264 void img_dialog_free(img_dialog_struct *img);
265 
266 GtkWidget* img_process_dialog_new (GtkWidget *window, GtkTooltips *tooltips, gpointer);
267 
268 GtkWidget *br_contr_dialog_new(img_dialog_struct *img, gpointer data) ;
269 
270 void brightness_contrast_callb(GtkWidget *wdg, gpointer data);
271 // void contrast_callb(GtkWidget *wdg, gpointer data);
272 void smooth_callb(GtkWidget *wdg, gpointer data);
273 void sharpen_callb(GtkWidget *wdg, gpointer data);
274 void terrace_callb(GtkWidget *wdg, gpointer data);
275 void threshold_callb(GtkWidget *wdg, gpointer data);
276 void revert_callb(GtkWidget *wdg, gpointer data);
277 void city_callb(GtkWidget *wdg, gpointer data);
278 void filter_callb(GtkWidget *wdg, gpointer data);
279 void noise_callb(GtkWidget *wdg, gpointer data);
280 void dilate_callb(GtkWidget *wdg, gpointer data);
281 void mirror_vertical_callb(GtkWidget *wdg, gpointer data);
282 void mirror_horizontal_callb(GtkWidget *wdg, gpointer data);
283 void merge_callb(GtkWidget *wdg, gpointer data);
284 void math_fn_callb(GtkWidget *wdg, gpointer data);
285 void hexagon_callb(GtkWidget *wdg, gpointer data);
286 void lift_edges_callb(GtkWidget *wdg, gpointer data);
287 
288 //	These prototypes should have been included in waves_dialog.h
289 //	but this gives circular definitions (since waves_dialog.h would require img_process_dialog.h)
290 //	Some design problem to think about in the future...
291 void wave_page_new (	img_dialog_struct *img,
292 				gint axis,
293 				GtkWidget *tools_window,
294 				GtkTooltips *tooltips,
295 				gpointer data);
296 void set_wave_defaults( img_dialog_struct *img);
297 
298 void accept_callb(GtkWidget *wdg, gpointer data);
299 void reset_callb(GtkWidget *wdg, gpointer data);
300 GtkWidget *reset_accept_buttons_new (gpointer data, GtkWidget **accept_slot);
301 GtkWidget *apply_repeat_buttons_new (gpointer data,
302 	void (*apply_fn) (GtkWidget *, gpointer),
303 	void (*repeat_fn) (GtkWidget *, gpointer) );
304 void set_br_contr_defaults(img_dialog_struct *img) ;
305 
306 #endif // _IMGPROCESS_DIALOG
307 
308