Work in progress on visual feather control
Contents
Problem statement
Feathering is a great option that enables spreading an effect over the boundaries of a selection it's applied to, with a "configurable" fall-off.
Currently GIMP allows adding feathering to a selection by taking user-contributed amount in pixels. However GIMP doesn't allow tweaking existing feathering value directly, nor does it provide any visual cue as to how far the feathering stretches. This increases the amount of trial-and-error during e.g. processing feathered selections with filters.
What should be available
It should be possible to visually tweak the amount of feathering on the canvas. Visual cue for feathering, however, should not get in the way of user's interaction with GIMP.
It should be possible to use numeric input for controlling the amount of feathering. Input field should be discoverable, but it should not get in the way of user's interaction with GIMP.
User scenario #1
Jane needs to apply a blur effect that would spread somewhat over the boundaries of a selection. Jane is a visual kind of person, she typically relies on visual control and gradual refinement with immediate feedback/rendering rather than on numeric input and absolute values. She isn't sure at which point exactly the gradual fall-off of the effect would stop, so she's adding some initial feathering to a selection, opens a blur effect dialog with on-canvas preview enabled, then tweaks the fathering radius on-canvas and the amount of blur until she's fine with what she sees.
Design draft
Visual editing of the feathering amount
Initializing feathering
Once selection made with a tool is confirmed (pressing the Enter key), there would be a small knot on the upper boundary of the marching ants that indicates the selection.
Activation
The user can drag the knot away from the selection marquee to expand the feather effect, which will automatically expand inwards and outwards at the same time (equal distance). The end of the feather effect is shown by the red and blue outlines. There is a knot for each which the user can then drag independently of each-other to adjust where the effect starts and ends.
Visual cue
The visual cue should generally repeat the existing selection cue, honoring non-uniform feathering by expanding or contracting respective areas of the visual cue.
One possible rendering implementation is a thin dashed line.
TODO: visualization specifics.
Positioning controls
The visual cue should have at least one on-canvas control for expanding/contracting the feathered area.
TODO: supposing, a user sees only a part of a selection in the viewport. how many controls per feathered area should GIMP render? what would be the placement logic?
Possible solution: render one control for tweaking the whole feathered area proportionally, then one control per each non-uniformly feathered area so that they could be tweaked independently from uniform parts of the feathered area.
TODO: do we render the control on top of the feathering cue?
Interaction
After the initial click-drag, the user can move the knots independently to affect the blur. Furthermore, double-clicking anywhere on either path adds two more knots (one on red, and one on blue effect boundary lines), thus making handles wherever the user wants to modify the filter feathering edge.
Expanding and contracting the feathered area should be done by dragging an on-canvas control. Movement in the [0..180] degrees range would qualify for upwards movement and lead to expansion. Movement in the [180..360] degrees range would qualify for downwards movement and lead to contraction.
Feathering cue and controls should rotate and/or flip along with canvas rotation/flipping. Degrees range used to detect desired expansion/contraction of the feathered area should be adjusted accordingly. E.g. 90° CCW canvas rotation would map dragging the knot to the left to area expansion. A 90° CCW canvas rotation and horizontal flipping would map dragging the knot to the left to area contraction.
Numeric control over feathering
Discovering numeric input controls
The numeric input in the tools' options dockable dialog kinda works for creating a new selection. However, starting with 2.9/2.10 it would fail miserably as soon as the user opens a filter dialog, because the dockable dialog starts showing just the color picker radius control. Something needs to be done here.
Positioning of numeric controls
TODO
Interaction
TODO
Handling non-uniform feathering
Non-uniform feathering happens when one uses e.g. a quick mask and a brush of different size and/or hardness value. Here is how this should be handled:
- Tweaking via visual controls would adjust the amount of feathering proportionally. It remains to be decided whether there should be a way to visually enforce a uniform value to a non-uniform feathering.
- Tweaking via numeric input would change the amount proportionally when used with arithmetic operations (+20, *40 etc.), or change all feathering to a certain amount when absolute value is given by the user.
Removing feathering
TODO: 'Select -> Remove feathering' is a sensible menu command, however an on-canvas option could be designed.
Tentative design
darktable has feathered masks and calls it 'gradual decay' in the docs: https://www.darktable.org/usermanual/ch03s02s07.html.php