Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
masks_gui.h File Reference

The interactive half of the masks subsystem: the editing state (dt_masks_form_gui_t), hit-testing, event dispatchers, drawing helpers, shape buttons, menus and dialogs. More...

#include "develop/masks.h"
#include "widgets/draw.h"
#include <gtk/gtk.h>
Include dependency graph for masks_gui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_masks_form_gui_points_t
struct  dt_masks_form_gui_t
struct  dt_masks_preview_buffers_t
struct  dt_masks_gui_center_point_t
struct  dt_masks_shape_buttons_config_t
struct  dt_masks_overlay_transform_t
 How the overlay maps image coordinates onto its cairo target. More...
struct  dt_masks_hit_callbacks_t
 The shape-specific half of dt_masks_find_closest_handle_common(). Any member may be NULL. More...

Macros

#define menu_item_set_fake_accel(menu_item, keyval, mods)

Typedefs

typedef struct dt_masks_form_gui_points_t dt_masks_form_gui_points_t
typedef struct dt_masks_form_gui_t dt_masks_form_gui_t
typedef struct dt_masks_preview_buffers_t dt_masks_preview_buffers_t
typedef struct dt_masks_gui_center_point_t dt_masks_gui_center_point_t
typedef enum dt_masks_shape_button_index_t dt_masks_shape_button_index_t
typedef enum dt_masks_shape_buttons_flags_t dt_masks_shape_buttons_flags_t
typedef gboolean(* dt_masks_shape_buttons_start_f) (GtkWidget *button, dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data)
typedef dt_masks_type_t(* dt_masks_shape_buttons_type_f) (dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data)
typedef void(* dt_masks_shape_buttons_notify_f) (GtkWidget *button, dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data)
typedef struct dt_masks_shape_buttons_config_t dt_masks_shape_buttons_config_t
typedef struct dt_masks_overlay_transform_t dt_masks_overlay_transform_t
 How the overlay maps image coordinates onto its cairo target.
typedef enum dt_masks_scroll_modifier_t dt_masks_scroll_modifier_t
typedef gboolean(* dt_masks_border_handle_fn) (const dt_masks_form_gui_points_t *gui_points, int node_count, int node_index, float *handle_x, float *handle_y, const void *user_data)
 Shape-specific callback to fetch a node's border handle in GUI space.
typedef void(* dt_masks_curve_handle_fn) (const dt_masks_form_gui_points_t *gui_points, int node_index, float *handle_x, float *handle_y, const void *user_data)
 Shape-specific callback to fetch a node's curve handle in GUI space.
typedef void(* dt_masks_node_position_fn) (const dt_masks_form_gui_points_t *gui_points, int node_index, float *node_x, float *node_y, const void *user_data)
 Shape-specific callback to fetch a node's position in GUI space.
typedef void(* dt_masks_distance_fn) (float pointer_x, float pointer_y, float cursor_radius, dt_masks_form_gui_t *mask_gui, int form_index, int node_count, int *inside, int *inside_border, int *near_handle, int *inside_source, float *dist, const void *user_data)
 Shape-specific callback for inside/border/segment hit testing.
typedef void(* dt_masks_post_select_fn) (dt_masks_form_gui_t *mask_gui, int inside, int inside_border, int inside_source, const void *user_data)
 Optional hook to customize selection flags after inside/border/source resolution.
typedef struct dt_masks_hit_callbacks_t dt_masks_hit_callbacks_t
 The shape-specific half of dt_masks_find_closest_handle_common(). Any member may be NULL.

Enumerations

enum  dt_masks_shape_button_index_t {
  DT_MASKS_SHAPE_INDEX_GRADIENT = 0 ,
  DT_MASKS_SHAPE_INDEX_POLYGON = 1 ,
  DT_MASKS_SHAPE_INDEX_ELLIPSE = 2 ,
  DT_MASKS_SHAPE_INDEX_CIRCLE = 3 ,
  DT_MASKS_SHAPE_INDEX_BRUSH = 4
}
enum  dt_masks_shape_buttons_flags_t {
  DT_MASKS_SHAPE_BUTTONS_NONE = 0 ,
  DT_MASKS_SHAPE_BUTTONS_CIRCLE = 1 << 0 ,
  DT_MASKS_SHAPE_BUTTONS_ELLIPSE = 1 << 1 ,
  DT_MASKS_SHAPE_BUTTONS_POLYGON = 1 << 2 ,
  DT_MASKS_SHAPE_BUTTONS_BRUSH = 1 << 3 ,
  DT_MASKS_SHAPE_BUTTONS_GRADIENT = 1 << 4 ,
  DT_MASKS_SHAPE_BUTTONS_ALL
}
enum  dt_masks_scroll_modifier_t {
  DT_MASKS_SCROLL_PLAIN = 0 ,
  DT_MASKS_SCROLL_SHIFT ,
  DT_MASKS_SCROLL_PRIMARY ,
  DT_MASKS_SCROLL_PRIMARY_SHIFT ,
  DT_MASKS_SCROLL_MODIFIER_LAST
}

Functions

static gboolean dt_masks_gui_points_reach (const dt_masks_form_gui_points_t *gp, const float x, const float y, const float reach)
void dt_masks_gui_points_update_bbox (dt_masks_form_gui_points_t *gp)
void dt_masks_init_form_gui (dt_develop_t *dev, dt_masks_form_gui_t *gui)
void dt_masks_gui_set_outline_density (dt_masks_form_gui_t *gui, double image_px_per_device_px)
dt_masks_form_t * dt_masks_get_visible_form (const struct dt_develop_t *dev)
void dt_masks_set_visible_form (struct dt_develop_t *dev, dt_masks_form_t *form)
void dt_masks_gui_init (struct dt_develop_t *dev)
void dt_masks_gui_cleanup (struct dt_develop_t *dev)
void dt_masks_gui_set_dragging (dt_masks_form_gui_t *gui)
void dt_masks_gui_reset_dragging (dt_masks_form_gui_t *gui)
gboolean dt_masks_gui_is_dragging (const dt_masks_form_gui_t *gui)
static gboolean dt_masks_gui_was_anything_selected (const dt_masks_form_gui_t *gui)
static int dt_masks_gui_selected_node_index (const dt_masks_form_gui_t *gui)
static int dt_masks_gui_selected_handle_index (const dt_masks_form_gui_t *gui)
static int dt_masks_gui_selected_handle_border_index (const dt_masks_form_gui_t *gui)
static int dt_masks_gui_selected_segment_index (const dt_masks_form_gui_t *gui)
static gboolean dt_masks_gui_change_affects_selected_node_or_all (const dt_masks_form_gui_t *gui, const int index)
static float dt_masks_get_form_size_from_nodes (const GList *points)
static gboolean dt_masks_gui_should_hit_test (dt_masks_form_gui_t *gui)
static void dt_masks_gui_cursor_to_raw_norm (dt_develop_t *dev, const dt_masks_form_gui_t *gui, float point[2])
static void dt_masks_gui_delta_to_raw_norm (dt_develop_t *dev, const dt_masks_form_gui_t *gui, float point[2])
static void dt_masks_gui_delta_to_image_abs (const dt_masks_form_gui_t *gui, float point[2])
static void dt_masks_gui_delta_from_raw_anchor (dt_develop_t *dev, const dt_masks_form_gui_t *gui, const float anchor[2], float *delta_x, float *delta_y)
gboolean dt_masks_node_is_cusp (const dt_masks_form_gui_points_t *gpt, const int index)
 returns wether a node is a corner or not. A node is a corner if its 2 control handles are at the same position, else it's a curve.
void dt_masks_gui_form_create (dt_masks_form_t *form, dt_masks_form_gui_t *gui, int index, struct dt_iop_module_t *module)
gboolean dt_masks_toggle_bezier_node_type (struct dt_iop_module_t *module, struct dt_masks_form_t *mask_form, struct dt_masks_form_gui_t *mask_gui, const int form_index, const struct dt_masks_form_gui_points_t *gui_points, const int node_index, float node[2], float ctrl1[2], float ctrl2[2], dt_masks_points_states_t *state)
gboolean dt_masks_reset_bezier_ctrl_points (struct dt_iop_module_t *module, struct dt_masks_form_t *mask_form, struct dt_masks_form_gui_t *mask_gui, const int form_index, const struct dt_masks_form_gui_points_t *gui_points, const int node_index, dt_masks_points_states_t *state)
static void dt_masks_project_on_line (const float cursor[2], const float node[2], const float handle[2], float point[2])
static float dt_masks_border_from_projected_handle (dt_develop_t *dev, const float node[2], const float projected_image_pos[2], const float scale_ref)
void dt_masks_draw_outline_runs (cairo_t *cr, const float *const points, const int first, const int last, const dt_masks_skip_range_t *skips, const int skip_count)
static void dt_masks_draw_preview_shape (struct dt_develop_t *dev, cairo_t *cr, const float zoom_scale, const int num_points, float *points, const int points_count, float *border, const int border_count, const shape_draw_function_t *draw_shape, const cairo_line_cap_t shape_cap, const cairo_line_cap_t border_cap, const gboolean save_restore, const gboolean source)
static void dt_masks_preview_buffers_cleanup (dt_masks_preview_buffers_t *buffers)
void dt_masks_append_form (dt_develop_t *dev, dt_masks_form_t *form)
void dt_masks_remove_form (dt_develop_t *dev, dt_masks_form_t *form)
void dt_masks_remove_node (struct dt_iop_module_t *module, dt_masks_form_t *form, int parentid, dt_masks_form_gui_t *gui, int index, int node_index)
void dt_masks_change_form_gui (dt_develop_t *dev, dt_masks_form_t *newform)
void dt_masks_clear_form_gui (dt_develop_t *dev)
void dt_masks_reset_form_gui (dt_develop_t *dev)
void dt_masks_soft_reset_form_gui (dt_masks_form_gui_t *gui)
void dt_masks_reset_show_masks_icons (dt_develop_t *dev)
GtkWidget * dt_masks_shape_buttons_create (const dt_masks_shape_buttons_config_t *config)
 Build a synchronized toolbar for creating masks shapes.
void dt_masks_shape_buttons_deactivate_all (GtkWidget *active_button)
void dt_masks_shape_buttons_sync_all (void)
 Make every shape toolbar show the shape currently being created, if any.
GtkWidget * dt_masks_shape_menu_item_new (GtkWidget *menu, const dt_masks_type_t type, GCallback activate_callback, gpointer user_data)
 Append a menu entry for one shape type: its toolbar icon, then its toolbar label.
int dt_masks_events_mouse_moved (dt_develop_t *dev, struct dt_iop_module_t *module, double x, double y, double pressure, int which)
int dt_masks_events_button_released (dt_develop_t *dev, struct dt_iop_module_t *module, double x, double y, int which, uint32_t state)
int dt_masks_events_button_pressed (dt_develop_t *dev, struct dt_iop_module_t *module, double x, double y, double pressure, int which, int type, uint32_t state)
int dt_masks_events_mouse_scrolled (dt_develop_t *dev, struct dt_iop_module_t *module, double x, double y, int up, uint32_t state, int delta_y)
int dt_masks_events_key_pressed (dt_develop_t *dev, struct dt_iop_module_t *module, GdkEventKey *event)
void dt_masks_draw_source (cairo_t *cr, dt_masks_form_gui_t *gui, const int index, const int nb, const float zoom_scale, struct dt_masks_gui_center_point_t *center_point, const shape_draw_function_t *draw_shape_func)
 Draw the source for a correction mask.
void dt_masks_draw_path_seg_by_seg (cairo_t *cr, dt_masks_form_gui_t *gui, const int index, const float *points, const int points_count, const int node_count, const float zoom_scale, const gboolean centreline)
 Stroke a shape's path one node-to-node segment at a time.
void dt_masks_events_post_expose_with (dt_develop_t *dev, struct dt_iop_module_t *module, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery, const dt_masks_overlay_transform_t *transform)
 Draw the mask overlay with an explicit mapping; transform NULL means the viewport's.
void dt_masks_overlay_queue_redraw (GtkWidget *widget)
void dt_masks_events_post_expose (dt_develop_t *dev, struct dt_iop_module_t *module, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
int dt_masks_events_mouse_leave (struct dt_iop_module_t *module)
int dt_masks_events_mouse_enter (struct dt_iop_module_t *module)
gboolean dt_masks_gui_form_create_throttled (dt_masks_form_t *form, dt_masks_form_gui_t *gui, int index, struct dt_iop_module_t *module, float posx, float posy)
gboolean dt_masks_gui_remove (struct dt_iop_module_t *module, dt_masks_form_t *form, dt_masks_form_gui_t *gui, const int parentid)
 remove a mask shape or node form from the GUI. This function is used with a popupmenu "Delete" action.
gboolean dt_masks_remove_or_delete (struct dt_iop_module_t *module, dt_masks_form_t *sel, int parent_id, dt_masks_form_gui_t *mask_gui, int form_id)
 If the form to remove is used once, ask to the user if he wants to delete it from the list or just remove and keep for later reuse.
gboolean dt_masks_remove_shape_from_group (struct dt_iop_module_t *module, dt_masks_form_t *sel, int parent_id, dt_masks_form_gui_t *mask_gui, int form_id)
 Remove the form from its current group only, keeping it around unused for potential reuse. Never asks for confirmation, since nothing is destroyed.
gboolean dt_masks_delete_shape (struct dt_iop_module_t *module, dt_masks_form_t *sel, int parent_id, dt_masks_form_gui_t *mask_gui, int form_id)
 Permanently delete the form from every group and from dev->forms. Gated by dt_masks_gui_confirm_permanent_delete() (itself gated by the "ask_before_delete_mask_shape" pref).
gboolean dt_masks_form_exit_creation (dt_iop_module_t *module, dt_masks_form_gui_t *gui)
void dt_masks_gui_form_remove (dt_masks_form_t *form, dt_masks_form_gui_t *gui, int index)
void dt_masks_gui_form_test_create (dt_masks_form_t *form, dt_masks_form_gui_t *gui, struct dt_iop_module_t *module)
void dt_masks_gui_form_save_creation (dt_develop_t *dev, struct dt_iop_module_t *module, dt_masks_form_t *form, dt_masks_form_gui_t *gui)
 Save the form creation right after a shape has been finished drawing.
void dt_masks_group_ungroup (dt_develop_t *dev, dt_masks_form_t *dest_grp, dt_masks_form_t *grp)
void dt_masks_group_update_name (dt_iop_module_t *module)
dt_masks_form_group_t * dt_masks_group_add_form (dt_develop_t *dev, dt_masks_form_t *grp, dt_masks_form_t *form)
dt_masks_form_group_t * dt_masks_group_add_form_with_state (dt_develop_t *dev, dt_masks_form_t *grp, dt_masks_form_t *form, int parentid, dt_masks_state_t state, float opacity)
void dt_masks_select_form (dt_develop_t *dev, struct dt_iop_module_t *module, dt_masks_form_t *sel)
 Select or clear the current mask form, notifying the owning module if needed.
void dt_masks_set_source_pos_initial_state (dt_masks_form_gui_t *gui, const uint32_t state)
 Decide initial source positioning mode for clone masks.
void dt_masks_set_source_pos_initial_value (dt_masks_form_gui_t *gui, dt_masks_form_t *form)
 Initialize the clone source position based on current GUI state.
void dt_masks_calculate_source_pos_origin (dt_masks_form_gui_t *gui, const float initial_xpos, const float initial_ypos, const float xpos, const float ypos, float *px, float *py, const int adding)
 Compute preview-space source position for drawing the clone indicator.
static void dt_masks_draw_source_preview (cairo_t *cr, const float zoom_scale, dt_masks_form_gui_t *gui, const float initial_xpos, const float initial_ypos, const float xpos, const float ypos, const int adding)
float dt_masks_rotate_with_anchor (dt_develop_t *dev, const float anchor[2], const float center[2], dt_masks_form_gui_t *gui)
 Rotate a mask shape around its center. WARNING: gui->delta will be updated with the new position after rotation.
dt_masks_form_group_t * dt_masks_form_group_from_parentid (dt_develop_t *dev, int parentid, int formid)
 Return the group entry for a (parent, form) pair.
dt_masks_form_group_t * dt_masks_form_group_find_entry (dt_masks_form_t *group_form, int formid, int *out_index)
 Find the group-membership entry for formid inside group_form's own points list (not recursive into subgroups) – the shared primitive behind every "find this shape's row within its parent group" call site.
int dt_masks_group_index_from_formid (const dt_masks_form_t *group_form, int formid)
 Find any group that currently references formid, searching every top-level group in dev->forms and their nested subgroups (first match wins – a shape used by more than one module has no single "correct" answer). Meant for UI listings that show a shape without already knowing which group (if any) it belongs to, e.g. a flat "all shapes" row.
dt_masks_form_group_t * dt_masks_form_get_selected_group (const struct dt_masks_form_t *form, const struct dt_masks_form_gui_t *gui)
dt_masks_interaction_t dt_masks_scroll_mapping_get (dt_masks_scroll_modifier_t modifier)
void dt_masks_scroll_mapping_set (dt_masks_scroll_modifier_t modifier, dt_masks_interaction_t interaction)
const char * dt_masks_scroll_modifier_name (dt_masks_scroll_modifier_t modifier)
const char * dt_masks_interaction_name (dt_masks_interaction_t interaction)
const char * dt_masks_interaction_alias_name (dt_masks_interaction_t interaction)
 The other word for a property, when a shape family spells it its own way.
dt_masks_interaction_t dt_masks_scroll_get_interaction (uint32_t key_state)
 Resolve a wheel event's key state into the property it edits.
gboolean dt_masks_is_anything_selected (const dt_masks_form_gui_t *mask_gui)
gboolean dt_masks_is_anything_hovered (const dt_masks_form_gui_t *mask_gui)
dt_masks_form_group_t * dt_masks_form_get_selected_group_live (const struct dt_masks_form_t *form, const struct dt_masks_form_gui_t *gui)
 Return the currently selected group entry, resolving to the live form group when the GUI is operating on a temporary copy (for example the visible group created for editing).
float dt_masks_form_get_interaction_value (dt_develop_t *dev, int group_id, int formid, dt_masks_interaction_t interaction)
gboolean dt_masks_form_get_gravity_center (dt_develop_t *dev, const struct dt_masks_form_t *form, float center[2], float *area)
void dt_masks_form_update_gravity_center (dt_develop_t *dev, struct dt_masks_form_t *form)
void dt_masks_form_invalidate_gravity_center (struct dt_masks_form_t *form)
int dt_masks_center_view_on_form (struct dt_develop_t *dev, const struct dt_masks_form_t *form)
float dt_masks_form_set_interaction_value (dt_develop_t *dev, int group_id, int formid, 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)
float dt_masks_get_set_conf_value (dt_masks_form_t *form, char *feature, float new_value, float v_min, float v_max, dt_masks_increment_t increment, const int flow)
 Change a numerical property of a mask shape, either by in/de-crementing the current value or setting it in an absolute fashion, then save it to configuration.
float dt_masks_get_set_conf_value_with_toast (dt_masks_form_t *form, const char *feature, float amount, float v_min, float v_max, dt_masks_increment_t increment, int flow, const char *toast_fmt, float toast_scale)
 Update a mask configuration value and emit a toast message.
float dt_masks_apply_increment (float current, float amount, dt_masks_increment_t increment, int flow)
 Apply a scroll increment to a scalar value.
float dt_masks_apply_increment_precomputed (float current, float amount, float scale_amount, float offset_amount, dt_masks_increment_t increment)
 Apply a scroll increment using precomputed scale/offset factors.
void dt_group_events_post_expose_except (cairo_t *cr, float zoom_scale, dt_masks_form_t *form, dt_masks_form_gui_t *gui, int except_pos)
void dt_group_events_post_expose_only (cairo_t *cr, float zoom_scale, dt_masks_form_t *form, dt_masks_form_gui_t *gui, int pos)
void dt_group_events_post_expose (cairo_t *cr, float zoom_scale, dt_masks_form_t *form, dt_masks_form_gui_t *gui)
gboolean dt_masks_point_is_within_radius (const float px, const float py, const float cx, const float cy, const float radius)
 Check if a point (px,py) is inside a radius from a center point (cx,cy).
int dt_masks_find_closest_handle_common (dt_masks_form_t *mask_form, dt_masks_form_gui_t *mask_gui, int form_index, int node_count_override, const dt_masks_hit_callbacks_t *callbacks)
 Shared selection logic for node/handle/segment hit testing.
void dt_masks_creation_mode_quit (dt_masks_form_gui_t *gui)
 Exit mask creation mode, restoring cursor visibility and resetting GUI state.
gboolean dt_masks_creation_mode_enter (dt_develop_t *dev, dt_iop_module_t *module, const dt_masks_type_t type)
 Enter mask creation mode for a given shape type.
void _masks_gui_delete_node_callback (GtkWidget *menu, gpointer user_data)
GdkModifierType dt_masks_get_accel_mods (dt_masks_interaction_t interaction)
GtkWidget * dt_masks_create_menu (dt_masks_form_gui_t *gui, dt_masks_form_t *form, const dt_masks_form_group_t *fpt, const float pzx, const float pzy)
GtkWidget * dt_masks_gui_add_interaction_slider (GtkWidget *menu, const char *label, dt_develop_t *dev, int group_id, int formid, dt_masks_interaction_t interaction, dt_masks_increment_t increment, float min, float max, float step, float value, int digits, const char *format, float factor, dt_masks_form_gui_t *gui, struct dt_iop_module_t *module)
 Append a bauhaus-slider menu item to a mask context menu, bound to one shape interaction (size, fading, rotation, opacity). Shared by the darkroom canvas context menu (dt_masks_create_menu) and the blend module's own shape-list context menus, so both stay in sync.
void dt_masks_gui_populate_interaction_sliders (GtkWidget *menu, dt_develop_t *dev, dt_masks_form_t *form, int group_id, dt_masks_form_gui_t *gui, struct dt_iop_module_t *module)
 Append the full set of shape-parameter sliders (size/fading/rotation or curvature/fade/rotation depending on shape type, plus opacity) for form/op_form to menu. op_form is the group-membership entry the sliders read/write (see dt_masks_form_group_t) and must already be a live, COW-safe pointer into the owning group's points list.
int dt_masks_gui_confirm_delete_form_dialog (const char *form_name)
gboolean dt_masks_gui_confirm_permanent_delete (const char *form_name)
 Ask the user to confirm a permanent shape deletion, gated by the "ask_before_delete_mask_shape" pref. Shows a "Always ask" checkbox that writes back to the pref regardless of the response. Returns TRUE immediately without showing anything when the pref is off.
void dt_masks_iop_value_changed_callback (GtkWidget *widget, struct dt_iop_module_t *module)
void dt_masks_iop_combo_populate (GtkWidget *w, void *module)

Detailed Description

The interactive half of the masks subsystem: the editing state (dt_masks_form_gui_t), hit-testing, event dispatchers, drawing helpers, shape buttons, menus and dialogs.

Cut out of develop/masks.h so that the data model and the rasterisation API no longer feed widgets/draw.h (and GTK behind it) to every consumer that only wants get_mask() – which was every IOP that includes blend.h. This header is what the darkroom view, libs/shape_manager.c, blend_gui.c and the shape editors include.

Definition in file masks_gui.h.

Macro Definition Documentation

◆ menu_item_set_fake_accel

#define menu_item_set_fake_accel ( menu_item,
keyval,
mods )
Value:
\
{ \
GtkWidget *child = gtk_bin_get_child(GTK_BIN(menu_item)); \
if(GTK_IS_ACCEL_LABEL(child)) \
gtk_accel_label_set_accel(GTK_ACCEL_LABEL(child), keyval, mods); \
}
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98

Contextual menu

Definition at line 989 of file masks_gui.h.

Referenced by _polygon_populate_context_menu(), and dt_masks_create_menu().

Typedef Documentation

◆ dt_masks_border_handle_fn

typedef gboolean(* dt_masks_border_handle_fn) (const dt_masks_form_gui_points_t *gui_points, int node_count, int node_index, float *handle_x, float *handle_y, const void *user_data)

Shape-specific callback to fetch a node's border handle in GUI space.

Returns
TRUE if the handle is valid and written to (handle_x, handle_y).

Definition at line 924 of file masks_gui.h.

◆ dt_masks_curve_handle_fn

typedef void(* dt_masks_curve_handle_fn) (const dt_masks_form_gui_points_t *gui_points, int node_index, float *handle_x, float *handle_y, const void *user_data)

Shape-specific callback to fetch a node's curve handle in GUI space.

The handle is only queried for non-cusp nodes; implementations may assume that.

Definition at line 931 of file masks_gui.h.

◆ dt_masks_distance_fn

typedef void(* dt_masks_distance_fn) (float pointer_x, float pointer_y, float cursor_radius, dt_masks_form_gui_t *mask_gui, int form_index, int node_count, int *inside, int *inside_border, int *near_handle, int *inside_source, float *dist, const void *user_data)

Shape-specific callback for inside/border/segment hit testing.

This mirrors the per-shape *_get_distance() APIs and returns the same outputs. The dist output is a squared distance in absolute output-image coordinates.

Definition at line 946 of file masks_gui.h.

◆ dt_masks_form_gui_points_t

typedef struct dt_masks_form_gui_points_t dt_masks_form_gui_points_t

structure used to define all the gui points to draw in viewport

◆ dt_masks_form_gui_t

typedef struct dt_masks_form_gui_t dt_masks_form_gui_t

structure used to display a form

◆ dt_masks_gui_center_point_t

typedef struct dt_masks_gui_center_point_t dt_masks_gui_center_point_t

◆ dt_masks_hit_callbacks_t

typedef struct dt_masks_hit_callbacks_t dt_masks_hit_callbacks_t

The shape-specific half of dt_masks_find_closest_handle_common(). Any member may be NULL.

◆ dt_masks_node_position_fn

typedef void(* dt_masks_node_position_fn) (const dt_masks_form_gui_points_t *gui_points, int node_index, float *node_x, float *node_y, const void *user_data)

Shape-specific callback to fetch a node's position in GUI space.

When NULL, the common helper assumes Bezier-like layout at points[k*6+2].

Definition at line 938 of file masks_gui.h.

◆ dt_masks_overlay_transform_t

typedef struct dt_masks_overlay_transform_t dt_masks_overlay_transform_t

How the overlay maps image coordinates onto its cairo target.

The darkroom passes NULL and the mapping comes from the viewport – zoom, pan, and the GUI's device pixel ratio. None of that exists outside the GUI: dt_gui_get_global() is darktable.gui, which is NULL in ansel-cli and in the test binaries, so the viewport path would dereference it. A headless caller supplies its own mapping instead, which is also what a regression test wants – a fixed, reproducible transform rather than whatever the window happened to be showing.

This exists so the OVERLAY IS DRAWN BY THE SAME CODE in both cases. The alternative – a second drawing path for diagnostics – would be a fork that stops agreeing with the GUI exactly when it is needed to explain a GUI problem.

◆ dt_masks_post_select_fn

typedef void(* dt_masks_post_select_fn) (dt_masks_form_gui_t *mask_gui, int inside, int inside_border, int inside_source, const void *user_data)

Optional hook to customize selection flags after inside/border/source resolution.

Definition at line 953 of file masks_gui.h.

◆ dt_masks_preview_buffers_t

typedef struct dt_masks_preview_buffers_t dt_masks_preview_buffers_t

◆ dt_masks_scroll_modifier_t

Mouse-wheel mapping.

Which mask property the wheel edits is the user's choice, not a rule baked into each shape: one row per wheel/modifier combination, each holding the property it acts on (or DT_MASKS_INTERACTION_UNDEF for "does nothing"). The mapping is application-wide – it is a user habit, not a property of one shape or one module – and persists in conf.

Shapes never read key modifiers: dt_masks_events_mouse_scrolled() resolves the row once and hands the result to the shape's mouse_scrolled callback, which acts on the named property or ignores the event. A shape that does not own the property (rotating a circle) ignores it too.

◆ dt_masks_shape_button_index_t

◆ dt_masks_shape_buttons_config_t

typedef struct dt_masks_shape_buttons_config_t dt_masks_shape_buttons_config_t

◆ dt_masks_shape_buttons_flags_t

◆ dt_masks_shape_buttons_notify_f

typedef void(* dt_masks_shape_buttons_notify_f) (GtkWidget *button, dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data)

Definition at line 521 of file masks_gui.h.

◆ dt_masks_shape_buttons_start_f

typedef gboolean(* dt_masks_shape_buttons_start_f) (GtkWidget *button, dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data)

Definition at line 517 of file masks_gui.h.

◆ dt_masks_shape_buttons_type_f

typedef dt_masks_type_t(* dt_masks_shape_buttons_type_f) (dt_iop_module_t *module, dt_masks_type_t type, gpointer user_data)

Definition at line 519 of file masks_gui.h.

Enumeration Type Documentation

◆ dt_masks_scroll_modifier_t

Mouse-wheel mapping.

Which mask property the wheel edits is the user's choice, not a rule baked into each shape: one row per wheel/modifier combination, each holding the property it acts on (or DT_MASKS_INTERACTION_UNDEF for "does nothing"). The mapping is application-wide – it is a user habit, not a property of one shape or one module – and persists in conf.

Shapes never read key modifiers: dt_masks_events_mouse_scrolled() resolves the row once and hands the result to the shape's mouse_scrolled callback, which acts on the named property or ignores the event. A shape that does not own the property (rotating a circle) ignores it too.

Enumerator
DT_MASKS_SCROLL_PLAIN 
DT_MASKS_SCROLL_SHIFT 
DT_MASKS_SCROLL_PRIMARY 
DT_MASKS_SCROLL_PRIMARY_SHIFT 
DT_MASKS_SCROLL_MODIFIER_LAST 

Definition at line 793 of file masks_gui.h.

◆ dt_masks_shape_button_index_t

Enumerator
DT_MASKS_SHAPE_INDEX_GRADIENT 
DT_MASKS_SHAPE_INDEX_POLYGON 
DT_MASKS_SHAPE_INDEX_ELLIPSE 
DT_MASKS_SHAPE_INDEX_CIRCLE 
DT_MASKS_SHAPE_INDEX_BRUSH 

Definition at line 488 of file masks_gui.h.

◆ dt_masks_shape_buttons_flags_t

Enumerator
DT_MASKS_SHAPE_BUTTONS_NONE 

Do not create any shape button.

DT_MASKS_SHAPE_BUTTONS_CIRCLE 

Create/register the circle button.

DT_MASKS_SHAPE_BUTTONS_ELLIPSE 

Create/register the ellipse button.

DT_MASKS_SHAPE_BUTTONS_POLYGON 

Create/register the polygon button.

DT_MASKS_SHAPE_BUTTONS_BRUSH 

Create/register the brush button.

DT_MASKS_SHAPE_BUTTONS_GRADIENT 

Create/register the gradient button.

DT_MASKS_SHAPE_BUTTONS_ALL 

Create/register every shape button.

Definition at line 497 of file masks_gui.h.

Function Documentation

◆ _masks_gui_delete_node_callback()

◆ dt_group_events_post_expose()

void dt_group_events_post_expose ( cairo_t * cr,
float zoom_scale,
dt_masks_form_t * form,
dt_masks_form_gui_t * gui )

◆ dt_group_events_post_expose_except()

void dt_group_events_post_expose_except ( cairo_t * cr,
float zoom_scale,
dt_masks_form_t * form,
dt_masks_form_gui_t * gui,
int except_pos )

Draw every member of form but the one at except_pos, in the group's order.

Definition at line 165 of file group.c.

References _group_events_post_expose_draw(), and dt_masks_form_t::points.

Referenced by _static_layer_ensure().

◆ dt_group_events_post_expose_only()

void dt_group_events_post_expose_only ( cairo_t * cr,
float zoom_scale,
dt_masks_form_t * form,
dt_masks_form_gui_t * gui,
int pos )

Draw the member of form at pos alone; nothing for a position the group has not.

Definition at line 173 of file group.c.

References _group_events_post_expose_draw(), and dt_masks_form_t::points.

Referenced by _overlay_draw_form().

◆ dt_masks_append_form()

◆ dt_masks_apply_increment()

◆ dt_masks_apply_increment_precomputed()

float dt_masks_apply_increment_precomputed ( float current,
float amount,
float scale_amount,
float offset_amount,
dt_masks_increment_t increment )

Apply a scroll increment using precomputed scale/offset factors.

Definition at line 5303 of file masks_gui.c.

References DT_MASKS_INCREMENT_ABSOLUTE, DT_MASKS_INCREMENT_OFFSET, and DT_MASKS_INCREMENT_SCALE.

Referenced by _brush_resize_part(), and _change_fading().

◆ dt_masks_border_from_projected_handle()

float dt_masks_border_from_projected_handle ( dt_develop_t * dev,
const float node[2],
const float projected_image_pos[2],
const float scale_ref )
inlinestatic

◆ dt_masks_calculate_source_pos_origin()

void dt_masks_calculate_source_pos_origin ( dt_masks_form_gui_t * mask_gui,
const float initial_xpos,
const float initial_ypos,
const float xpos,
const float ypos,
float * pos_x,
float * pos_y,
const int adding )

◆ dt_masks_center_view_on_form()

int dt_masks_center_view_on_form ( struct dt_develop_t * dev,
const struct dt_masks_form_t * form )

References dev, and value.

◆ dt_masks_change_form_gui()

◆ dt_masks_clear_form_gui()

void dt_masks_clear_form_gui ( dt_develop_t * dev)

Definition at line 4820 of file masks_gui.c.

References dt_masks_form_gui_t::border_selected, dt_masks_form_gui_t::border_toggling, dt_masks_form_gui_t::creation_closing_form, dt_masks_form_gui_t::creation_formids, dt_masks_form_gui_t::creation_last_formid, dt_masks_form_gui_t::creation_module, dt_masks_form_gui_t::creation_type, dt_masks_form_gui_t::delta, dt_masks_creation_mode_quit(), dt_masks_dynbuf_free(), DT_MASKS_EDIT_OFF, dt_masks_form_gui_points_free(), DT_MASKS_NONE, DT_MASKS_PRESSURE_OFF, dt_masks_select_form(), dt_masks_form_gui_t::edit_mode, FALSE, dt_masks_form_gui_t::form_dragging, dt_develop_t::form_gui, dt_masks_form_gui_t::form_rotating, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::formid, dt_masks_form_gui_t::geometry_generation, dt_masks_form_gui_t::gradient_toggling, dt_masks_form_gui_t::group_selected, dt_masks_form_gui_t::guipoints, dt_masks_form_gui_t::guipoints_count, dt_masks_form_gui_t::guipoints_payload, dt_masks_form_gui_t::handle_border_dragging, dt_masks_form_gui_t::handle_border_hovered, dt_masks_form_gui_t::handle_border_selected, dt_masks_form_gui_t::handle_dragging, dt_masks_form_gui_t::handle_hovered, dt_masks_form_gui_t::handle_selected, IS_NULL_PTR, dt_masks_form_gui_t::last_hit_test_pos, dt_masks_form_gui_t::last_rebuild_pos, dt_masks_form_gui_t::last_rebuild_ts, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_gui_t::node_selected_idx, dt_masks_form_gui_t::pivot_selected, dt_masks_form_gui_t::points, dt_masks_form_gui_t::pressure_sensitivity, dt_masks_form_gui_t::rebuild_pending, dt_masks_form_gui_t::scrollx, dt_masks_form_gui_t::scrolly, dt_masks_form_gui_t::seg_dragging, dt_masks_form_gui_t::seg_hovered, dt_masks_form_gui_t::seg_selected, dt_masks_form_gui_t::source_dragging, and dt_masks_form_gui_t::source_selected.

Referenced by _masks_remove_or_delete_finish(), _masks_remove_shape(), dt_masks_change_form_gui(), dt_masks_gui_cleanup(), and dt_masks_gui_init().

◆ dt_masks_create_menu()

GtkWidget * dt_masks_create_menu ( dt_masks_form_gui_t * gui,
dt_masks_form_t * form,
const dt_masks_form_group_t * fpt,
const float pzx,
const float pzy )

Definition at line 866 of file masks_gui.c.

References _masks_gui_delete_node_callback(), _masks_gui_exit_creation_callback(), _masks_gui_full_delete_callback(), _masks_gui_remove_from_group_callback(), _masks_movedown_callback(), _masks_moveup_callback(), dt_masks_form_gui_t::creation, ctx_gtk_menu_item_new_with_markup(), ctx_gtk_menu_item_new_with_markup_and_pixbuf(), dt_masks_form_gui_t::dev, dt_draw_get_pixbuf_from_cairo(), dt_free, DT_MASKS_BRUSH, DT_MASKS_CIRCLE, DT_MASKS_ELLIPSE, dt_masks_form_group_from_parentid(), dt_masks_get_from_id(), DT_MASKS_GRADIENT, DT_MASKS_GROUP, dt_masks_gui_populate_interaction_sliders(), DT_MASKS_IS_RETOUCHE, DT_MASKS_POLYGON, DT_MASKS_STATE_DIFFERENCE, DT_MASKS_STATE_EXCLUSION, DT_MASKS_STATE_INTERSECTION, DT_MASKS_STATE_INVERSE, DT_MASKS_STATE_IS_COMBINE_OP, DT_MASKS_STATE_UNION, DT_PIXEL_APPLY_DPI, dtgtk_cairo_paint_masks_difference(), dtgtk_cairo_paint_masks_exclusion(), dtgtk_cairo_paint_masks_intersection(), dtgtk_cairo_paint_masks_inverse(), dtgtk_cairo_paint_masks_union(), FALSE, dt_masks_form_gui_t::form_selected, dt_masks_form_group_t::formid, dt_masks_form_t::formid, dt_masks_form_t::functions, dt_develop_t::gui_module, IS_NULL_PTR, k, masks_gtk_menu_item_new_bold, MAX, menu_item_set_fake_accel, dt_masks_form_t::name, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_group_t::parentid, dt_masks_form_t::points, dt_masks_functions_t::populate_context_menu, dt_iop_module_t::populate_masks_context_menu, dt_masks_form_gui_t::seg_hovered, dt_masks_form_group_t::state, state, TRUE, dt_masks_form_t::type, and width.

Referenced by dt_masks_events_button_pressed().

◆ dt_masks_creation_mode_enter()

gboolean dt_masks_creation_mode_enter ( dt_develop_t * dev,
dt_iop_module_t * module,
const dt_masks_type_t type )

Enter mask creation mode for a given shape type.

NOTE: this does quite the same as _menu_add_shape.

Definition at line 5805 of file masks_gui.c.

References dev, dt_gui_center_widget(), dt_iop_request_focus(), DT_MASKS_ALL, dt_masks_change_form_gui(), dt_masks_create(), dt_masks_shape_buttons_sync_all(), FALSE, IS_NULL_PTR, TRUE, and type.

Referenced by _add_shape(), _masks_shape_button_pressed(), _menu_add_shape(), _tree_add_shape(), and rt_select_algorithm_callback().

◆ dt_masks_creation_mode_quit()

void dt_masks_creation_mode_quit ( dt_masks_form_gui_t * mask_gui)

Exit mask creation mode, restoring cursor visibility and resetting GUI state.

Parameters
mask_guiThe GUI state of the mask form

Definition at line 5793 of file masks_gui.c.

References dt_masks_form_gui_t::creation, FALSE, and IS_NULL_PTR.

Referenced by dt_masks_clear_form_gui(), and dt_masks_form_exit_creation().

◆ dt_masks_delete_shape()

gboolean dt_masks_delete_shape ( struct dt_iop_module_t * module,
dt_masks_form_t * sel,
int parent_id,
dt_masks_form_gui_t * mask_gui,
int form_id )

Permanently delete the form from every group and from dev->forms. Gated by dt_masks_gui_confirm_permanent_delete() (itself gated by the "ask_before_delete_mask_shape" pref).

Returns
gboolean TRUE if the form was deleted, FALSE otherwise (dialog cancelled)

Definition at line 2272 of file masks_gui.c.

References _masks_remove_or_delete_finish(), dt_masks_gui_confirm_permanent_delete(), FALSE, IS_NULL_PTR, and dt_masks_form_t::name.

Referenced by _masks_gui_full_delete_callback().

◆ dt_masks_draw_outline_runs()

void dt_masks_draw_outline_runs ( cairo_t * cr,
const float *const points,
const int first,
const int last,
const dt_masks_skip_range_t * skips,
const int skip_count )

Append a shape's outline to cr as the complement of its exclusion list: one cairo sub-path per run between the spans in skips, which are where the offset curve doubles back on itself and must not be drawn. Pass NULL and 0 for a shape with nothing to exclude. Implemented in masks/masks_gui.c – see there for why the excluded spans travel beside the buffer and not inside it.

Definition at line 6092 of file masks_gui.c.

References _emit_run(), dt_draw_min_emit_step(), IS_NULL_PTR, and MAX.

Referenced by _brush_draw_shape(), _brush_events_post_expose(), and _polygon_draw_shape().

◆ dt_masks_draw_path_seg_by_seg()

void dt_masks_draw_path_seg_by_seg ( cairo_t * cr,
dt_masks_form_gui_t * gui,
const int index,
const float * points,
const int points_count,
const int node_count,
const float zoom_scale,
const gboolean centreline )

Stroke a shape's path one node-to-node segment at a time.

Parameters
centrelineTRUE for a brush's centreline: an open path, dotted. FALSE for a closed outline, solid.

Definition at line 3526 of file masks_gui.c.

References dt_masks_form_gui_t::creation, dt_draw_min_emit_step(), dt_draw_stroke_line(), DT_MASKS_DASH_ROUND, dt_masks_gui_selected_segment_index(), dt_masks_is_anything_selected(), DT_MASKS_NO_DASH, FALSE, dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::group_selected, and IS_NULL_PTR.

Referenced by _brush_events_post_expose(), and _polygon_events_post_expose().

◆ dt_masks_draw_preview_shape()

void dt_masks_draw_preview_shape ( struct dt_develop_t * dev,
cairo_t * cr,
const float zoom_scale,
const int num_points,
float * points,
const int points_count,
float * border,
const int border_count,
const shape_draw_function_t * draw_shape,
const cairo_line_cap_t shape_cap,
const cairo_line_cap_t border_cap,
const gboolean save_restore,
const gboolean source )
inlinestatic

◆ dt_masks_draw_source()

void dt_masks_draw_source ( cairo_t * cr,
dt_masks_form_gui_t * gui,
const int index,
const int nb,
const float zoom_scale,
struct dt_masks_gui_center_point_t * center_point,
const shape_draw_function_t * draw_shape_func )

◆ dt_masks_draw_source_preview()

void dt_masks_draw_source_preview ( cairo_t * cr,
const float zoom_scale,
dt_masks_form_gui_t * gui,
const float initial_xpos,
const float initial_ypos,
const float xpos,
const float ypos,
const int adding )
inlinestatic

◆ dt_masks_events_button_pressed()

◆ dt_masks_events_button_released()

◆ dt_masks_events_key_pressed()

◆ dt_masks_events_mouse_enter()

int dt_masks_events_mouse_enter ( struct dt_iop_module_t * module)

Definition at line 2707 of file masks_gui.c.

Referenced by mouse_enter().

◆ dt_masks_events_mouse_leave()

int dt_masks_events_mouse_leave ( struct dt_iop_module_t * module)

Definition at line 2702 of file masks_gui.c.

Referenced by mouse_leave().

◆ dt_masks_events_mouse_moved()

int dt_masks_events_mouse_moved ( dt_develop_t * dev,
struct dt_iop_module_t * module,
double x,
double y,
double pressure,
int which )

◆ dt_masks_events_mouse_scrolled()

◆ dt_masks_events_post_expose()

void dt_masks_events_post_expose ( dt_develop_t * dev,
struct dt_iop_module_t * module,
cairo_t * cr,
int32_t width,
int32_t height,
int32_t pointerx,
int32_t pointery )

Definition at line 4060 of file masks_gui.c.

References dev, dt_masks_events_post_expose_with(), height, and width.

Referenced by expose().

◆ dt_masks_events_post_expose_with()

◆ dt_masks_find_closest_handle_common()

int dt_masks_find_closest_handle_common ( dt_masks_form_t * mask_form,
dt_masks_form_gui_t * mask_gui,
int form_index,
int node_count_override,
const dt_masks_hit_callbacks_t * callbacks )

Shared selection logic for node/handle/segment hit testing.

The shape-specific callbacks supply handles and distance tests while this function performs common selection bookkeeping on dt_masks_form_gui_t.

The cached cursor in mask_gui->pos is authoritative for hit testing.

Shared selection logic for node/handle/segment hit testing.

This function:

  • Translates pointer coordinates into GUI space,
  • Resets selection flags,
  • Tests border/curve handles and nodes,
  • Delegates inside/border/segment tests to the shape callback.

node_count_override can be used for shapes that don't expose nodes via GList (e.g. gradient/ellipse control points). Pass -1 to use g_list_length().

Callers provide shape-specific callbacks for handles and distance tests.

The cached cursor in mask_gui->pos is authoritative for hit testing.

Definition at line 1184 of file masks_gui.c.

References dt_masks_hit_callbacks_t::border_handle, dt_masks_form_gui_t::border_selected, dt_masks_form_gui_t::creation, dt_masks_hit_callbacks_t::curve_handle, dt_masks_hit_callbacks_t::distance, DT_GUI_MOUSE_EFFECT_RADIUS, dt_masks_gui_selected_node_index(), dt_masks_gui_was_anything_selected(), dt_masks_node_is_cusp(), dt_masks_point_is_within_radius(), FALSE, dt_masks_form_gui_t::form_selected, dt_masks_form_gui_t::group_selected, dt_masks_form_gui_t::handle_border_dragging, dt_masks_form_gui_t::handle_border_hovered, dt_masks_form_gui_t::handle_border_solid, dt_masks_form_gui_t::handle_dragging, dt_masks_form_gui_t::handle_hovered, IS_NULL_PTR, dt_masks_form_gui_t::node_dragging, dt_masks_form_gui_t::node_hovered, dt_masks_hit_callbacks_t::node_position, dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_masks_form_t::points, dt_masks_form_gui_t::pos, dt_masks_hit_callbacks_t::post_select, dt_masks_form_gui_t::seg_dragging, dt_masks_form_gui_t::seg_hovered, dt_masks_hit_callbacks_t::solid_handle, dt_masks_form_gui_t::source_selected, TRUE, dt_masks_hit_callbacks_t::user_data, and dt_masks_form_t::uses_bezier_points_layout.

Referenced by _find_closest_handle(), _find_closest_handle(), _find_closest_handle(), _find_closest_handle(), and _find_closest_handle().

◆ dt_masks_form_exit_creation()

gboolean dt_masks_form_exit_creation ( dt_iop_module_t * module,
dt_masks_form_gui_t * gui )

Definition at line 2280 of file masks_gui.c.

References dt_iop_module_gui_t::blend_data, dt_masks_form_gui_t::border_selected, dt_masks_form_gui_t::creation, dt_masks_form_gui_t::creation_formids, dt_masks_form_gui_t::creation_last_formid, dt_masks_form_gui_t::creation_module, dt_masks_form_gui_t::creation_type, dev, dt_masks_form_gui_t::dev, dt_dev_masks_selection_change(), dt_iop_gui_blend_masks_update(), dt_masks_change_form_gui(), dt_masks_creation_mode_quit(), dt_masks_dynbuf_free(), DT_MASKS_EDIT_FULL, dt_masks_free_form(), dt_masks_get_from_id(), dt_masks_get_visible_form(), dt_masks_group_index_from_formid(), DT_MASKS_NONE, dt_masks_set_edit_mode(), dt_masks_set_visible_form(), dt_masks_shape_buttons_deactivate_all(), FALSE, dt_masks_form_gui_t::form_dragging, dt_masks_form_gui_t::form_rotating, dt_masks_form_gui_t::form_selected, dt_masks_form_t::formid, dt_masks_form_gui_t::group_selected, dt_iop_module_t::gui, dt_masks_form_gui_t::guipoints, dt_masks_form_gui_t::guipoints_count, dt_masks_form_gui_t::guipoints_payload, dt_masks_form_gui_t::handle_border_selected, dt_masks_form_gui_t::handle_selected, IS_NULL_PTR, dt_iop_gui_blend_data_t::masks_edit, dt_iop_gui_blend_data_t::masks_shown, dt_masks_form_gui_t::node_selected, dt_masks_form_gui_t::node_selected_idx, dt_masks_form_gui_t::pivot_selected, dt_masks_form_gui_t::seg_selected, dt_masks_form_gui_t::source_dragging, dt_masks_form_gui_t::source_selected, and TRUE.

Referenced by _group_events_key_pressed(), _masks_gui_delete_node_callback(), _masks_gui_exit_creation_callback(), _masks_shape_button_pressed(), _polygon_events_key_pressed(), dt_dev_add_history_item_real(), dt_dev_history_gui_update(), dt_masks_events_key_pressed(), dt_masks_gui_cleanup(), dt_masks_gui_form_save_creation(), and dt_masks_gui_remove().

◆ dt_masks_form_get_gravity_center()

gboolean dt_masks_form_get_gravity_center ( dt_develop_t * dev,
const struct dt_masks_form_t * form,
float center[2],
float * area )

References dev.

◆ dt_masks_form_get_interaction_value()

◆ dt_masks_form_get_selected_group()

dt_masks_form_group_t * dt_masks_form_get_selected_group ( const struct dt_masks_form_t * form,
const struct dt_masks_form_gui_t * gui )

◆ dt_masks_form_get_selected_group_live()

dt_masks_form_group_t * dt_masks_form_get_selected_group_live ( const struct dt_masks_form_t * form,
const struct dt_masks_form_gui_t * gui )

Return the currently selected group entry, resolving to the live form group when the GUI is operating on a temporary copy (for example the visible group created for editing).

The selection is taken from gui->group_selected. If the selected entry belongs to a temporary group (non-zero parentid), the function resolves and returns the corresponding entry from the real group in dev->forms.

References dev.

◆ dt_masks_form_group_find_entry()

dt_masks_form_group_t * dt_masks_form_group_find_entry ( dt_masks_form_t * group_form,
const int form_id,
int * out_index )

Find the group-membership entry for formid inside group_form's own points list (not recursive into subgroups) – the shared primitive behind every "find this shape's row within its parent group" call site.

Parameters
out_indexif non-NULL, receives the entry's position in the list (-1 if not found).

Find the group-membership entry for formid inside group_form's own points list (not recursive into subgroups) – the shared primitive behind every "find this shape's row within its parent group" call site.

Assumption: only valid for DT_MASKS_GROUP forms.

Parameters
out_indexif non-NULL, receives the entry's position in the list (-1 if not found).

Definition at line 1376 of file masks_gui.c.

References DT_MASKS_GROUP, dt_masks_form_group_t::formid, IS_NULL_PTR, dt_masks_form_t::points, and dt_masks_form_t::type.

Referenced by _blendop_masks_all_toggled(), _blendop_masks_group_update_row(), _blendop_masks_refresh_lists(), and dt_masks_form_group_from_parentid().

◆ dt_masks_form_group_from_parentid()

dt_masks_form_group_t * dt_masks_form_group_from_parentid ( dt_develop_t * dev,
int parent_id,
int form_id )

Return the group entry for a (parent, form) pair.

Getters and setters for direct GUI interaction

Caveat: returns NULL if parent isn't a group or the entry is missing.

Definition at line 1497 of file masks_gui.c.

References dev, dt_masks_form_group_find_entry(), dt_masks_get_from_id(), DT_MASKS_GROUP, IS_NULL_PTR, and dt_masks_form_t::type.

Referenced by dt_masks_create_menu(), and dt_masks_form_get_selected_group_live().

◆ dt_masks_form_invalidate_gravity_center()

void dt_masks_form_invalidate_gravity_center ( struct dt_masks_form_t * form)

Marks gravity_center/area stale instead of recomputing them right away. Use for bulk paths (loading history, undo/redo) that swap in many forms at once; the one GUI hit-testing read site recomputes lazily on first actual use.

Definition at line 1342 of file masks.c.

References FALSE, dt_masks_form_t::gravity_center_valid, and IS_NULL_PTR.

Referenced by dt_masks_replace_current_forms().

◆ dt_masks_form_set_interaction_value()

◆ dt_masks_form_update_gravity_center()

◆ dt_masks_get_accel_mods()

GdkModifierType dt_masks_get_accel_mods ( dt_masks_interaction_t interaction)

References dev, factor, max, min, and value.

◆ dt_masks_get_form_size_from_nodes()

float dt_masks_get_form_size_from_nodes ( const GList * points)
inlinestatic

Definition at line 278 of file masks_gui.h.

References IS_NULL_PTR.

Referenced by _brush_get_interaction_value(), and _polygon_get_interaction_value().

◆ dt_masks_get_set_conf_value()

float dt_masks_get_set_conf_value ( dt_masks_form_t * form,
char * feature,
float new_value,
float v_min,
float v_max,
dt_masks_increment_t increment,
const int flow )

Change a numerical property of a mask shape, either by in/de-crementing the current value or setting it in an absolute fashion, then save it to configuration.

Parameters
formthe shape to change. We will read its type internally
featurethe propertie to change: fading, size, curvature (for gradients)
new_valueif increment is set to absolute, this is directly the updated value. if increment is offset, the updated value is old_value + new_value. if increment is scale, the updated value is old value * new_value.
v_minminimum acceptable value of the property for sanitization
v_maxmaximum acceptable value of the property for sanitization
incrementthe increment type: absolute, offset or scale.
flowthe value of the scroll distance that can be postive or negative.

Definition at line 5318 of file masks_gui.c.

References _get_mask_plugin(), dt_conf_get_float(), dt_conf_set_float(), dt_free, dt_masks_apply_increment(), dt_masks_type_name(), MAX, MIN, and dt_masks_form_t::type.

Referenced by _brush_conf_resize_part(), _brush_events_button_pressed(), _brush_events_button_released(), _brush_events_post_expose(), _init_fading(), _init_size(), and dt_masks_get_set_conf_value_with_toast().

◆ dt_masks_get_set_conf_value_with_toast()

float dt_masks_get_set_conf_value_with_toast ( dt_masks_form_t * form,
const char * feature,
float amount,
float v_min,
float v_max,
dt_masks_increment_t increment,
int flow,
const char * toast_fmt,
float toast_scale )

Update a mask configuration value and emit a toast message.

This is a convenience wrapper around dt_masks_get_set_conf_value() that keeps UI feedback consistent across mask types.

Definition at line 5348 of file masks_gui.c.

References dt_masks_get_set_conf_value(), dt_toast_log(), IS_NULL_PTR, and value.

Referenced by _init_curvature(), _init_extent(), _init_fading(), _init_fading(), _init_opacity(), _init_opacity(), _init_opacity(), _init_opacity(), _init_rotation(), _init_rotation(), and _init_size().

◆ dt_masks_get_visible_form()

dt_masks_form_t * dt_masks_get_visible_form ( const struct dt_develop_t * dev)

References dev.

◆ dt_masks_group_add_form()

◆ dt_masks_group_add_form_with_state()

dt_masks_form_group_t * dt_masks_group_add_form_with_state ( dt_develop_t * dev,
dt_masks_form_t * grp,
dt_masks_form_t * form,
int parentid,
dt_masks_state_t state,
float opacity )

Add a shape to a group with an EXPLICIT combination state and opacity, rather than the defaults dt_masks_group_add_form() applies (SHOW|USE|UNION at the configured opacity).

This exists because three call sites wanted their own state and opacity and therefore built the membership row by hand – malloc, four assignments, g_list_append – which silently skipped both of the things the real adder does: the self-inclusion guard that stops a group containing itself, and the gravity-centre refresh the group needs before anything hit-tests it.

Takes the group by pointer, not by id, because the callers legitimately build into a group that is not in dev->forms yet: it is created, filled, and only then published. Copy-on-write is the caller's business here for the same reason – an unpublished group is referenced by nobody, and a published one must be touched before this is called, exactly as for dt_masks_group_add_form().

Parameters
parentidthe row's AUTHORED origin, which is NOT always the group holding it: two callers assemble a temporary group for an ungroup/regroup round trip and keep each row pointing at the group it really came from. Pass grp->formid unless you mean otherwise.
Returns
the new row, or NULL if the group is not a group or the add would nest it in itself.

Definition at line 5360 of file masks_gui.c.

References _find_in_group(), dev, dt_control_log(), dt_masks_form_update_gravity_center(), DT_MASKS_GROUP, dt_masks_form_group_t::formid, dt_masks_form_t::formid, IS_NULL_PTR, dt_masks_form_group_t::opacity, dt_masks_form_group_t::parentid, dt_masks_form_t::points, dt_masks_form_group_t::state, state, and dt_masks_form_t::type.

Referenced by _tree_group(), _tree_selection_change(), dt_masks_group_add_form(), and rt_show_forms_for_current_scale().

◆ dt_masks_group_index_from_formid()

int dt_masks_group_index_from_formid ( const dt_masks_form_t * group_form,
int formid )

Find any group that currently references formid, searching every top-level group in dev->forms and their nested subgroups (first match wins – a shape used by more than one module has no single "correct" answer). Meant for UI listings that show a shape without already knowing which group (if any) it belongs to, e.g. a flat "all shapes" row.

Parameters
out_parentidif non-NULL, receives the owning group's formid (0 if none found).

Definition at line 1396 of file masks_gui.c.

References DT_MASKS_GROUP, dt_masks_form_group_t::formid, IS_NULL_PTR, dt_masks_form_t::points, and dt_masks_form_t::type.

Referenced by _blendop_masks_group_selection_changed(), and dt_masks_form_exit_creation().

◆ dt_masks_group_ungroup()

◆ dt_masks_group_update_name()

◆ dt_masks_gui_add_interaction_slider()

GtkWidget * dt_masks_gui_add_interaction_slider ( GtkWidget * menu,
const char * label,
dt_develop_t * dev,
int group_id,
int formid,
dt_masks_interaction_t interaction,
dt_masks_increment_t increment,
float min,
float max,
float step,
float value,
int digits,
const char * format,
float factor,
dt_masks_form_gui_t * gui,
struct dt_iop_module_t * module )

Append a bauhaus-slider menu item to a mask context menu, bound to one shape interaction (size, fading, rotation, opacity). Shared by the darkroom canvas context menu (dt_masks_create_menu) and the blend module's own shape-list context menus, so both stay in sync.

Definition at line 520 of file masks_gui.c.

References _masks_gui_interaction_slider_changed(), _masks_gui_menu_item_block_activate(), _masks_gui_menu_item_forward_event(), data, dev, dt_bauhaus_get_global(), dt_bauhaus_slider_new_with_range(), dt_bauhaus_slider_set(), dt_bauhaus_slider_set_digits(), dt_bauhaus_slider_set_factor(), dt_bauhaus_slider_set_format(), DT_BAUHAUS_WIDGET, dt_bauhaus_widget_set_label(), DT_GUI_BOX_SPACING, DT_GUI_MODULE, DT_PIXEL_APPLY_DPI, factor, FALSE, g_free(), max, min, TRUE, and value.

Referenced by dt_masks_gui_populate_interaction_sliders().

◆ dt_masks_gui_change_affects_selected_node_or_all()

gboolean dt_masks_gui_change_affects_selected_node_or_all ( const dt_masks_form_gui_t * gui,
const int index )
inlinestatic

Definition at line 269 of file masks_gui.h.

References dt_masks_gui_selected_node_index(), IS_NULL_PTR, and TRUE.

Referenced by _change_fading(), _change_part(), and _change_size().

◆ dt_masks_gui_cleanup()

void dt_masks_gui_cleanup ( struct dt_develop_t * dev)

◆ dt_masks_gui_confirm_delete_form_dialog()

int dt_masks_gui_confirm_delete_form_dialog ( const char * form_name)

◆ dt_masks_gui_confirm_permanent_delete()

gboolean dt_masks_gui_confirm_permanent_delete ( const char * form_name)

Ask the user to confirm a permanent shape deletion, gated by the "ask_before_delete_mask_shape" pref. Shows a "Always ask" checkbox that writes back to the pref regardless of the response. Returns TRUE immediately without showing anything when the pref is off.

Definition at line 603 of file masks_gui.c.

References dt_conf_get_bool(), dt_conf_set_bool(), dt_gui_get_global(), dt_gui_get_ui(), dt_gui_main_window(), FALSE, IS_NULL_PTR, and TRUE.

Referenced by _blendop_masks_all_delete(), _blendop_masks_group_delete(), _tree_row_action(), and dt_masks_delete_shape().

◆ dt_masks_gui_cursor_to_raw_norm()

◆ dt_masks_gui_delta_from_raw_anchor()

void dt_masks_gui_delta_from_raw_anchor ( dt_develop_t * dev,
const dt_masks_form_gui_t * gui,
const float anchor[2],
float * delta_x,
float * delta_y )
inlinestatic

◆ dt_masks_gui_delta_to_image_abs()

void dt_masks_gui_delta_to_image_abs ( const dt_masks_form_gui_t * gui,
float point[2] )
inlinestatic

◆ dt_masks_gui_delta_to_raw_norm()

◆ dt_masks_gui_form_create()

void dt_masks_gui_form_create ( dt_masks_form_t * form,
dt_masks_form_gui_t * gui,
int index,
struct dt_iop_module_t * module )

functions used to manipulate gui data

Definition at line 1927 of file masks_gui.c.

References dt_masks_form_gui_points_t::border, dt_masks_form_gui_points_t::border_count, dt_masks_form_gui_points_t::border_skip_count, dt_masks_form_gui_points_t::border_skips, dt_masks_form_gui_t::dev, DT_DEBUG_MASKS, dt_geometry_chain_generation(), dt_get_debug_flags(), DT_MASKS_CLONE, dt_masks_form_update_gravity_center(), dt_masks_get_points_border(), dt_masks_gui_form_remove(), dt_masks_gui_outline_step(), dt_masks_gui_points_update_bbox(), DT_MASKS_RASTER_ERROR, DT_MASKS_RASTER_OK, dt_masks_solid_edge(), dt_pixelpipe_cache_free_align, dt_print(), dt_masks_form_gui_t::formid, dt_masks_form_t::formid, dt_develop_t::geometry_chain, dt_masks_form_gui_t::geometry_generation, IS_NULL_PTR, dt_masks_form_t::name, dt_masks_form_gui_t::outline_step_built, dt_masks_form_gui_points_t::points, dt_masks_form_gui_t::points, dt_masks_form_t::points, dt_masks_form_gui_points_t::points_count, dt_masks_form_gui_points_t::source, dt_masks_form_gui_points_t::source_count, TRUE, dt_masks_form_gui_t::type, and dt_masks_form_t::type.

Referenced by _add_node_to_segment(), _add_node_to_segment(), _brush_events_mouse_moved(), _change_curvature(), _change_extent(), _change_fading(), _change_fading(), _change_fading(), _change_part(), _change_rotation(), _change_rotation(), _change_size(), _change_size(), _change_size(), _circle_events_mouse_moved(), _dt_masks_events_flush_rebuild_if_needed(), _ellipse_events_button_released(), _ellipse_events_mouse_moved(), _gradient_events_button_pressed(), _gradient_events_button_released(), _gradient_events_mouse_moved(), _masks_draw_creation_session_forms(), _polygon_events_button_pressed(), _polygon_events_mouse_moved(), dt_masks_gui_form_create_throttled(), dt_masks_gui_form_test_create(), dt_masks_remove_node(), dt_masks_reset_bezier_ctrl_points(), and dt_masks_toggle_bezier_node_type().

◆ dt_masks_gui_form_create_throttled()

◆ dt_masks_gui_form_remove()

◆ dt_masks_gui_form_save_creation()

void dt_masks_gui_form_save_creation ( dt_develop_t * dev,
struct dt_iop_module_t * module,
dt_masks_form_t * form,
dt_masks_form_gui_t * gui )

Save the form creation right after a shape has been finished drawing.

Parameters
devthe develop structure
modulethe module owning the mask
formthe form to save
guithe GUI state of the form

Definition at line 2576 of file masks_gui.c.

References _check_id(), _group_create(), _group_from_module(), dt_masks_form_gui_t::creation_closing_form, dt_masks_form_gui_t::creation_formids, dt_masks_form_gui_t::creation_last_formid, dt_masks_form_gui_t::creation_type, dt_conf_get_float(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, dt_dev_history_commit_item_now(), dt_dev_history_flush_pending_commits(), dt_iop_gui_blend_masks_update(), dt_masks_append_form(), DT_MASKS_CLONE, dt_masks_cow_touch(), dt_masks_create(), dt_masks_dynbuf_free(), DT_MASKS_EVENT_ADD, dt_masks_form_exit_creation(), dt_masks_form_gui_points_free(), dt_masks_form_update_gravity_center(), DT_MASKS_GROUP, DT_MASKS_NON_CLONE, dt_masks_set_visible_form(), dt_masks_soft_reset_form_gui(), DT_MASKS_STATE_SHOW, DT_MASKS_STATE_UNION, DT_MASKS_STATE_USE, dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), DT_SIGNAL_MASK_CHANGED, FALSE, dt_masks_form_group_t::formid, dt_masks_form_gui_t::formid, dt_masks_form_t::formid, dt_develop_t::forms, dt_masks_form_t::functions, dt_masks_form_gui_t::geometry_generation, dt_masks_form_gui_t::guipoints, dt_masks_form_gui_t::guipoints_count, dt_masks_form_gui_t::guipoints_payload, IS_NULL_PTR, dt_develop_t::masks_mutex, dt_masks_form_t::name, dt_masks_form_group_t::opacity, dt_masks_form_group_t::parentid, dt_masks_form_gui_t::points, dt_masks_form_t::points, dt_masks_functions_t::set_form_name, dt_masks_form_group_t::state, TRUE, and dt_masks_form_t::type.

Referenced by _brush_events_button_released(), _circle_events_button_pressed(), _ellipse_events_button_pressed(), _gradient_events_button_pressed(), _polygon_creation_closing_form(), and legacy_params().

◆ dt_masks_gui_form_test_create()

◆ dt_masks_gui_init()

void dt_masks_gui_init ( struct dt_develop_t * dev)

◆ dt_masks_gui_is_dragging()

◆ dt_masks_gui_points_reach()

gboolean dt_masks_gui_points_reach ( const dt_masks_form_gui_points_t * gp,
const float x,
const float y,
const float reach )
inlinestatic

Can a cursor at (x, y), reaching reach around itself, touch a sample of gp at all: the box test every hit test runs before walking the samples. An empty box reaches nothing.

Definition at line 93 of file masks_gui.h.

References dt_masks_form_gui_points_t::bbox, and x.

Referenced by _brush_get_distance(), _circle_get_distance(), _ellipse_get_distance(), and _polygon_get_distance().

◆ dt_masks_gui_points_update_bbox()

◆ dt_masks_gui_populate_interaction_sliders()

void dt_masks_gui_populate_interaction_sliders ( GtkWidget * menu,
dt_develop_t * dev,
dt_masks_form_t * form,
int group_id,
dt_masks_form_gui_t * gui,
struct dt_iop_module_t * module )

Append the full set of shape-parameter sliders (size/fading/rotation or curvature/fade/rotation depending on shape type, plus opacity) for form/op_form to menu. op_form is the group-membership entry the sliders read/write (see dt_masks_form_group_t) and must already be a live, COW-safe pointer into the owning group's points list.

Definition at line 799 of file masks_gui.c.

References dev, DT_MASKS_ELLIPSE, dt_masks_form_get_interaction_value(), DT_MASKS_GRADIENT, dt_masks_group_get_member(), dt_masks_gui_add_interaction_slider(), DT_MASKS_INCREMENT_ABSOLUTE, DT_MASKS_INCREMENT_SCALE, DT_MASKS_INTERACTION_FADING, DT_MASKS_INTERACTION_OPACITY, DT_MASKS_INTERACTION_ROTATION, DT_MASKS_INTERACTION_SIZE, DT_MASKS_OK, dt_masks_form_t::formid, IS_NULL_PTR, and dt_masks_form_t::type.

Referenced by _blendop_masks_group_ctx_menu(), _tree_context_menu(), and dt_masks_create_menu().

◆ dt_masks_gui_remove()

gboolean dt_masks_gui_remove ( struct dt_iop_module_t * module,
dt_masks_form_t * form,
dt_masks_form_gui_t * gui,
const int parentid )

remove a mask shape or node form from the GUI. This function is used with a popupmenu "Delete" action.

Parameters
moduleThe module owning the mask
formThe form to remove
guiThe GUI state of the form
parentidThe parent ID of the form
Returns
gboolean TRUE if the form was removed, FALSE otherwise

Definition at line 2408 of file masks_gui.c.

References _masks_remove_shape(), DT_MASKS_EDIT_FULL, dt_masks_form_exit_creation(), DT_MASKS_IS_PATH_SHAPE, dt_masks_remove_node(), dt_masks_remove_or_delete(), dt_masks_form_gui_t::edit_mode, FALSE, dt_masks_form_t::formid, g_list_shorter_than(), dt_masks_form_gui_t::group_selected, dt_masks_form_gui_t::node_hovered, dt_masks_form_gui_t::node_selected, dt_masks_form_t::points, TRUE, and dt_masks_form_t::type.

Referenced by _group_events_key_pressed(), and dt_masks_events_key_pressed().

◆ dt_masks_gui_reset_dragging()

◆ dt_masks_gui_selected_handle_border_index()

int dt_masks_gui_selected_handle_border_index ( const dt_masks_form_gui_t * gui)
inlinestatic

◆ dt_masks_gui_selected_handle_index()

◆ dt_masks_gui_selected_node_index()

◆ dt_masks_gui_selected_segment_index()

int dt_masks_gui_selected_segment_index ( const dt_masks_form_gui_t * gui)
inlinestatic

◆ dt_masks_gui_set_dragging()

◆ dt_masks_gui_set_outline_density()

void dt_masks_gui_set_outline_density ( dt_masks_form_gui_t * gui,
double image_px_per_device_px )

Publish the density the view shows into the dev's GUI state: image_px_per_device_px is what one device pixel spans in image pixels (dt_draw_min_emit_step() on the transformed context). The outlines are sampled at whole image pixels, never finer than one. dt_masks_gui_outline_step() (masks/masks_distort.h) reads it back.

Definition at line 1914 of file masks_gui.c.

References IS_NULL_PTR, and dt_masks_form_gui_t::outline_step.

Referenced by _outline_density_apply(), and dt_masks_events_post_expose_with().

◆ dt_masks_gui_should_hit_test()

gboolean dt_masks_gui_should_hit_test ( dt_masks_form_gui_t * gui)
inlinestatic

◆ dt_masks_gui_was_anything_selected()

gboolean dt_masks_gui_was_anything_selected ( const dt_masks_form_gui_t * gui)
inlinestatic

◆ dt_masks_init_form_gui()

◆ dt_masks_interaction_alias_name()

const char * dt_masks_interaction_alias_name ( dt_masks_interaction_t interaction)

The other word for a property, when a shape family spells it its own way.

A gradient stores its fade extent in the SIZE slot and its curvature in the FADING one – same property of the interaction API, different vocabulary in front of the user, which is also why the context menu renames those two sliders for gradients. Any UI naming a property generically must show both words, or the gradient's own vocabulary has no visible home.

Returns
the untranslated second name, or NULL when the property has only one.

Definition at line 3230 of file masks_gui.c.

References DT_MASKS_INTERACTION_FADING.

Referenced by _blendop_masks_create_scroll_grid().

◆ dt_masks_interaction_name()

◆ dt_masks_iop_combo_populate()

◆ dt_masks_iop_value_changed_callback()

◆ dt_masks_is_anything_hovered()

gboolean dt_masks_is_anything_hovered ( const dt_masks_form_gui_t * mask_gui)

◆ dt_masks_is_anything_selected()

◆ dt_masks_node_is_cusp()

gboolean dt_masks_node_is_cusp ( const dt_masks_form_gui_points_t * gpt,
const int index )

returns wether a node is a corner or not. A node is a corner if its 2 control handles are at the same position, else it's a curve.

Parameters
gptthe GUI points of the mask form
indexthe index of the node to test
nbthe number of coord by node
coord_offsetthe offset of the coordinates in the points array
Returns
TRUE if the node is a corner, FALSE it's a curve.

Definition at line 3325 of file masks_gui.c.

References FALSE, IS_NULL_PTR, dt_masks_form_gui_points_t::points, and dt_masks_form_gui_points_t::points_count.

Referenced by _brush_events_button_pressed(), _brush_events_post_expose(), _brush_populate_context_menu(), _polygon_events_button_pressed(), _polygon_events_post_expose(), _polygon_populate_context_menu(), dt_masks_find_closest_handle_common(), dt_masks_reset_bezier_ctrl_points(), and dt_masks_toggle_bezier_node_type().

◆ dt_masks_overlay_queue_redraw()

void dt_masks_overlay_queue_redraw ( GtkWidget * widget)

Ask the centre widget for a redraw of what the last overlay frame touched, grown by the pointer's motion since, instead of the whole widget: for a motion the masks handled and nothing else did. Falls back to the whole widget when no frame has been recorded.

Definition at line 4599 of file masks_gui.c.

References _overlay_damage, _overlay_damage_valid, _overlay_pointer_delta, and IS_NULL_PTR.

Referenced by mouse_moved().

◆ dt_masks_point_is_within_radius()

gboolean dt_masks_point_is_within_radius ( const float point_x,
const float point_y,
const float center_x,
const float center_y,
const float squared_radius )

Check if a point (px,py) is inside a radius from a center point (cx,cy).

Parameters
pxx coord of the point to test
pyy coord of the point to test
cxcenter x coord
cycenter y coord
radiusthe radius from center
Returns
gboolean TRUE if the point is inside the radius from center, FALSE otherwise

Check if a point (px,py) is inside a radius from a center point (cx,cy).

Assumptions/caveats:

  • Uses squared distance to avoid sqrt.
  • Callers must pass a squared radius (not the radius).

Definition at line 1158 of file masks_gui.c.

Referenced by dt_masks_find_closest_handle_common().

◆ dt_masks_preview_buffers_cleanup()

◆ dt_masks_project_on_line()

void dt_masks_project_on_line ( const float cursor[2],
const float node[2],
const float handle[2],
float point[2] )
inlinestatic

Definition at line 375 of file masks_gui.h.

Referenced by _brush_events_mouse_moved(), and _polygon_events_mouse_moved().

◆ dt_masks_remove_form()

◆ dt_masks_remove_node()

◆ dt_masks_remove_or_delete()

gboolean dt_masks_remove_or_delete ( struct dt_iop_module_t * module,
dt_masks_form_t * sel,
int parent_id,
dt_masks_form_gui_t * mask_gui,
int form_id )

If the form to remove is used once, ask to the user if he wants to delete it from the list or just remove and keep for later reuse.

Parameters
moduleThe module owning the mask
selThe form to remove
parent_idThe parent ID of the form
mask_guiThe GUI state of the form
form_idThe form ID of the form to remove
Returns
gboolean TRUE if the form was removed, FALSE otherwise

Definition at line 2244 of file masks_gui.c.

References _masks_gui_form_group_use_count(), _masks_remove_or_delete_finish(), dt_masks_form_gui_t::dev, dt_masks_gui_confirm_delete_form_dialog(), FALSE, IS_NULL_PTR, and dt_masks_form_t::name.

Referenced by dt_masks_gui_remove().

◆ dt_masks_remove_shape_from_group()

gboolean dt_masks_remove_shape_from_group ( struct dt_iop_module_t * module,
dt_masks_form_t * sel,
int parent_id,
dt_masks_form_gui_t * mask_gui,
int form_id )

Remove the form from its current group only, keeping it around unused for potential reuse. Never asks for confirmation, since nothing is destroyed.

Returns
gboolean TRUE if the form was removed, FALSE otherwise

Definition at line 2265 of file masks_gui.c.

References _masks_remove_or_delete_finish(), FALSE, IS_NULL_PTR, and TRUE.

Referenced by _masks_gui_remove_from_group_callback().

◆ dt_masks_reset_bezier_ctrl_points()

gboolean dt_masks_reset_bezier_ctrl_points ( struct dt_iop_module_t * module,
struct dt_masks_form_t * mask_form,
struct dt_masks_form_gui_t * mask_gui,
const int form_index,
const struct dt_masks_form_gui_points_t * gui_points,
const int node_index,
dt_masks_points_states_t * state )

◆ dt_masks_reset_form_gui()

◆ dt_masks_reset_show_masks_icons()

◆ dt_masks_rotate_with_anchor()

float dt_masks_rotate_with_anchor ( dt_develop_t * develop,
const float anchor[2],
const float center[2],
dt_masks_form_gui_t * mask_gui )

Rotate a mask shape around its center. WARNING: gui->delta will be updated with the new position after rotation.

Parameters
devthe develop structure
anchorthe current cursor position in absolute output-image coordinates.
centerthe origin point of rotation in absolute output-image coordinates.
guithe GUI form structure
Returns
* float : The signed angle to increment.

Rotate a mask shape around its center. WARNING: gui->delta will be updated with the new position after rotation.

anchor, center, and mask_gui->delta are absolute output-image coordinates. The angle accounts for possible axis inversion due to distortion transforms. Updates mask_gui->delta to store the last anchor position.

Definition at line 5749 of file masks_gui.c.

References dt_masks_form_gui_t::delta, dt_dev_coordinates_image_abs_to_raw_abs(), and M_PI.

Referenced by _ellipse_events_mouse_moved(), and _gradient_events_mouse_moved().

◆ dt_masks_scroll_get_interaction()

dt_masks_interaction_t dt_masks_scroll_get_interaction ( uint32_t key_state)

Resolve a wheel event's key state into the property it edits.

Returns
DT_MASKS_INTERACTION_UNDEF when this combination is unmapped, or when the key state is not one of the four the mapping covers (a stray Alt, for instance).

Definition at line 3243 of file masks_gui.c.

References DT_MASKS_INTERACTION_UNDEF, dt_masks_scroll_mapping_get(), DT_MASKS_SCROLL_PLAIN, DT_MASKS_SCROLL_PRIMARY, DT_MASKS_SCROLL_PRIMARY_SHIFT, DT_MASKS_SCROLL_SHIFT, dt_modifier_is(), DT_PRIMARY_MASK, and state.

Referenced by dt_masks_events_mouse_scrolled().

◆ dt_masks_scroll_mapping_get()

dt_masks_interaction_t dt_masks_scroll_mapping_get ( dt_masks_scroll_modifier_t modifier)

◆ dt_masks_scroll_mapping_set()

void dt_masks_scroll_mapping_set ( dt_masks_scroll_modifier_t modifier,
dt_masks_interaction_t interaction )

Map interaction (DT_MASKS_INTERACTION_UNDEF to unmap) to modifier, persisted in conf.

Definition at line 3187 of file masks_gui.c.

References _interaction_conf_values, _scroll_conf_keys, dt_conf_set_string(), DT_MASKS_INTERACTION_LAST, DT_MASKS_INTERACTION_UNDEF, and DT_MASKS_SCROLL_MODIFIER_LAST.

Referenced by _blendop_masks_scroll_toggled().

◆ dt_masks_scroll_modifier_name()

const char * dt_masks_scroll_modifier_name ( dt_masks_scroll_modifier_t modifier)

Untranslated name of a wheel row / of a property, for GUI labels. Never NULL.

Definition at line 3196 of file masks_gui.c.

References DT_MASKS_SCROLL_PLAIN, DT_MASKS_SCROLL_PRIMARY, DT_MASKS_SCROLL_PRIMARY_SHIFT, and DT_MASKS_SCROLL_SHIFT.

Referenced by _blendop_masks_create_scroll_grid().

◆ dt_masks_select_form()

void dt_masks_select_form ( dt_develop_t * dev,
struct dt_iop_module_t * module,
dt_masks_form_t * selected_form )

Select or clear the current mask form, notifying the owning module if needed.

utils functions allow to select a shape inside an iop

Passing NULL clears the selection.

Definition at line 5570 of file masks_gui.c.

References dev, dt_masks_form_t::formid, IS_NULL_PTR, and dt_iop_module_t::masks_selection_changed.

Referenced by _brush_events_button_released(), _masks_remove_or_delete_finish(), dt_masks_clear_form_gui(), and dt_masks_events_button_pressed().

◆ dt_masks_set_source_pos_initial_state()

void dt_masks_set_source_pos_initial_state ( dt_masks_form_gui_t * mask_gui,
const uint32_t key_state )

Decide initial source positioning mode for clone masks.

utils for selecting the source of a clone mask while creating it

Uses key modifiers to choose absolute vs. relative positioning, and stores the reference position in preview coordinates. The current implementation caches that reference in absolute output-image coordinates.

Definition at line 5588 of file masks_gui.c.

References DT_MASKS_SOURCE_POS_ABSOLUTE, DT_MASKS_SOURCE_POS_RELATIVE_TEMP, dt_modifier_is(), DT_PRIMARY_MASK, dt_masks_form_gui_t::pos, dt_masks_form_gui_t::pos_source, and dt_masks_form_gui_t::source_pos_type.

Referenced by _brush_events_button_pressed(), _circle_events_button_pressed(), _ellipse_events_button_pressed(), and _polygon_events_button_pressed().

◆ dt_masks_set_source_pos_initial_value()

void dt_masks_set_source_pos_initial_value ( dt_masks_form_gui_t * mask_gui,
dt_masks_form_t * mask_form )

Initialize the clone source position based on current GUI state.

Handles first-time relative positioning, existing relative offsets, and absolute coordinates. Updates mask_form->source accordingly. mask_gui->rel_pos is the normalized output-image cursor, while mask_gui->pos_source stores either an absolute output-image position or an absolute output-image delta depending on the current source mode.

Definition at line 5613 of file masks_gui.c.

References dev, dt_masks_form_gui_t::dev, dt_dev_coordinates_image_abs_to_raw_abs(), dt_dev_coordinates_image_abs_to_raw_norm(), dt_dev_coordinates_raw_abs_to_raw_norm(), dt_dev_geometry_snapshot(), DT_MASKS_SOURCE_POS_ABSOLUTE, DT_MASKS_SOURCE_POS_RELATIVE, DT_MASKS_SOURCE_POS_RELATIVE_TEMP, dt_masks_form_t::functions, geometry, dt_masks_functions_t::initial_source_pos, dt_masks_form_gui_t::pos, dt_masks_form_gui_t::pos_source, raw_height, raw_width, dt_masks_form_t::source, and dt_masks_form_gui_t::source_pos_type.

Referenced by _brush_events_button_pressed(), _circle_init_new(), _ellipse_init_new(), and _polygon_events_button_pressed().

◆ dt_masks_set_visible_form()

◆ dt_masks_shape_buttons_create()

GtkWidget * dt_masks_shape_buttons_create ( const dt_masks_shape_buttons_config_t * config)

◆ dt_masks_shape_buttons_deactivate_all()

◆ dt_masks_shape_buttons_sync_all()

void dt_masks_shape_buttons_sync_all ( void )

Make every shape toolbar show the shape currently being created, if any.

The pressed button is a view on the creation state, so any code arming or re-arming a creation outside a toolbar button calls this. dt_masks_creation_mode_enter() already does.

Definition at line 177 of file masks_gui.c.

References dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, and DT_SIGNAL_MASK_SHAPE_BUTTONS_SYNC.

Referenced by dt_masks_creation_mode_enter().

◆ dt_masks_shape_menu_item_new()

GtkWidget * dt_masks_shape_menu_item_new ( GtkWidget * menu,
const dt_masks_type_t type,
GCallback activate_callback,
gpointer user_data )

Append a menu entry for one shape type: its toolbar icon, then its toolbar label.

The icon and the name both come from the same table the shape toolbars are built from, so a menu offering a shape and the button offering it cannot drift apart. Returns the entry, or NULL for a type no toolbar knows.

Definition at line 211 of file masks_gui.c.

References _masks_shape_button_def(), _masks_shape_icon_draw(), DT_GUI_BOX_SPACING, DT_PIXEL_APPLY_DPI, FALSE, IS_NULL_PTR, dt_masks_shape_button_def_t::name, dt_masks_shape_button_def_t::paint, size, and type.

Referenced by _tree_add_shape_menu_item().

◆ dt_masks_soft_reset_form_gui()

◆ dt_masks_toggle_bezier_node_type()

gboolean dt_masks_toggle_bezier_node_type ( struct dt_iop_module_t * module,
struct dt_masks_form_t * mask_form,
struct dt_masks_form_gui_t * mask_gui,
const int form_index,
const struct dt_masks_form_gui_points_t * gui_points,
const int node_index,
float node[2],
float ctrl1[2],
float ctrl2[2],
dt_masks_points_states_t * state )