Heal tool: add logarithmic mode
Description of the feature
The existing heal tool is very powerful to apply a pattern from one image area to another one. It basically scales the high frequency pattern from the source area to the surrounding colors of the target area (using Poisson's equation). This works well in many cases. But if source and target area have different average brightness, the heal tool will get the local contrast wrong. That's because the contrast within an image area generally scales with the brightness.
To improve this behavior, gimp could add an option to use logarithmic color scales. If that option is activated, the heal tool will take the logarithm of color values both at the source and target area. Then it will solve Poisson's equation on the logarithmized colors. Finally the result is delogarithmized (exponentiated) and inserted in the target area.
This way, the tool becomes brightness-invariant. It will yield better results for a wider range of source and target colors.
Of course care has to be taken at zero (black) color values, where the logarithm would become infinite. A possible fix would be to take y=log(1+x) and later transform back using x=exp(y)-1.
Note: The gimp documentation (https://docs.gimp.org/2.10/en/gimp-tool-heal.html) names the reference https://docs.gimp.org/2.10/en/bibliography.html#bibliography-online-georgiev for the heal tool, which actually offers a similar (but more complicated) improvement over the naive Poisson method. However I don't see this implemented when I use the Gimp 2.10.