Difference between "toggle polarity" and "invert mask"

When using drawn masks, there is a “toggle polarity of drawn mask” button that shows either a minus or a plus sign and also a dropdown menu called “invert mask” that can be set to “on” or “off”. They are marked with red in the screenshot below.


As far as I can figure out, these two do exactly the same. I have tried every combination of masks and these settings I can think of without being able to make them behave differently. Therefore I wonder if there is something I have missed. So is there a difference? and if so, what is the difference? I couldn’t find anything about it in the manual, although the topic of masking is very well covered.

I would have expected that the ‘+/-’ might toggle the polarity of an individual shape and ‘invert masks’ might toggle the polarity of the entire mask but I agree - they seem to do the same thing.

No, AFAIK. You may combine different shapes into the mask, adding or subtracting them. Invert mask inverts the whole result. Consult the manual for more details. And yes, I understand that it’s usually the last option (for folks like myself), but still…

My conclusions are based on actually using darktable. This may not be correct behaviour but is how it works: clicking on the ‘+/-’ inverts the all shapes in use by a module. I cannot persuade it to invert individual shapes at all, only the mask as a whole.

Then it may be a bug. I never compared the manual with the real behavior but I feel that it must be noticed by some user(s) during such a long time i’s implemented. I don’t use complex masks that often and usually go trial-and-error way if need be. However I’ve got a feeling that either I misunderstand what the manual says or it works somewhat different because I sometimes get unexpected results with the mask. There’s a simple way to find it out: just repeat what manual says in reality and compare)))

Combining individual shapes with different operations is done in the mask manager module. If you try a practical example of using the toggle button and the dropdown menu, you’ll see that they do exactly the same. You can not add one shape, toggle the polarity and then add another shape and expect it to be the opposite of the first. And yes, I have read the manual. Actually several times, during almost seven years of using darktable.

I looked at the manual before I posted the last message. It says ‘each shape before being added can be inverted’ but doesn’t say how and I can’t find a way. However, shapes can indeed be combined within the mask manager so I don’t believe we’re missing any functionality.

I think the conclusion is that the two operations mentioned in the OP are indeed doing the same thing. Perhaps just a bit of tidy-up required to remove the ‘invert mask’ on/off toggle as it’s redundant (since the other method also appears in the combined drawn/parametric mask panel).

Neither could I AFAICR. My understanding is if there is no such way and there is duplicating functionality in the same time than it’s maybe just a bug.