2
This file is part of darktable,
3
copyright (c) 2009--2010 johannes hanika.
5
darktable is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
10
darktable is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with darktable. If not, see <http://www.gnu.org/licenses/>.
25
#include "iop/tonecurve.h"
26
#include "gui/histogram.h"
27
#include "gui/presets.h"
28
#include "develop/develop.h"
29
#include "control/control.h"
31
#include "common/opencl.h"
33
#define DT_GUI_CURVE_EDITOR_INSET 5
34
#define DT_GUI_CURVE_INFL .3f
40
return _("tone curve");
47
return IOP_GROUP_CORRECT;
53
process_cl (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
55
dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)piece->data;
56
dt_iop_tonecurve_global_data_t *gd = (dt_iop_tonecurve_global_data_t *)self->data;
59
const int devid = piece->pipe->devid;
60
size_t sizes[] = {roi_in->width, roi_in->height, 1};
61
cl_mem dev_m = dt_opencl_copy_host_to_device(d->table, 256, 256, devid, sizeof(float));
62
dt_opencl_set_kernel_arg(darktable.opencl, devid, gd->kernel_tonecurve, 0, sizeof(cl_mem), (void *)&dev_in);
63
dt_opencl_set_kernel_arg(darktable.opencl, devid, gd->kernel_tonecurve, 1, sizeof(cl_mem), (void *)&dev_out);
64
dt_opencl_set_kernel_arg(darktable.opencl, devid, gd->kernel_tonecurve, 2, sizeof(cl_mem), (void *)&dev_m);
65
err = dt_opencl_enqueue_kernel_2d(darktable.opencl, devid, gd->kernel_tonecurve, sizes);
66
if(err != CL_SUCCESS) fprintf(stderr, "couldn't enqueue tonecurve kernel! %d\n", err);
67
clReleaseMemObject(dev_m);
71
void process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, void *i, void *o, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out)
73
const int ch = piece->colors;
74
dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)(piece->data);
76
#pragma omp parallel for default(none) shared(roi_out, i, o, d) schedule(static)
78
for(int k=0; k<roi_out->height; k++)
80
float *in = ((float *)i) + k*ch*roi_out->width;
81
float *out = ((float *)o) + k*ch*roi_out->width;
82
for (int j=0; j<roi_out->width; j++,in+=ch,out+=ch)
84
// in Lab: correct compressed Luminance for saturation:
85
const int t = CLAMP((int)(in[0]/100.0*0xfffful), 0, 0xffff);
89
out[1] = in[1] * out[0]/in[0];
90
out[2] = in[2] * out[0]/in[0];
101
void init_presets (dt_iop_module_so_t *self)
103
dt_iop_tonecurve_params_t p;
104
p.tonecurve_preset = 0;
106
float linear[6] = {0.0, 0.08, 0.4, 0.6, 0.92, 1.0};
107
for(int k=0; k<6; k++) p.tonecurve_x[k] = linear[k];
108
for(int k=0; k<6; k++) p.tonecurve_y[k] = linear[k];
109
dt_gui_presets_add_generic(_("linear"), self->op, &p, sizeof(p), 1);
111
for(int k=0; k<6; k++) p.tonecurve_x[k] = linear[k];
112
for(int k=0; k<6; k++) p.tonecurve_y[k] = linear[k];
113
p.tonecurve_y[1] -= 0.03;
114
p.tonecurve_y[4] += 0.03;
115
p.tonecurve_y[2] -= 0.03;
116
p.tonecurve_y[3] += 0.03;
117
for(int k=1; k<5; k++) p.tonecurve_y[k] = powf(p.tonecurve_y[k], 2.2f);
118
for(int k=1; k<5; k++) p.tonecurve_x[k] = powf(p.tonecurve_x[k], 2.2f);
119
dt_gui_presets_add_generic(_("med contrast"), self->op, &p, sizeof(p), 1);
121
for(int k=0; k<6; k++) p.tonecurve_x[k] = linear[k];
122
for(int k=0; k<6; k++) p.tonecurve_y[k] = linear[k];
123
p.tonecurve_y[1] -= 0.06;
124
p.tonecurve_y[4] += 0.06;
125
p.tonecurve_y[2] -= 0.10;
126
p.tonecurve_y[3] += 0.10;
127
for(int k=1; k<5; k++) p.tonecurve_y[k] = powf(p.tonecurve_y[k], 2.2f);
128
for(int k=1; k<5; k++) p.tonecurve_x[k] = powf(p.tonecurve_x[k], 2.2f);
129
dt_gui_presets_add_generic(_("high contrast"), self->op, &p, sizeof(p), 1);
132
void commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
134
// pull in new params to gegl
135
dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)(piece->data);
136
dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)p1;
138
for(int k=0; k<6; k++) dt_draw_curve_set_point(d->curve, k, p->tonecurve_x[k], p->tonecurve_y[k]);
139
gegl_node_set(piece->input, "curve", d->curve, NULL);
141
for(int k=0; k<6; k++)
142
dt_draw_curve_set_point(d->curve, k, p->tonecurve_x[k], p->tonecurve_y[k]);
143
dt_draw_curve_calc_values(d->curve, 0.0f, 1.0f, 0x10000, NULL, d->table);
144
for(int k=0; k<0x10000; k++) d->table[k] *= 100.0f;
145
// for(int k=0;k<0x10000;k++)
146
// // d->table[k] = (uint16_t)(0xffff*dt_draw_curve_calc_value(d->curve, (1.0/0x10000)*k));
147
// d->table[k] = 100.0*dt_draw_curve_calc_value(d->curve, (1.0/0x10000)*k);
151
void init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
153
// create part of the gegl pipeline
154
dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)malloc(sizeof(dt_iop_tonecurve_data_t));
155
dt_iop_tonecurve_params_t *default_params = (dt_iop_tonecurve_params_t *)self->default_params;
156
piece->data = (void *)d;
157
d->curve = dt_draw_curve_new(0.0, 1.0, CUBIC_SPLINE);
158
for(int k=0; k<6; k++) (void)dt_draw_curve_add_point(d->curve, default_params->tonecurve_x[k], default_params->tonecurve_y[k]);
160
piece->input = piece->output = gegl_node_new_child(pipe->gegl, "operation", "gegl:dt-contrast-curve", "sampling-points", 65535, "curve", d->curve, NULL);
162
for(int k=0; k<0x10000; k++) d->table[k] = 100.0f*k/0x10000; // identity
166
void cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
168
// clean up everything again.
170
// dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)(piece->data);
171
(void)gegl_node_remove_child(pipe->gegl, piece->input);
172
// (void)gegl_node_remove_child(pipe->gegl, d->node);
173
// (void)gegl_node_remove_child(pipe->gegl, piece->output);
175
dt_iop_tonecurve_data_t *d = (dt_iop_tonecurve_data_t *)(piece->data);
176
dt_draw_curve_destroy(d->curve);
180
void gui_update(struct dt_iop_module_t *self)
182
// nothing to do, gui curve is read directly from params during expose event.
183
gtk_widget_queue_draw(self->widget);
186
void init(dt_iop_module_t *module)
188
module->params = malloc(sizeof(dt_iop_tonecurve_params_t));
189
module->default_params = malloc(sizeof(dt_iop_tonecurve_params_t));
190
module->default_enabled = 0;
191
module->priority = 700;
192
module->params_size = sizeof(dt_iop_tonecurve_params_t);
193
module->gui_data = NULL;
194
dt_iop_tonecurve_params_t tmp = (dt_iop_tonecurve_params_t)
197
0.0, 0.08, 0.4, 0.6, 0.92, 1.0
199
{0.0, 0.08, 0.4, 0.6, 0.92, 1.0},
202
memcpy(module->params, &tmp, sizeof(dt_iop_tonecurve_params_t));
203
memcpy(module->default_params, &tmp, sizeof(dt_iop_tonecurve_params_t));
206
void init_global(dt_iop_module_so_t *module)
208
const int program = 2; // basic.cl, from programs.conf
209
dt_iop_tonecurve_global_data_t *gd = (dt_iop_tonecurve_global_data_t *)malloc(sizeof(dt_iop_tonecurve_global_data_t));
211
gd->kernel_tonecurve = dt_opencl_create_kernel(darktable.opencl, program, "tonecurve");
214
void cleanup_global(dt_iop_module_so_t *module)
216
dt_iop_tonecurve_global_data_t *gd = (dt_iop_tonecurve_global_data_t *)module->data;
217
dt_opencl_free_kernel(darktable.opencl, gd->kernel_tonecurve);
222
void cleanup(dt_iop_module_t *module)
224
free(module->gui_data);
225
module->gui_data = NULL;
226
free(module->params);
227
module->params = NULL;
230
void gui_init(struct dt_iop_module_t *self)
232
self->gui_data = malloc(sizeof(dt_iop_tonecurve_gui_data_t));
233
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
234
dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params;
236
c->minmax_curve = dt_draw_curve_new(0.0, 1.0, CUBIC_SPLINE);
237
for(int k=0; k<6; k++) (void)dt_draw_curve_add_point(c->minmax_curve, p->tonecurve_x[k], p->tonecurve_y[k]);
238
c->mouse_x = c->mouse_y = -1.0;
240
c->selected_offset = c->selected_y = c->selected_min = c->selected_max = 0.0;
243
self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, 5));
244
c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
245
GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
246
gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
247
gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(c->area));
248
// gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(c->area), TRUE, TRUE, 0);
249
gtk_drawing_area_size(c->area, 258, 258);
251
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
252
g_signal_connect (G_OBJECT (c->area), "expose-event",
253
G_CALLBACK (dt_iop_tonecurve_expose), self);
254
g_signal_connect (G_OBJECT (c->area), "button-press-event",
255
G_CALLBACK (dt_iop_tonecurve_button_press), self);
256
g_signal_connect (G_OBJECT (c->area), "button-release-event",
257
G_CALLBACK (dt_iop_tonecurve_button_release), self);
258
g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
259
G_CALLBACK (dt_iop_tonecurve_motion_notify), self);
260
g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
261
G_CALLBACK (dt_iop_tonecurve_leave_notify), self);
264
void gui_cleanup(struct dt_iop_module_t *self)
266
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
267
dt_draw_curve_destroy(c->minmax_curve);
268
free(self->gui_data);
269
self->gui_data = NULL;
273
static gboolean dt_iop_tonecurve_leave_notify(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
275
dt_iop_module_t *self = (dt_iop_module_t *)user_data;
276
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
277
c->mouse_x = c->mouse_y = -1.0;
278
gtk_widget_queue_draw(widget);
282
static gboolean dt_iop_tonecurve_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
284
dt_iop_module_t *self = (dt_iop_module_t *)user_data;
285
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
286
dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params;
287
for(int k=0; k<6; k++) dt_draw_curve_set_point(c->minmax_curve, k, p->tonecurve_x[k], p->tonecurve_y[k]);
288
const int inset = DT_GUI_CURVE_EDITOR_INSET;
289
int width = widget->allocation.width, height = widget->allocation.height;
290
cairo_surface_t *cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
291
cairo_t *cr = cairo_create(cst);
293
cairo_set_source_rgb (cr, .2, .2, .2);
296
cairo_translate(cr, inset, inset);
301
// draw shadow around
303
for(int k=0; k<inset; k++)
305
cairo_rectangle(cr, -k, -k, width + 2*k, height + 2*k);
306
cairo_set_source_rgba(cr, 0, 0, 0, alpha);
311
cairo_set_line_width(cr, 1.0);
312
cairo_set_source_rgb (cr, .1, .1, .1);
313
cairo_rectangle(cr, 0, 0, width, height);
317
cairo_set_source_rgb (cr, .3, .3, .3);
318
cairo_rectangle(cr, 0, 0, width, height);
321
if(c->mouse_y > 0 || c->dragging)
324
oldx1 = p->tonecurve_x[c->selected];
325
oldy1 = p->tonecurve_y[c->selected];
327
if(c->selected == 0) dt_draw_curve_set_point(c->minmax_curve, 1, p->tonecurve_x[1], fmaxf(c->selected_min, p->tonecurve_y[1]));
328
if(c->selected == 2) dt_draw_curve_set_point(c->minmax_curve, 1, p->tonecurve_x[1], fminf(c->selected_min, fmaxf(0.0, p->tonecurve_y[1] + DT_GUI_CURVE_INFL*(c->selected_min - oldy1))));
329
if(c->selected == 3) dt_draw_curve_set_point(c->minmax_curve, 4, p->tonecurve_x[4], fmaxf(c->selected_min, fminf(1.0, p->tonecurve_y[4] + DT_GUI_CURVE_INFL*(c->selected_min - oldy1))));
330
if(c->selected == 5) dt_draw_curve_set_point(c->minmax_curve, 4, p->tonecurve_x[4], fminf(c->selected_min, p->tonecurve_y[4]));
331
dt_draw_curve_set_point(c->minmax_curve, c->selected, oldx1, c->selected_min);
332
dt_draw_curve_calc_values(c->minmax_curve, 0.0, 1.0, DT_IOP_TONECURVE_RES, c->draw_min_xs, c->draw_min_ys);
334
if(c->selected == 0) dt_draw_curve_set_point(c->minmax_curve, 1, p->tonecurve_x[1], fmaxf(c->selected_max, p->tonecurve_y[1]));
335
if(c->selected == 2) dt_draw_curve_set_point(c->minmax_curve, 1, p->tonecurve_x[1], fminf(c->selected_max, fmaxf(0.0, p->tonecurve_y[1] + DT_GUI_CURVE_INFL*(c->selected_max - oldy1))));
336
if(c->selected == 3) dt_draw_curve_set_point(c->minmax_curve, 4, p->tonecurve_x[4], fmaxf(c->selected_max, fminf(1.0, p->tonecurve_y[4] + DT_GUI_CURVE_INFL*(c->selected_max - oldy1))));
337
if(c->selected == 5) dt_draw_curve_set_point(c->minmax_curve, 4, p->tonecurve_x[4], fminf(c->selected_max, p->tonecurve_y[4]));
338
dt_draw_curve_set_point (c->minmax_curve, c->selected, oldx1, c->selected_max);
339
dt_draw_curve_calc_values(c->minmax_curve, 0.0, 1.0, DT_IOP_TONECURVE_RES, c->draw_max_xs, c->draw_max_ys);
342
for(int k=0; k<6; k++) dt_draw_curve_set_point(c->minmax_curve, k, p->tonecurve_x[k], p->tonecurve_y[k]);
343
dt_draw_curve_calc_values(c->minmax_curve, 0.0, 1.0, DT_IOP_TONECURVE_RES, c->draw_xs, c->draw_ys);
346
cairo_set_line_width(cr, .4);
347
cairo_set_source_rgb (cr, .1, .1, .1);
348
dt_draw_grid(cr, 4, 0, 0, width, height);
351
cairo_set_line_width(cr, 1.);
352
cairo_set_source_rgb(cr, 0.6, 0.6, 0.6);
353
const float arrw = 7.0f;
354
for(int k=1; k<5; k++)
356
cairo_move_to(cr, width*p->tonecurve_x[k], height+inset-1);
357
cairo_rel_line_to(cr, -arrw*.5f, 0);
358
cairo_rel_line_to(cr, arrw*.5f, -arrw);
359
cairo_rel_line_to(cr, arrw*.5f, arrw);
360
cairo_close_path(cr);
361
if(c->x_move == k) cairo_fill(cr);
362
else cairo_stroke(cr);
365
// draw selected cursor
366
cairo_set_line_width(cr, 1.);
367
cairo_translate(cr, 0, height);
369
// draw lum h istogram in background
370
dt_develop_t *dev = darktable.develop;
371
float *hist, hist_max;
372
hist = dev->histogram_pre;
373
hist_max = dev->histogram_pre_max;
377
cairo_scale(cr, width/63.0, -(height-5)/(float)hist_max);
378
cairo_set_source_rgba(cr, .2, .2, .2, 0.5);
379
dt_gui_histogram_draw_8(cr, hist, 3);
383
if(c->mouse_y > 0 || c->dragging)
385
// draw min/max, if selected
386
cairo_set_source_rgba(cr, .6, .6, .6, .5);
387
cairo_move_to(cr, 0, - height*c->draw_min_ys[0]);
388
for(int k=1; k<DT_IOP_TONECURVE_RES; k++) cairo_line_to(cr, k*width/(DT_IOP_TONECURVE_RES-1.0), - height*c->draw_min_ys[k]);
389
cairo_line_to(cr, width, - height*c->draw_min_ys[DT_IOP_TONECURVE_RES-1]);
390
cairo_line_to(cr, width, - height*c->draw_max_ys[DT_IOP_TONECURVE_RES-1]);
391
for(int k=DT_IOP_TONECURVE_RES-2; k>=0; k--) cairo_line_to(cr, k*width/(DT_IOP_TONECURVE_RES-1.0), - height*c->draw_max_ys[k]);
392
cairo_close_path(cr);
394
// draw mouse focus circle
395
cairo_set_source_rgb(cr, .9, .9, .9);
396
const float pos = MAX(0, (DT_IOP_TONECURVE_RES-1) * c->mouse_x/(float)width - 1);
398
const float f = k - pos;
399
if(k >= DT_IOP_TONECURVE_RES-1) k = DT_IOP_TONECURVE_RES - 2;
400
float ht = -height*(f*c->draw_ys[k] + (1-f)*c->draw_ys[k+1]);
401
cairo_arc(cr, c->mouse_x, ht, 4, 0, 2.*M_PI);
406
cairo_set_line_width(cr, 2.);
407
cairo_set_source_rgb(cr, .9, .9, .9);
408
// cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
409
cairo_move_to(cr, 0, -height*c->draw_ys[0]);
410
for(int k=1; k<DT_IOP_TONECURVE_RES; k++) cairo_line_to(cr, k*width/(DT_IOP_TONECURVE_RES-1.0), - height*c->draw_ys[k]);
414
cairo_t *cr_pixmap = gdk_cairo_create(gtk_widget_get_window(widget));
415
cairo_set_source_surface (cr_pixmap, cst, 0, 0);
416
cairo_paint(cr_pixmap);
417
cairo_destroy(cr_pixmap);
418
cairo_surface_destroy(cst);
422
static gboolean dt_iop_tonecurve_motion_notify(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
424
dt_iop_module_t *self = (dt_iop_module_t *)user_data;
425
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
426
dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params;
427
const int inset = DT_GUI_CURVE_EDITOR_INSET;
428
int height = widget->allocation.height - 2*inset, width = widget->allocation.width - 2*inset;
429
if(!c->dragging) c->mouse_x = CLAMP(event->x - inset, 0, width);
430
c->mouse_y = CLAMP(event->y - inset, 0, height);
436
const float mx = CLAMP(event->x - inset, 0, width)/(float)width;
437
if(c->x_move > 0 && c->x_move < 6-1)
439
const float minx = p->tonecurve_x[c->x_move-1] + 0.001f;
440
const float maxx = p->tonecurve_x[c->x_move+1] - 0.001f;
441
p->tonecurve_x[c->x_move] = fminf(maxx, fmaxf(minx, mx));
446
float f = c->selected_y - (c->mouse_y-c->selected_offset)/height;
447
f = fmaxf(c->selected_min, fminf(c->selected_max, f));
448
if(c->selected == 0) p->tonecurve_y[1] = fmaxf(f, p->tonecurve_y[1]);
449
if(c->selected == 2) p->tonecurve_y[1] = fminf(f, fmaxf(0.0, p->tonecurve_y[1] + DT_GUI_CURVE_INFL*(f - p->tonecurve_y[2])));
450
if(c->selected == 3) p->tonecurve_y[4] = fmaxf(f, fminf(1.0, p->tonecurve_y[4] + DT_GUI_CURVE_INFL*(f - p->tonecurve_y[3])));
451
if(c->selected == 5) p->tonecurve_y[4] = fminf(f, p->tonecurve_y[4]);
452
p->tonecurve_y[c->selected] = f;
454
dt_dev_add_history_item(darktable.develop, self, TRUE);
458
if(event->y > height)
461
const float mx = CLAMP(event->x - inset, 0, width)/(float)width;
462
float dist = fabsf(p->tonecurve_x[1] - mx);
463
for(int k=2; k<5; k++)
465
float d2 = fabsf(p->tonecurve_x[k] - mx);
477
float pos = (event->x - inset)/width;
480
for(int k=0; k<6; k++)
482
float dist = (pos - p->tonecurve_x[k]);
490
c->selected = nearest;
491
c->selected_y = p->tonecurve_y[c->selected];
492
c->selected_offset = c->mouse_y;
493
const float f = 0.8f;
496
c->selected_min = 0.0f;
497
c->selected_max = 0.2f;
499
else if(c->selected == 5)
501
c->selected_min = 0.8f;
502
c->selected_max = 1.0f;
506
c->selected_min = fmaxf(c->selected_y - 0.2f, (1.-f)*c->selected_y + f*p->tonecurve_y[c->selected-1]);
507
c->selected_max = fminf(c->selected_y + 0.2f, (1.-f)*c->selected_y + f*p->tonecurve_y[c->selected+1]);
509
if(c->selected == 1) c->selected_max *= 0.7;
510
if(c->selected == 4) c->selected_min = 1.0 - 0.7*(1.0 - c->selected_min);
512
gtk_widget_queue_draw(widget);
515
gdk_window_get_pointer(event->window, &x, &y, NULL);
519
static gboolean dt_iop_tonecurve_button_press(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
522
if(event->button == 1)
524
dt_iop_module_t *self = (dt_iop_module_t *)user_data;
525
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
532
static gboolean dt_iop_tonecurve_button_release(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
534
if(event->button == 1)
536
dt_iop_module_t *self = (dt_iop_module_t *)user_data;
537
dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;