Skip to content

Commit

Permalink
Added Bézier handles to path masks, so the control points can be move…
Browse files Browse the repository at this point in the history
…d independently

Includes changes to the way the feathering border is drawn for paths. The border could
already be bugged in rare cases before. With the added freedom of moving the control
points individually, broken feathering borders were much too easy to produce.

Includes one changed UI tooltip in English, German, French, Italian.
  • Loading branch information
Marc Fouquet committed Jul 26, 2024
1 parent 832fd4f commit 817df70
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 118 deletions.
2 changes: 1 addition & 1 deletion po/darktable.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8965,7 +8965,7 @@ msgstr ""

#: ../src/develop/masks/path.c:3360
msgid ""
"<b>node curvature</b>: drag\n"
"<b>node curvature</b>: drag, <b>move single handle</b>: shift+drag\n"
"<b>reset curvature</b>: right-click"
msgstr ""

Expand Down
5 changes: 3 additions & 2 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -9572,10 +9572,11 @@ msgstr ""

#: ../src/develop/masks/path.c:3360
msgid ""
"<b>node curvature</b>: drag\n"
"<b>node curvature</b>: drag, <b>move single handle</b>: shift+drag\n"
"<b>reset curvature</b>: right-click"
msgstr ""
"<b>Knoten Krümmung</b>: ziehen\n"
"<b>Knoten Krümmung</b>: Ziehen, <b>Einzelnen Kontrollpunkt bewegen</b>: "
"Shift+Ziehen,\n"
"<b>Krümmung zurücksetzen</b>: Rechtsklick"

#: ../src/develop/masks/path.c:3365
Expand Down
6 changes: 3 additions & 3 deletions po/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -9421,12 +9421,12 @@ msgstr ""
"<b>Move node</b>: drag, <b>Remove node</b>: right-click\n"
"<b>Switch smooth/sharp mode</b>: Ctrl+click"

#: ../src/develop/masks/path.c:3360
#: ../src/develop/masks/path.c:3360#: ../src/develop/masks/path.c:3360
msgid ""
"<b>node curvature</b>: drag\n"
"<b>node curvature</b>: drag, <b>move single handle</b>: shift+drag\n"
"<b>reset curvature</b>: right-click"
msgstr ""
"<b>Node curvature</b>: drag\n"
"<b>Node Curvature</b>: drag, <b>Move single handle</b>: shift+drag\n"
"<b>Reset curvature</b>: right-click"

#: ../src/develop/masks/path.c:3365
Expand Down
5 changes: 3 additions & 2 deletions po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -9575,10 +9575,11 @@ msgstr ""

#: ../src/develop/masks/path.c:3360
msgid ""
"<b>node curvature</b>: drag\n"
"<b>node curvature</b>: drag, <b>move single handle</b>: shift+drag\n"
"<b>reset curvature</b>: right-click"
msgstr ""
"<b>Courbe du nœud</b> : déplacer\n"
"<b>Courbe du nœud</b> : glisser, <b>Déplacer un seul point de contrôle</b> : "
"Maj+glisser\n"
"<b>Réinitialiser la courbe</b> : clic droit"

#: ../src/develop/masks/path.c:3365
Expand Down
5 changes: 3 additions & 2 deletions po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -9652,10 +9652,11 @@ msgstr ""

#: ../src/develop/masks/path.c:3360
msgid ""
"<b>node curvature</b>: drag\n"
"<b>node curvature</b>: drag, <b>move single handle</b>: shift+drag\n"
"<b>reset curvature</b>: right-click"
msgstr ""
"<b>nodo curvatura</b>: trascina\n"
"<b>nodo curvatura</b>: trascina, <b>muovere punto di controllo singolo</b>: "
"maiusc+trascina\n"
"<b>azzera curvatura</b>: clic pulsante destro"

#: ../src/develop/masks/path.c:3365
Expand Down
29 changes: 29 additions & 0 deletions src/develop/masks.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ typedef enum dt_masks_source_pos_type_t
DT_MASKS_SOURCE_POS_ABSOLUTE = 2
} dt_masks_source_pos_type_t;

/* selected Bézier control point for path*/
typedef enum dt_masks_path_ctrl_t
{
DT_MASKS_PATH_CRTL_NONE = -1,
DT_MASKS_PATH_CTRL1 = 1,
DT_MASKS_PATH_CTRL2 = 2

} dt_masks_path_ctrl_t;

/** structure used to store 1 point for a circle */
typedef struct dt_masks_point_circle_t
{
Expand Down Expand Up @@ -367,6 +376,7 @@ typedef struct dt_masks_form_gui_t
int point_selected;
int point_edited;
int feather_selected;
dt_masks_path_ctrl_t bezier_ctrl; // For paths, this selects a Bézier control point.
int seg_selected;
int point_border_selected;
int source_pos_type;
Expand All @@ -378,6 +388,7 @@ typedef struct dt_masks_form_gui_t
gboolean gradient_toggling;
int point_dragging;
int feather_dragging;
gboolean bezier_single; // User drags a single control point.
int seg_dragging;
int point_border_dragging;

Expand Down Expand Up @@ -827,6 +838,15 @@ float dt_masks_dynbuf_get(dt_masks_dynbuf_t *a, const int offset)
return (a->buffer[a->pos + offset]);
}

static inline
float dt_masks_dynbuf_get_absolute(dt_masks_dynbuf_t *a, const int position)
{
assert(a != NULL);
assert(position >= 0);
assert((long)a->pos > position);
return (a->buffer[position]);
}

static inline
void dt_masks_dynbuf_set(dt_masks_dynbuf_t *a, const int offset, const float value)
{
Expand All @@ -837,6 +857,15 @@ void dt_masks_dynbuf_set(dt_masks_dynbuf_t *a, const int offset, const float val
a->buffer[a->pos + offset] = value;
}

static inline
void dt_masks_dynbuf_set_absolute(dt_masks_dynbuf_t *a, const int position, const float value)
{
assert(a != NULL);
assert(position >= 0);
assert((long)a->pos > position);
a->buffer[position] = value;
}

static inline
float *dt_masks_dynbuf_buffer(dt_masks_dynbuf_t *a)
{
Expand Down
Loading

0 comments on commit 817df70

Please sign in to comment.