119 return _(
"split-toning (legacy)");
140 "create a linear toning effect between them up to a pivot."),
142 _(
"linear, RGB, scene-referred"),
144 _(
"linear, RGB, scene-referred"));
156 _(
"authentic sepia"), self->
op, self->version(),
165 _(
"authentic cyanotype"), self->
op, self->version(),
174 _(
"authentic platinotype"), self->
op, self->version(),
183 _(
"chocolate brown"), self->
op, self->version(),
197 const float compress = (data->
compress / 110.0) / 2.0;
199 const float *
const restrict in =
DT_IS_ALIGNED((
float*)ivoid);
201 const int npixels = roi_out->
width * roi_out->
height;
203 for(
int k = 0;
k < 4 * npixels;
k += 4)
207 if(l < data->balance - compress)
215 const float ra =
CLIP((data->
balance - compress - l) * 2.0f);
216 const float la = (1.0f - ra);
219 out[
k+c] =
CLIP(in[
k+c] * la + mixrgb[c] * ra);
221 else if(l > data->
balance + compress)
226 const float ra =
CLIP((l - (data->
balance + compress)) * 2.0f);
227 const float la = (1.0f - ra);
230 out[
k+c] =
CLIP(in[
k+c] * la + mixrgb[c] * ra);
247 GdkRGBA
color = (GdkRGBA){.red =
rgb[0], .green =
rgb[1], .blue =
rgb[2], .alpha = 1.0 };
248 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(colorpicker), &
color);
269 if(highlight_hue != -1)
275 gtk_widget_queue_draw(GTK_WIDGET(slider));
283 if(w ==
g->shadow_sat_gslider || w ==
g->shadow_hue_gslider)
287 if(w ==
g->shadow_hue_gslider)
292 gtk_widget_queue_draw(GTK_WIDGET(
g->shadow_sat_gslider));
295 else if(w ==
g->highlight_sat_gslider || w ==
g->highlight_hue_gslider)
299 if(w ==
g->highlight_hue_gslider)
304 gtk_widget_queue_draw(GTK_WIDGET(
g->highlight_sat_gslider));
319 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &c);
325 if (GTK_WIDGET(widget) ==
g->shadow_colorpick)
338 gtk_widget_queue_draw(GTK_WIDGET(
g->balance_scale));
348 float *p_hue, *p_saturation;
352 float H = .0f,
S = .0f,
L = .0f;
355 if(picker ==
g->highlight_hue_gslider)
357 p_hue = &
p->highlight_hue;
358 p_saturation = &
p->highlight_saturation;
359 hue =
g->highlight_hue_gslider;
360 sat =
g->highlight_sat_gslider;
361 colorpicker =
g->highlight_colorpick;
366 p_hue = &
p->shadow_hue;
367 p_saturation = &
p->shadow_saturation;
368 hue =
g->shadow_hue_gslider;
369 sat =
g->shadow_sat_gslider;
370 colorpicker =
g->shadow_colorpick;
374 if(fabsf(*p_hue -
H) < 0.0001f && fabsf(*p_saturation -
S) < 0.0001f)
390 gtk_widget_queue_draw(GTK_WIDGET(
g->balance_scale));
401 d->shadow_hue =
p->shadow_hue;
402 d->highlight_hue =
p->highlight_hue;
403 d->shadow_saturation =
p->shadow_saturation;
404 d->highlight_saturation =
p->highlight_saturation;
405 d->balance =
p->balance;
406 d->compress =
p->compress;
457 gtk_widget_set_tooltip_text(hue, _(
"select the hue tone"));
463 gtk_widget_set_tooltip_text(saturation, _(
"select the saturation tone"));
465 *picker = gtk_color_button_new();
466 gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(*picker),
FALSE);
467 gtk_color_button_set_title(GTK_COLOR_BUTTON(*picker), _(
"select tone color"));
468 g_signal_connect(G_OBJECT(*picker),
"color-set", G_CALLBACK(
colorpick_callback), self);
471 gtk_box_pack_start(GTK_BOX(hbox), slider_box,
TRUE,
TRUE, 0);
472 gtk_box_pack_end(GTK_BOX(hbox), *picker,
FALSE,
FALSE, 0);
495 gui_init_section(self, N_(
"shadows"), shadows_box,
g->shadow_hue_gslider,
g->shadow_sat_gslider, &
g->shadow_colorpick,
TRUE);
497 gui_init_section(self, N_(
"highlights"), highlights_box,
g->highlight_hue_gslider,
g->highlight_sat_gslider, &
g->highlight_colorpick,
FALSE);
509 gtk_widget_set_tooltip_text(
g->balance_scale, _(
"the balance of center of split-toning"));
513 gtk_widget_set_tooltip_text(
g->compress_scale, _(
"compress the effect on highlights/shadows and\npreserve mid-tones"));
void dt_bauhaus_slider_set_digits(GtkWidget *widget, int val)
void dt_bauhaus_slider_set_stop(GtkWidget *widget, float stop, float r, float g, float b)
void dt_bauhaus_slider_set_feedback(GtkWidget *widget, int feedback)
void dt_bauhaus_slider_set_offset(GtkWidget *widget, float offset)
void dt_bauhaus_slider_set(GtkWidget *widget, float pos)
void dt_bauhaus_widget_set_label(GtkWidget *widget, const char *label)
void dt_bauhaus_slider_set_format(GtkWidget *widget, const char *format)
void dt_bauhaus_slider_set_factor(GtkWidget *widget, float factor)
GtkWidget * dt_color_picker_new(dt_iop_module_t *module, dt_iop_color_picker_kind_t kind, GtkWidget *w)
void rgb2hsl(const dt_aligned_pixel_t rgb, float *h, float *s, float *l)
Convert RGB to HSL. Common helper used by iop modules.
void hsl2rgb(dt_aligned_pixel_t rgb, float h, float s, float l)
Convert HSL back to RGB. Common helper used by iop modules.
The colour-profile module's API: which profiles exist, and how to apply one.
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
static dt_aligned_pixel_t rgb
const dt_colormatrix_t dt_aligned_pixel_t out
#define dt_database_start_transaction()
#define dt_database_release_transaction()
#define dt_dev_add_history_item(dev, module, enable, redraw)
void dt_gui_presets_add_generic(const char *name, dt_dev_operation_t op, const int32_t version, const void *params, const int32_t params_size, const int32_t enabled)
const char ** dt_iop_set_description(dt_iop_module_t *module, const char *main_text, const char *purpose, const char *input, const char *process, const char *output)
@ IOP_FLAGS_INCLUDE_IN_STYLES
@ IOP_FLAGS_SUPPORTS_BLENDING
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
static dt_iop_gui_data_t * dt_iop_gui_data(const struct dt_iop_module_t *m)
The module's GUI data blob, NULL-safe for headless callers: IOP process() implementations read it for...
#define IOP_GUI_ALLOC(module)
GtkWidget * dt_ui_section_label_new(const gchar *str)
float *const restrict const size_t k
#define dt_free_align(ptr)
Release memory from dt_alloc_align() and set ptr to NULL.
static void * dt_calloc_align(size_t size)
dt_alloc_align() followed by a zero fill.
#define DT_IS_ALIGNED(x)
Promise the compiler that x is already cacheline-aligned, and return it.
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
DT_MODULE() for a module whose params struct is introspected.
#define __OMP_PARALLEL_FOR__(...)
static void copy_pixel(float *const __restrict__ out, const float *const __restrict__ in)
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
#define for_each_channel(_var,...)
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)
const char ** description(struct dt_iop_module_t *self)
__DT_CLONE_TARGETS__ int process(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
static void update_colorpicker_color(GtkWidget *colorpicker, float hue, float sat)
static void colorpick_callback(GtkColorButton *widget, dt_iop_module_t *self)
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void gui_update(struct dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
void gui_init(struct dt_iop_module_t *self)
void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous)
static void update_balance_slider_colors(GtkWidget *slider, float shadow_hue, float highlight_hue)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void init_presets(dt_iop_module_so_t *self)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void gui_init_section(struct dt_iop_module_t *self, char *section, GtkWidget *slider_box, GtkWidget *hue, GtkWidget *saturation, GtkWidget **picker, gboolean top)
static void update_saturation_slider_end_color(GtkWidget *slider, float hue)
void color_picker_apply(dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
struct dt_iop_module_t *void * data
struct dt_iop_module_gui_t * gui
struct dt_develop_t * dev
dt_aligned_pixel_t picked_color
Region of interest passed through the pixelpipe.
float highlight_saturation
GtkWidget * shadow_sat_gslider
GtkWidget * highlight_sat_gslider
GtkWidget * highlight_hue_gslider
GtkWidget * balance_scale
GtkWidget * shadow_hue_gslider
GtkWidget * compress_scale
GtkWidget * shadow_colorpick
GtkWidget * highlight_colorpick
float highlight_saturation
#define __DT_CLONE_TARGETS__