72#include <gdk/gdkkeysyms.h>
82#define DT_IOP_BORDERS_ASPECT_COUNT 12
83#define DT_IOP_BORDERS_ASPECT_IMAGE_IDX 0
84#define DT_IOP_BORDERS_ASPECT_CONSTANT_IDX 11
85#define DT_IOP_BORDERS_ASPECT_IMAGE_VALUE 0.0f
86#define DT_IOP_BORDERS_ASPECT_CONSTANT_VALUE -1.0f
87#define DT_IOP_BORDERS_ASPECT_ORIENTATION_AUTO 0
88#define DT_IOP_BORDERS_ASPECT_ORIENTATION_PORTRAIT 1
89#define DT_IOP_BORDERS_ASPECT_ORIENTATION_LANDSCAPE 2
90#define DT_IOP_BORDERS_POSITION_H_COUNT 5
91#define DT_IOP_BORDERS_POSITION_V_COUNT 5
144 void *new_params,
const int new_version)
146 if(old_version == 1 && new_version == 3)
148 typedef struct dt_iop_borders_params_v1_t
153 } dt_iop_borders_params_v1_t;
155 dt_iop_borders_params_v1_t *o = (dt_iop_borders_params_v1_t *)old_params;
160 memcpy(
n->color, o->color,
sizeof(o->color));
161 n->aspect = (o->aspect < 1) ? 1 / o->aspect : o->aspect;
165 n->size = fabsf(o->size);
166 n->max_border_size =
FALSE;
170 if(old_version == 2 && new_version == 3)
172 typedef struct dt_iop_borders_params_v2_t
176 char aspect_text[20];
185 float frame_color[3];
186 } dt_iop_borders_params_v2_t;
188 dt_iop_borders_params_v2_t *o = (dt_iop_borders_params_v2_t *)old_params;
191 memcpy(
n, o,
sizeof(
struct dt_iop_borders_params_v2_t));
192 n->max_border_size =
FALSE;
217 _(
"linear or non-linear, RGB, display-referred"),
219 _(
"linear or non-linear, RGB, display-referred"));
255 *left = (
out->width - in->
width) *
d->pos_h;
260 float *
const restrict points,
size_t points_count)
264 int border_size_l = 0, border_size_t = 0;
268 if (border_size_l == 0 && border_size_t == 0)
return 1;
270 for(
size_t i = 0;
i < points_count * 2;
i += 2)
272 points[
i] += border_size_l;
273 points[
i + 1] += border_size_t;
279 float *
const restrict points,
size_t points_count)
283 int border_size_l = 0, border_size_t = 0;
287 if (border_size_l == 0 && border_size_t == 0)
return 1;
289 for(
size_t i = 0;
i < points_count * 2;
i += 2)
291 points[
i] -= border_size_l;
292 points[
i + 1] -= border_size_t;
299 const float *
const in,
float *
const out,
const dt_iop_roi_t *
const roi_in,
307 const int border_size_t = border_tot_height *
d->pos_v;
308 const int border_size_l = border_tot_width *
d->pos_h;
309 const int border_in_x =
MAX(border_size_l - roi_out->
x, 0);
310 const int border_in_y =
MAX(border_size_t - roi_out->
y, 0);
317 for(
int j = 0; j < roi_in->
height; j++)
319 float *outb =
out + (size_t)(j + border_in_y) * roi_out->
width + border_in_x;
320 const float *inb = in + (size_t)j * roi_in->
width;
321 memcpy(outb, inb,
sizeof(
float) * roi_in->
width);
334 const float size = fabsf(
d->size);
335 if(
size == 0.0f ||
size >= 1.0f)
return;
340 if(roi_in->
width > roi_in->
height || !
d->max_border_size)
355 const float image_aspect = roi_in->
width / (float)roi_in->
height;
357 if(
aspect <= 0.0f)
return;
366 const float inv_size = 1.0f / (1.0f -
size);
367 roi_out->
width = (float)roi_in->
width * inv_size;
371 const float min_height = (float)roi_in->
height * inv_size;
372 if(roi_out->
height < min_height)
374 roi_out->
height = min_height;
398 roi_in->
x =
MAX(roi_out->
x - bw *
d->pos_h, 0);
399 roi_in->
y =
MAX(roi_out->
y - bh *
d->pos_v, 0);
401 roi_in->
width -=
MAX(bw *
d->pos_h - roi_out->
x, 0);
402 roi_in->
height -=
MAX(bh *
d->pos_v - roi_out->
y, 0);
440 for (
int i = 0;
i < npixels;
i++)
443 for (
int c = 0; c < 4; c++)
451static inline void copy_pixels(
float *
out,
const float *
const in,
const int npixels)
453 for (
int i = 0;
i < npixels;
i++)
456 for (
int c = 0; c < 4; c++)
458 out[4*
i+c] = in[4*
i+c];
476 else if (row < binfo->fl_top ||
row >= binfo->
fl_bot)
483 else if (row < binfo->image_top ||
row >= binfo->
image_bot)
527 const int border_size_t = border_tot_height *
d->pos_v;
528 const int border_size_b = border_tot_height - border_size_t;
529 const int border_size_l = border_tot_width *
d->pos_h;
530 const int border_size_r = border_tot_width - border_size_l;
531 const int border_in_x =
MAX(border_size_l - roi_out->
x, 0);
532 const int border_in_y =
MAX(border_size_t - roi_out->
y, 0);
535 const int border_min_size =
MIN(
MIN(border_size_t, border_size_b),
MIN(border_size_l, border_size_r));
536 const int frame_size = border_min_size *
d->frame_size;
538 const int b_in_x = CLAMP(border_in_x, 0, roi_out->
width - 1);
540 { .
bcolor = {
d->color[0],
d->color[1],
d->color[2], 1.0f },
541 .flcolor = {
d->frame_color[0],
d->frame_color[1],
d->frame_color[2], 1.0f },
542 .border_top = border_in_y,
543 .fl_top = border_in_y,
544 .image_top = border_in_y,
545 .border_left = b_in_x,
547 .image_left = b_in_x,
548 .image_right = b_in_x + roi_in->
width,
549 .fl_right = roi_out->
width,
550 .border_right = roi_out->
width,
551 .width = roi_out->
width,
552 .image_bot = border_in_y + roi_in->
height,
553 .fl_bot = roi_out->
height,
554 .border_bot = roi_out->
height,
555 .height = roi_out->
height,
556 .stride = roi_in->
width
560 const int image_lx = border_size_l - roi_out->
x;
561 const int image_ty = border_size_t - roi_out->
y;
562 const int frame_space = border_min_size - frame_size;
563 const int frame_offset = frame_space *
d->frame_offset;
564 const int frame_tl_in_x =
MAX(border_in_x - frame_offset, 0);
565 const int frame_tl_out_x =
MAX(frame_tl_in_x - frame_size, 0);
566 const int frame_tl_in_y =
MAX(border_in_y - frame_offset, 0);
567 const int frame_tl_out_y =
MAX(frame_tl_in_y - frame_size, 0);
569 binfo.
fl_top = frame_tl_in_y;
571 binfo.
fl_left = CLAMP(frame_tl_in_x, 0, roi_out->
width);
572 const int frame_in_width = floor((piece->
buf_in.
width * roi_in->
scale) + frame_offset * 2);
573 const int frame_in_height = floor((piece->
buf_in.
height * roi_in->
scale) + frame_offset * 2);
574 const int frame_out_width = frame_in_width + frame_size * 2;
575 const int frame_out_height = frame_in_height + frame_size * 2;
576 const int frame_br_in_x = CLAMP(image_lx - frame_offset + frame_in_width - 1, 0, roi_out->
width - 1);
577 const int frame_br_in_y = CLAMP(image_ty - frame_offset + frame_in_height - 1, 0, roi_out->
height - 1);
579 const int frame_br_out_x
580 = (
d->frame_offset == 1.0f && (border_min_size ==
MIN(border_size_l, border_size_r)))
582 : CLAMP(image_lx - frame_offset - frame_size + frame_out_width - 1, 0, roi_out->
width - 1);
583 const int frame_br_out_y
584 = (
d->frame_offset == 1.0f && (border_min_size ==
MIN(border_size_t, border_size_b)))
586 : CLAMP(image_ty - frame_offset - frame_size + frame_out_height - 1, 0, roi_out->
height - 1);
589 binfo.
fl_bot = frame_br_in_y + 1;
605 const int devid = pipe->
devid;
612 const int border_size_t = border_tot_height *
d->pos_v;
613 const int border_size_b = border_tot_height - border_size_t;
614 const int border_size_l = border_tot_width *
d->pos_h;
615 const int border_size_r = border_tot_width - border_size_l;
616 const int border_in_x =
MAX(border_size_l - roi_out->
x, 0);
617 const int border_in_y =
MAX(border_size_t - roi_out->
y, 0);
620 const float col[4] = {
d->color[0],
d->color[1],
d->color[2], 1.0f };
630 if(err != CL_SUCCESS)
goto error;
633 const int border_min_size =
MIN(
MIN(border_size_t, border_size_b),
MIN(border_size_l, border_size_r));
634 const int frame_size = border_min_size *
d->frame_size;
637 const float col_frame[4] = {
d->frame_color[0],
d->frame_color[1],
d->frame_color[2], 1.0f };
638 const int image_lx = border_size_l - roi_out->
x;
639 const int image_ty = border_size_t - roi_out->
y;
640 const int frame_space = border_min_size - frame_size;
641 const int frame_offset = frame_space *
d->frame_offset;
642 const int frame_tl_in_x =
MAX(border_in_x - frame_offset, 0);
643 const int frame_tl_out_x =
MAX(frame_tl_in_x - frame_size, 0);
644 const int frame_tl_in_y =
MAX(border_in_y - frame_offset, 0);
645 const int frame_tl_out_y =
MAX(frame_tl_in_y - frame_size, 0);
646 const int frame_in_width = floor((piece->
buf_in.
width * roi_in->
scale) + frame_offset * 2);
647 const int frame_in_height = floor((piece->
buf_in.
height * roi_in->
scale) + frame_offset * 2);
648 const int frame_out_width = frame_in_width + frame_size * 2;
649 const int frame_out_height = frame_in_height + frame_size * 2;
650 const int frame_br_in_x = CLAMP(image_lx - frame_offset + frame_in_width - 1, 0, roi_out->
width - 1);
651 const int frame_br_in_y = CLAMP(image_ty - frame_offset + frame_in_height - 1, 0, roi_out->
height - 1);
653 const int frame_br_out_x
654 = (
d->frame_offset == 1.0f && (border_min_size ==
MIN(border_size_l, border_size_r)))
656 : CLAMP(image_lx - frame_offset - frame_size + frame_out_width - 1, 0, roi_out->
width);
657 const int frame_br_out_y
658 = (
d->frame_offset == 1.0f && (border_min_size ==
MIN(border_size_t, border_size_b)))
660 : CLAMP(image_ty - frame_offset - frame_size + frame_out_height - 1, 0, roi_out->
height);
662 const int roi_frame_in_width = frame_br_in_x - frame_tl_in_x;
663 const int roi_frame_in_height = frame_br_in_y - frame_tl_in_y;
664 const int roi_frame_out_width = frame_br_out_x - frame_tl_out_x;
665 const int roi_frame_out_height = frame_br_out_y - frame_tl_out_y;
674 if(err != CL_SUCCESS)
goto error;
683 if(err != CL_SUCCESS)
goto error;
686 size_t iorigin[] = { 0, 0, 0 };
687 size_t oorigin[] = { border_in_x, border_in_y, 0 };
688 size_t region[] = { roi_in->
width, roi_in->
height, 1 };
692 if(err != CL_SUCCESS)
goto error;
705 const int program = 2;
731 int left = 0,
top = 0;
733 if(left == 0 &&
top == 0)
return 1;
734 for(
size_t i = 0;
i < points_count * 2;
i += 2)
737 points[
i + 1] +=
top;
745 int left = 0,
top = 0;
747 if(left == 0 &&
top == 0)
return 1;
748 for(
size_t i = 0;
i < points_count * 2;
i += 2)
751 points[
i + 1] -=
top;
809 { 0.0f, 0.0f, 0.0f },
812 self->version(), &
p,
sizeof(
p), 1);
814 p.color[0] =
p.color[1] =
p.color[2] = 0.0f;
815 p.frame_color[0] =
p.frame_color[1] =
p.frame_color[2] = 1.0f;
817 self->version(), &
p,
sizeof(
p), 1);
833 if(fabsf(
p->frame_color[0] - self->
picked_color[0]) < 0.0001f
834 && fabsf(
p->frame_color[1] - self->
picked_color[1]) < 0.0001f
835 && fabsf(
p->frame_color[2] - self->
picked_color[2]) < 0.0001f)
846 if(picker ==
g->frame_picker)
851 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(
g->frame_colorpick), &c);
853 else if(picker ==
g->border_picker)
858 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(
g->colorpick), &c);
872 g_strlcpy(
p->aspect_text, text,
sizeof(
p->aspect_text));
876 g_strlcpy(
p->aspect_text, text,
sizeof(
p->aspect_text));
877 p->aspect =
g->aspect_ratios[which];
894 g_strlcpy(
p->aspect_text, text,
sizeof(
p->aspect_text));
898 g_strlcpy(
p->pos_h_text, text,
sizeof(
p->pos_h_text));
899 p->pos_h =
g->pos_h_ratios[which];
916 g_strlcpy(
p->aspect_text, text,
sizeof(
p->aspect_text));
920 g_strlcpy(
p->pos_v_text, text,
sizeof(
p->pos_v_text));
921 p->pos_v =
g->pos_v_ratios[which];
934 if (w ==
g->aspect_slider)
938 else if(w ==
g->pos_h_slider)
942 else if(w ==
g->pos_v_slider)
957 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &c);
959 p->color[1] = c.green;
960 p->color[2] = c.blue;
975 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &c);
976 p->frame_color[0] = c.red;
977 p->frame_color[1] = c.green;
978 p->frame_color[2] = c.blue;
993 if(fabsf(
p->aspect -
g->aspect_ratios[
k]) < 0.01f)
1007 if(fabsf(
p->pos_h -
g->pos_h_ratios[
k]) < 0.01f)
1021 if(fabsf(
p->pos_v -
g->pos_v_ratios[
k]) < 0.01f)
1033 GdkRGBA c = (GdkRGBA){.red =
p->color[0], .green =
p->color[1], .blue =
p->color[2], .alpha = 1.0 };
1034 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(
g->colorpick), &c);
1037 GdkRGBA
fc = (GdkRGBA){
1038 .red =
p->frame_color[0], .green =
p->frame_color[1], .blue =
p->frame_color[2], .alpha = 1.0
1040 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(
g->frame_colorpick), &
fc);
1064 g->aspect_ratios[
i++] = 3.0f;
1065 g->aspect_ratios[
i++] = 95.0f / 33.0f;
1066 g->aspect_ratios[
i++] = 2.0f;
1067 g->aspect_ratios[
i++] = 16.0f / 9.0f;
1068 g->aspect_ratios[
i++] =
PHI;
1069 g->aspect_ratios[
i++] = 3.0f / 2.0f;
1070 g->aspect_ratios[
i++] = 297.0f / 210.0f;
1071 g->aspect_ratios[
i++] = sqrtf(2.0f);
1072 g->aspect_ratios[
i++] = 4.0f / 3.0f;
1073 g->aspect_ratios[
i++] = 1.0f;
1094 g->pos_h_ratios[
i++] = 0.5f;
1095 g->pos_h_ratios[
i++] = 1.0f / 3.0f;
1096 g->pos_h_ratios[
i++] = 3.0f / 8.0f;
1097 g->pos_h_ratios[
i++] = 5.0f / 8.0f;
1098 g->pos_h_ratios[
i++] = 2.0f / 3.0f;
1100 g->pos_v_ratios[
i++] = 0.5f;
1101 g->pos_v_ratios[
i++] = 1.0f / 3.0f;
1102 g->pos_v_ratios[
i++] = 3.0f / 8.0f;
1103 g->pos_v_ratios[
i++] = 5.0f / 8.0f;
1104 g->pos_v_ratios[
i++] = 2.0f / 3.0f;
1115 gtk_widget_set_tooltip_text(
g->size, _(
"size of the border in percent of the full image"));
1122 g_signal_connect(G_OBJECT(
g->aspect),
"value-changed", G_CALLBACK(
aspect_changed), self);
1123 gtk_widget_set_tooltip_text(
g->aspect, _(
"select the aspect ratio or right click and type your own (w:h)"));
1125 gtk_widget_set_tooltip_text(
g->aspect_slider, _(
"set the custom aspect ratio"));
1131 gtk_widget_set_tooltip_text(
g->aspect_orient, _(
"aspect ratio orientation of the image with border"));
1137 g_signal_connect(G_OBJECT(
g->pos_h),
"value-changed", G_CALLBACK(
position_h_changed), self);
1138 gtk_widget_set_tooltip_text(
g->pos_h, _(
"select the horizontal position ratio relative to top "
1139 "or right click and type your own (y:h)"));
1141 gtk_widget_set_tooltip_text(
g->pos_h_slider, _(
"custom horizontal position"));
1147 g_signal_connect(G_OBJECT(
g->pos_v),
"value-changed", G_CALLBACK(
position_v_changed), self);
1148 gtk_widget_set_tooltip_text(
g->pos_v, _(
"select the vertical position ratio relative to left "
1149 "or right click and type your own (x:w)"));
1151 gtk_widget_set_tooltip_text(
g->pos_v_slider, _(
"custom vertical position"));
1158 gtk_widget_set_tooltip_text(
g->frame_size, _(
"size of the frame line in percent of min border width"));
1163 gtk_widget_set_tooltip_text(
g->frame_offset, _(
"offset of the frame line beginning on picture side"));
1165 GdkRGBA
color = (GdkRGBA){.red =
p->color[0], .green =
p->color[1], .blue =
p->color[2], .alpha = 1.0 };
1171 gtk_box_pack_start(GTK_BOX(box), label,
TRUE,
TRUE, 0);
1172 g->colorpick = gtk_color_button_new_with_rgba(&
color);
1173 gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(
g->colorpick),
FALSE);
1174 gtk_color_button_set_title(GTK_COLOR_BUTTON(
g->colorpick), _(
"select border color"));
1176 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
g->colorpick),
FALSE,
TRUE, 0);
1178 gtk_widget_set_tooltip_text(GTK_WIDGET(
g->border_picker), _(
"pick border color from image"));
1183 gtk_box_pack_start(GTK_BOX(box), label,
TRUE,
TRUE, 0);
1184 g->frame_colorpick = gtk_color_button_new_with_rgba(&
color);
1185 gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(
g->frame_colorpick),
FALSE);
1186 gtk_color_button_set_title(GTK_COLOR_BUTTON(
g->frame_colorpick), _(
"select frame line color"));
1188 gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(
g->frame_colorpick),
FALSE,
TRUE, 0);
1190 gtk_widget_set_tooltip_text(GTK_WIDGET(
g->frame_picker), _(
"pick frame line color from image"));
static void error(char *msg)
void dt_bauhaus_slider_set_digits(GtkWidget *widget, int val)
void dt_bauhaus_combobox_set_editable(GtkWidget *widget, int editable)
int dt_bauhaus_combobox_get(GtkWidget *widget)
int dt_bauhaus_combobox_length(GtkWidget *widget)
const char * dt_bauhaus_combobox_get_text(GtkWidget *widget)
void dt_bauhaus_slider_set(GtkWidget *widget, float pos)
void dt_bauhaus_combobox_set(GtkWidget *widget, const int pos)
void dt_bauhaus_widget_set_label(GtkWidget *widget, const char *label)
GtkWidget * dt_bauhaus_combobox_new(dt_bauhaus_t *bh, dt_gui_module_t *self)
void dt_bauhaus_slider_set_format(GtkWidget *widget, const char *format)
void dt_bauhaus_combobox_add(GtkWidget *widget, const char *text)
#define DT_IOP_BORDERS_ASPECT_COUNT
static void position_v_changed(GtkWidget *combo, dt_iop_module_t *self)
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)
void distort_mask(struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const float *const in, float *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
const char ** description(struct dt_iop_module_t *self)
static int _borders_geometry_transform(const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count)
int distort_backtransform(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
static void gui_init_positions(struct dt_iop_module_t *self)
int distort_transform(dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
static void colorpick_color_set(GtkColorButton *widget, dt_iop_module_t *self)
static const dt_geometry_vtable_t _borders_geometry_vtable
static void _borders_map_size(const dt_iop_borders_data_t *const d, const dt_iop_roi_t *const roi_in, dt_iop_roi_t *roi_out)
Input rect -> output rect. THE size evaluator: modify_roi_out() below and the geometry record both ca...
#define DT_IOP_BORDERS_POSITION_H_COUNT
static int _borders_geometry_backtransform(const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count)
struct dt_iop_borders_params_t dt_iop_borders_data_t
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
static void position_h_changed(GtkWidget *combo, dt_iop_module_t *self)
gboolean geometry_record(dt_iop_module_t *self, const void *params, dt_geometry_record_t *record)
void gui_update(struct dt_iop_module_t *self)
static void gui_init_aspect(struct dt_iop_module_t *self)
static void aspect_changed(GtkWidget *combo, dt_iop_module_t *self)
void gui_init(struct dt_iop_module_t *self)
__DT_CLONE_TARGETS__ void copy_image_with_border(float *out, const float *const in, const struct border_positions_t *binfo)
#define DT_IOP_BORDERS_POSITION_V_COUNT
void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous)
void cleanup_global(dt_iop_module_so_t *module)
static void set_pixels(float *buf, const dt_aligned_pixel_t color, const int npixels)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
#define DT_IOP_BORDERS_ASPECT_ORIENTATION_AUTO
#define DT_IOP_BORDERS_ASPECT_CONSTANT_VALUE
static void copy_pixels(float *out, const float *const in, const int npixels)
static void _borders_geometry_map_size(const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out)
void init_presets(dt_iop_module_so_t *self)
static void frame_colorpick_color_set(GtkColorButton *widget, dt_iop_module_t *self)
void init(dt_iop_module_t *self)
#define DT_IOP_BORDERS_ASPECT_ORIENTATION_LANDSCAPE
#define DT_IOP_BORDERS_ASPECT_ORIENTATION_PORTRAIT
#define DT_IOP_BORDERS_ASPECT_CONSTANT_IDX
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)
#define DT_IOP_BORDERS_ASPECT_IMAGE_IDX
#define DT_IOP_BORDERS_ASPECT_IMAGE_VALUE
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void init_global(dt_iop_module_so_t *module)
int process_cl(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out)
void color_picker_apply(dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void modify_roi_in(struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_out, dt_iop_roi_t *roi_in)
static void _borders_offset(const dt_iop_borders_data_t *const d, const dt_iop_roi_t *const in, const dt_iop_roi_t *const out, int *left, int *top)
The translation the border applies, from the two rects it sits between.
void modify_roi_out(struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *roi_in)
int legacy_params(dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_iop_color_picker_reset(dt_iop_module_t *module, gboolean keep)
GtkWidget * dt_color_picker_new(dt_iop_module_t *module, dt_iop_color_picker_kind_t kind, GtkWidget *w)
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
const dt_colormatrix_t dt_aligned_pixel_t out
struct dt_bauhaus_t * dt_bauhaus_get_global(void)
#define dt_dev_add_history_item(dev, module, enable, redraw)
Where things are on the image, answered without a pipeline.
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)
__DT_CLONE_TARGETS__ void dt_iop_image_fill(float *const buf, const float fill_value, const size_t width, const size_t height, const size_t ch)
void dt_iop_default_init(dt_iop_module_t *module)
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_TILING_FULL_ROI
GtkWidget * dt_iop_gui_reset_label_new(const gchar *label, dt_iop_module_t *module, void *param, int param_size)
GtkWidget * dt_bauhaus_slider_from_params(dt_iop_module_t *self, const char *param)
GtkWidget * dt_bauhaus_combobox_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)
void dt_print(dt_debug_thread_t thread, const char *msg,...) __attribute__((format(printf
Print to stdout when thread is enabled, prefixed with seconds since startup.
float *const restrict const size_t k
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#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.
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
DT_MODULE() for a module whose params struct is introspected.
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
int dt_opencl_create_kernel(const int prog, const char *name)
int dt_opencl_enqueue_copy_image(const int devid, cl_mem src, cl_mem dst, size_t *orig_src, size_t *orig_dst, size_t *region)
void dt_opencl_free_kernel(const int kernel)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
#define __OMP_SIMD__(...)
#define __OMP_PARALLEL_FOR__(...)
#define __OMP_PARALLEL_FOR_SIMD__(...)
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
dt_aligned_pixel_t flcolor
dt_aligned_pixel_t bcolor
struct dt_iop_module_t *void * data
One module instance's contribution, as data.
const dt_geometry_vtable_t * vtable
void(* free_data)(void *data)
A module's geometry, evaluated. Pure functions of the record's own data.
void(* map_size)(const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out)
Full-resolution input rect -> output rect. Mirrors modify_roi_out() at scale 1.
GtkWidget * border_picker
GtkWidget * frame_colorpick
GtkWidget * aspect_slider
GtkWidget * aspect_orient
dt_iop_global_data_t * data
dt_iop_params_t * default_params
struct dt_iop_module_gui_t * gui
struct dt_develop_t * dev
dt_iop_global_data_t * global_data
dt_aligned_pixel_t picked_color
Region of interest passed through the pixelpipe.
#define __DT_CLONE_TARGETS__