89 const int new_version)
91 if(old_version == 1 && new_version == 2)
93 typedef struct dt_iop_invert_params_v1_t
96 } dt_iop_invert_params_v1_t;
98 dt_iop_invert_params_v1_t *o = (dt_iop_invert_params_v1_t *)old_params;
101 n->
color[0] = o->color[0];
102 n->color[1] = o->color[1];
103 n->color[2] = o->color[2];
108 double RGB_to_CAM[4][3];
116 fprintf(stderr,
"[invert] `%s' color matrix not found for 4bayer image\n", camera);
117 dt_control_log(_(
"`%s' color matrix not found for 4bayer image"), camera);
138 return _(
"this module is deprecated. please use the negadoctor module instead.");
145 _(
"linear, raw, display-referred"),
147 _(
"linear, raw, display-referred"));
177 GdkRGBA
color = (GdkRGBA){.red =
p->color[0], .green =
p->color[1], .blue =
p->color[2], .alpha = 1.0 };
192 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(
g->colorpicker), &
color);
201 if(grayrgb[0] == old[0] && grayrgb[1] == old[1] && grayrgb[2] == old[2] && grayrgb[3] == old[3])
return;
225 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &c);
227 p->color[1] = c.green;
228 p->color[2] = c.blue;
237 p->color[0] =
p->color[1] =
p->color[2] = 0.21f*c.red + 0.72f*c.green + 0.07f*c.blue ;
252 = {
d->color[0] *
m[0],
d->color[1] *
m[1],
d->color[2] *
m[2],
d->color[3] *
m[3] };
260 const uint8_t(*
const xtrans)[6] = (
const uint8_t(*
const)[6])piece->
dsc_in.
xtrans;
262 const float *
const in = (
const float *
const)ivoid;
263 float *
const out = (
float *
const)
ovoid;
268 for(
int j = 0; j < roi_out->
height; j++)
270 for(
int i = 0;
i < roi_out->
width;
i++)
272 const size_t p = (size_t)j * roi_out->
width +
i;
273 out[
p] = CLAMP(film_rgb_f[
FCxtrans(j,
i, roi_out, xtrans)] - in[
p], 0.0f, 1.0f);
280 for(
int j = 0; j < roi_out->
height; j++)
282 for(
int i = 0;
i < roi_out->
width;
i++)
284 const size_t p = (size_t)j * roi_out->
width +
i;
285 out[
p] = CLAMP(film_rgb_f[
FC(j + roi_out->
y,
i + roi_out->
x, filters)] - in[
p], 0.0f, 1.0f);
295 for(
int c = 0; c < 3; c++)
297 const size_t p = (size_t)
k + c;
298 out[
p] =
d->color[c] - in[
p];
317 for(
int k = 0;
k < 4;
k++)
d->color[
k] =
p->color[
k];
366 fprintf(stderr,
"[invert] `%s' color matrix not found for 4bayer image\n", camera);
367 dt_control_log(_(
"`%s' color matrix not found for 4bayer image"), camera);
385 gtk_box_pack_start(GTK_BOX(self->
gui->
widget), GTK_WIDGET(
g->pickerbuttons),
TRUE,
TRUE, 0);
387 GdkRGBA
color = (GdkRGBA){.red =
p->color[0], .green =
p->color[1], .blue =
p->color[2], .alpha = 1.0 };
388 g->colorpicker = gtk_color_button_new_with_rgba(&
color);
389 gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(
g->colorpicker),
FALSE);
390 gtk_color_button_set_title(GTK_COLOR_BUTTON(
g->colorpicker), _(
"select color of film material"));
392 gtk_box_pack_start(GTK_BOX(
g->pickerbuttons), GTK_WIDGET(
g->colorpicker),
TRUE,
TRUE, 0);
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)
void dt_colorspaces_rgb_to_cygm(float *out, int num, double RGB_to_CAM[4][3])
Convert an RGB buffer to 4-channel CYGM, in place.
__DT_CLONE_TARGETS__ int dt_colorspaces_conversion_matrices_rgb(const float *adobe_XYZ_to_CAM, double(*out_RGB_to_CAM)[3], double(*out_CAM_to_RGB)[4], const float *embedded_matrix, double *mul)
Compute the sRGB->camera and camera->sRGB matrices, and the default white balance multipliers.
__DT_CLONE_TARGETS__ void dt_colorspaces_cygm_to_rgb(float *out, int num, double CAM_to_RGB[3][4])
Convert a 4-channel CYGM buffer to RGB, in place.
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
gboolean dt_image_is_monochrome(const dt_image_t *img)
void dt_control_log(const char *msg,...)
void dt_control_queue_redraw_widget(GtkWidget *widget)
threadsafe request of redraw of specific widget. Use this function if you need to redraw a specific w...
static int FCxtrans(const int row, const int col, global const unsigned char(*const xtrans)[6])
static int FC(const int row, const int col, const unsigned int filters)
#define dt_dev_add_history_item(dev, module, enable, redraw)
@ DT_DEV_PIXELPIPE_DISPLAY_MASK
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)
GtkWidget * dt_iop_gui_reset_label_new(const gchar *label, dt_iop_module_t *module, void *param, int param_size)
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)
const char ** description(struct dt_iop_module_t *self)
static void gui_update_from_coeffs(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)
void commit_params(struct dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
void gui_update(dt_iop_module_t *self)
Refresh GUI controls from current params and configuration.
static void colorpicker_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 output_format(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
void gui_init(dt_iop_module_t *self)
int default_colorspace(dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
void cleanup_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
const char * deprecated_msg()
void color_picker_apply(dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
int legacy_params(dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
float *const restrict const size_t k
float *const restrict const size_t const size_t ch
#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_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)
DT_MODULE() for a module whose params struct is introspected.
#define __OMP_PARALLEL_FOR_SIMD__(...)
void dtgtk_reset_label_set_text(GtkDarktableResetLabel *label, const gchar *str)
#define DTGTK_RESET_LABEL(obj)
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]
#define for_four_channels(_var,...)
dt_iop_buffer_dsc_t dsc_out
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
struct dt_develop_t * dev
char camera_makermodel[128]
float d65_color_matrix[9]
float adobe_XYZ_to_CAM[4][3]
dt_aligned_pixel_t processed_maximum
GtkDarktableResetLabel * label
int32_t hide_enable_button
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.
#define __DT_CLONE_TARGETS__