In Darktable, you can set a mask and then set the feathering on the mask. A mask is, indeed, has the same size as the entire image regardless what you drew. It sets an opacity on each pixel. Feathering modifies the opacity.
Let’s assume one circle drawn mask, non-inverted. The pixels inside the inner radius of the drawn circle has opacity 1, outside the outer radius (i.e., the fade out border) has opacity 0, and every pixel in-between has a geometric falloff (specifically, using the formula $(R^2 - d^2)/(R^2 - r^2)$ for $d$ the distance of a pixel to the center of circle, $r$ the “inner” radius, and $R$ the “outer” radius, see src/develop/masks/circle.c).
The mask’s opacity value (between 0 and 1) contributes to the blending of controls to the input:
final_image = (1 − opacity) × input_image + opacity × processed_image
Thus opacity 0 preserve the input and opacity 1 uses solely the output from the control.
Fade-out in Feathering
While all drawn masks in Darktable can set some falloff so that the opacity smoothly transit from 1 to 0, you can set feathering to make the transition to take into account the context of the underlying image.
Feathering is applied when you set a positive feathering radius. First, set up feathering creates new_mask = guided_filter(guide_image, existing_mask), which examines the local neighborhood and fit the opacity to the guided image’s RGB channels. Conceptually, each neighborhood predicts opacity as opacity = a * image_color + b for some computed values a and b and then averages it as the refined mask (see src/common/guided_filter.c). A smooth image region will produce a softer transition while a strong edge makes the transition sharp.
This new mask may increase the opacity outside the fade out border of the drawn circle mask, and decrease the opacity inside the inner radius. The expansion outside the fade out border is not a fixed distance, but depends on the underlying image.
Alternative Feathering Algorithm
Feathering to take into account of the underlying image is useful but losing control to where the mask will extend to is not.
Indeed, we can limit the mask not to go outside the fade out border:
t = clamp(D / (abs(radius) * scale), 0, 1)
f = guided_filter(guide_image, t)
new_mask = existing_mask * f * int(t > 0)
The mask t is the initial fade, where D is the distance to the fade out border or the pixel with opacity 0, and radius is the feathering radius. The farther inside, t rises toward one. Then f is computed using the guided filter as before, and the actual mask is based on the current mask multiplied with the guided filter, and clipped with t > 0. The guided filter still takes into account the underlying image. The clipping enforces the opacity cannot increase. Thus the mask is limited within the fade out border.
Mask blur
Masks can be further modified by blur. It applies a Gaussian blur to mask opacity, without consulting the image edges. If applied after feathering, blur can soften the feathered result and spread coverage beyond its transparent boundary. Feathering can also applied after blur.