Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
masks_functions.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2013-2014, 2016, 2019, 2021 Aldric Renaudin.
4 Copyright (C) 2013, 2018, 2020-2021 Pascal Obry.
5 Copyright (C) 2013 Simon Spannagel.
6 Copyright (C) 2013-2014, 2016-2018 Tobias Ellinghaus.
7 Copyright (C) 2013-2017, 2019-2020 Ulrich Pegelow.
8 Copyright (C) 2014-2016 Roman Lebedev.
9 Copyright (C) 2017-2019 Edgardo Hoszowski.
10 Copyright (C) 2021 Hanno Schwalm.
11 Copyright (C) 2021 Hubert Kowalski.
12 Copyright (C) 2021 luzpaz.
13 Copyright (C) 2021 Philipp Lutz.
14 Copyright (C) 2021 Ralf Brown.
15 Copyright (C) 2022 Martin Bařinka.
16 Copyright (C) 2023, 2025-2026 Aurélien PIERRE.
17 Copyright (C) 2023 Luca Zulberti.
18 Copyright (C) 2025 Alynx Zhou.
19 Copyright (C) 2025-2026 Guillaume Stutin.
20
21 darktable is free software: you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation, either version 3 of the License, or
24 (at your option) any later version.
25
26 darktable is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
30
31 You should have received a copy of the GNU General Public License
32 along with darktable. If not, see <http://www.gnu.org/licenses/>.
33*/
34
47#ifndef DT_DEVELOP_MASKS_MASKS_FUNCTIONS_H
48#define DT_DEVELOP_MASKS_MASKS_FUNCTIONS_H
49
50#include "develop/masks.h"
51#include "develop/masks_gui.h"
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57
61{
62 int point_struct_size; // sizeof(struct dt_masks_point_*_t)
64 void (*set_form_name)(struct dt_masks_form_t *const form, const size_t nb);
65 void (*set_hint_message)(const struct dt_masks_form_gui_t *const gui, const struct dt_masks_form_t *const form,
66 const int opacity, char *const __restrict__ msgbuf, const size_t msgbuf_len);
67 void (*duplicate_points)(struct dt_develop_t *const dev, struct dt_masks_form_t *base, struct dt_masks_form_t *dest);
68 void (*initial_source_pos)(struct dt_develop_t *dev, const float iwd, const float iht, float *x, float *y);
69 // input coordinates are in absolute output-image space, dist is squared in the same space
70 void (*get_distance)(float x, float y, float as, struct dt_masks_form_gui_t *gui, int index, int num_points,
71 int *inside, int *inside_border, int *near_handle, int *inside_source, float *dist);
72 int (*get_points)(struct dt_develop_t *dev, float x, float y, float radius_a, float radius_b, float rotation,
73 float **points, int *points_count);
74 int (*get_points_border)(struct dt_develop_t *dev, struct dt_masks_form_t *form, float **points, int *points_count,
75 float **border, int *border_count, int source, const dt_iop_module_t *const module);
76 int (*get_mask)(const dt_iop_module_t *const module, struct dt_dev_pixelpipe_t *pipe,
77 const dt_dev_pixelpipe_iop_t *const piece,
78 struct dt_masks_form_t *const form,
79 float **buffer, int *width, int *height, int *posx, int *posy);
80 int (*get_mask_roi)(const dt_iop_module_t *const fmodule, struct dt_dev_pixelpipe_t *pipe,
81 const dt_dev_pixelpipe_iop_t *const piece,
82 struct dt_masks_form_t *const form,
83 const dt_iop_roi_t *roi, float *buffer);
84 int (*get_area)(const dt_iop_module_t *const module, struct dt_dev_pixelpipe_t *pipe,
85 const dt_dev_pixelpipe_iop_t *const piece,
86 struct dt_masks_form_t *const form,
87 int *width, int *height, int *posx, int *posy);
90 int *width, int *height, int *posx, int *posy);
91 gboolean (*get_gravity_center)(struct dt_develop_t *dev, const struct dt_masks_form_t *form, float center[2], float *area);
94 dt_masks_increment_t increment, int flow,
95 struct dt_masks_form_gui_t *gui, struct dt_iop_module_t *module);
96 /* Recompute hovered handles/nodes from the cached cursor state in gui. */
97 int (*update_hover)(struct dt_masks_form_t *form, struct dt_masks_form_gui_t *gui, int index);
98 /* Mouse x and y are widget-space coordinates from GTK/Cairo */
99 int (*mouse_moved)(struct dt_iop_module_t *module, double x, double y, double pressure, int which,
100 struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index);
101 /* Mouse x and y are widget-space coordinates from GTK/Cairo */
102 int (*mouse_scrolled)(struct dt_iop_module_t *module, double x, double y, int up, const int delta_y, uint32_t state,
103 struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index,
104 dt_masks_interaction_t interaction);
105 /* Mouse x and y are widget-space coordinates from GTK/Cairo */
106 int (*button_pressed)(struct dt_iop_module_t *module, double x, double y,
107 double pressure, int which, int type, uint32_t state,
108 struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index);
109 /* Mouse x and y are widget-space coordinates from GTK/Cairo */
110 int (*button_released)(struct dt_iop_module_t *module, double x, double y, int which, uint32_t state,
111 struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index);
112 /* Key event */
113 int (*key_pressed)(struct dt_iop_module_t *module, GdkEventKey *event, struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index);
114 void (*post_expose)(cairo_t *cr, float zoom_scale, struct dt_masks_form_gui_t *gui, int index, int num_points);
115 // The function to draw the shape in question. Signature must match shape_draw_function_t.
119 int (*populate_context_menu)(GtkWidget *menu, struct dt_masks_form_t *form, struct dt_masks_form_gui_t *gui, const float pzx, const float pzy);
121
129
133/* Shared between masks.c (data/persistence) and masks_gui.c (interaction) since the
134 * GUI half moved out; internal to the masks subsystem like everything here. */
135void dt_masks_form_gui_points_free(gpointer data);
140float _change_opacity(dt_masks_form_group_t *form_group, float value,
141 const dt_masks_increment_t increment, const int flow);
143
144#ifdef __cplusplus
145}
146#endif
147
148#endif // DT_DEVELOP_MASKS_MASKS_FUNCTIONS_H
static double dist(double x1, double y1, double x2, double y2)
Definition ashift_lsd.c:250
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
static const float x
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
void(* shape_draw_function_t)(struct dt_develop_t *dev, cairo_t *cr, const float *points, const int points_count, const int nb, const gboolean border, const gboolean source)
Definition draw.h:773
_lib_location_type_t type
Definition location.c:1
dt_masks_type_t
Definition masks.h:139
dt_masks_interaction_t
Definition masks.h:310
dt_masks_increment_t
Definition masks.h:203
dt_masks_form_t * _group_create(dt_develop_t *develop, dt_iop_module_t *module, dt_masks_type_t group_type)
const dt_masks_functions_t dt_masks_functions_group
Definition group.c:748
void _check_id(dt_develop_t *dev, dt_masks_form_t *mask_form)
const dt_masks_functions_t dt_masks_functions_polygon
Definition polygon.c:3718
int _find_in_group(dt_develop_t *dev, dt_masks_form_t *group_form, int form_id)
const dt_masks_functions_t dt_masks_functions_ellipse
Definition ellipse.c:1709
const dt_masks_functions_t dt_masks_functions_circle
Definition circle.c:1138
void _set_group_name_from_module(dt_iop_module_t *module, dt_masks_form_t *group_form)
dt_masks_form_t * _group_from_module(dt_develop_t *develop, dt_iop_module_t *module)
float _change_opacity(dt_masks_form_group_t *form_group, float value, const dt_masks_increment_t increment, const int flow)
Definition masks_gui.c:4235
const dt_masks_functions_t dt_masks_functions_brush
void dt_masks_form_gui_points_free(gpointer data)
const dt_masks_functions_t dt_masks_functions_gradient
Definition gradient.c:1532
The interactive half of the masks subsystem: the editing state (dt_masks_form_gui_t),...
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
static const dt_aligned_pixel_simd_t value
Definition simd.h:144
const float uint32_t state[4]
Region of interest passed through the pixelpipe.
Definition format.h:49
struct dt_develop_t * dev
Definition masks_gui.h:81
float(* get_interaction_value)(const struct dt_masks_form_t *form, dt_masks_interaction_t interaction)
int(* button_pressed)(struct dt_iop_module_t *module, double x, double y, double pressure, int which, int type, uint32_t state, struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index)
int(* get_points)(struct dt_develop_t *dev, float x, float y, float radius_a, float radius_b, float rotation, float **points, int *points_count)
void(* initial_source_pos)(struct dt_develop_t *dev, const float iwd, const float iht, float *x, float *y)
int(* button_released)(struct dt_iop_module_t *module, double x, double y, int which, uint32_t state, struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index)
int(* get_mask_roi)(const dt_iop_module_t *const fmodule, struct dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *const piece, struct dt_masks_form_t *const form, const dt_iop_roi_t *roi, float *buffer)
int(* get_source_area)(dt_iop_module_t *module, struct dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, struct dt_masks_form_t *form, int *width, int *height, int *posx, int *posy)
int(* key_pressed)(struct dt_iop_module_t *module, GdkEventKey *event, struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index)
int(* mouse_moved)(struct dt_iop_module_t *module, double x, double y, double pressure, int which, struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index)
void(* sanitize_config)(dt_masks_type_t type_flags)
void(* set_form_name)(struct dt_masks_form_t *const form, const size_t nb)
void(* duplicate_points)(struct dt_develop_t *const dev, struct dt_masks_form_t *base, struct dt_masks_form_t *dest)
int(* populate_context_menu)(GtkWidget *menu, struct dt_masks_form_t *form, struct dt_masks_form_gui_t *gui, const float pzx, const float pzy)
int(* update_hover)(struct dt_masks_form_t *form, struct dt_masks_form_gui_t *gui, int index)
float(* set_interaction_value)(struct dt_masks_form_t *form, dt_masks_interaction_t interaction, float value, dt_masks_increment_t increment, int flow, struct dt_masks_form_gui_t *gui, struct dt_iop_module_t *module)
int(* get_points_border)(struct dt_develop_t *dev, struct dt_masks_form_t *form, float **points, int *points_count, float **border, int *border_count, int source, const dt_iop_module_t *const module)
int(* get_area)(const dt_iop_module_t *const module, struct dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *const piece, struct dt_masks_form_t *const form, int *width, int *height, int *posx, int *posy)
int(* mouse_scrolled)(struct dt_iop_module_t *module, double x, double y, int up, const int delta_y, uint32_t state, struct dt_masks_form_t *form, int parentid, struct dt_masks_form_gui_t *gui, int index, dt_masks_interaction_t interaction)
int(* get_mask)(const dt_iop_module_t *const module, struct dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *const piece, struct dt_masks_form_t *const form, float **buffer, int *width, int *height, int *posx, int *posy)
gboolean(* get_gravity_center)(struct dt_develop_t *dev, const struct dt_masks_form_t *form, float center[2], float *area)
void(* post_expose)(cairo_t *cr, float zoom_scale, struct dt_masks_form_gui_t *gui, int index, int num_points)
shape_draw_function_t draw_shape
void(* get_distance)(float x, float y, float as, struct dt_masks_form_gui_t *gui, int index, int num_points, int *inside, int *inside_border, int *near_handle, int *inside_source, float *dist)
void(* set_hint_message)(const struct dt_masks_form_gui_t *const gui, const struct dt_masks_form_t *const form, const int opacity, char *const __restrict__ msgbuf, const size_t msgbuf_len)
void(* init_ctrl_points)(struct dt_masks_form_t *form)