Drawpile
Drawpile copied to clipboard
Flood fill: allow negative expand values
It should contract the filled area, instead of expanding it. This should be reasonably simple to implement, since contracting the filled area just means expanding the unfilled area, so the algorithm is the same.
The following changes need to be made:
- In
flood_fill.c:-
DP_flood_fillcurrently clampsexpandto a minimum of 0 when it callsmake_mask. That needs to be removed. -
make_maskshould not add/subtract theexpandvalue to/from the mask size when it's negative. It should just leave it as-is. -
make_maskneeds to use the absolute value ofexpandwhen generating the expansion kernel. -
apply_expansion_kernelneeds to invert the values when the expansion is negative. The mask uses values between 0.0 and 1.0, so inverting a valuexmeans doing1.0 - x.
-
- In
fillsettings.ui:- The
minimumproperty of theexpandslider needs to be set to -30. This can either be done using Qt Designer or by just editing the XML directly.
- The
- In
fillsettings.cpp:- The
expandtool property needs to be changed to allow values from -30 to 30. Currently it goes from 0 to 100 for some reason, even though you can't select higher values than 30.
- The
Credit Meru for suggesting in the Changelog.