Commit graph

11 commits

Author SHA1 Message Date
Bill Kendrick
2ce07ac9de Fill: Avoid infinite recursion crash
simulate_flood_fill_outside_check() could spin in an
infinite loop because it could sometimes set values in the
`touched[]` array to 0, which means the spot was never seen.

Values going in there are not boolean, but a 0-255 gradient,
for smoother fills on antialiased edges.

This change forces it to be a 1-255 value, ensuring that
a 'touched' spot on the canvas will have a non-zero `touched[]`
value.

h/t Pere for noticing the bug, providing some details,
and best of all providing a sample image to play with which
consistently invoked the crash.  (It made mending this a
10 minute task for me, rather than an hours-long hunt to reproduce!
Big 'thanks' for doing that ahead of time!!!)
2021-05-06 00:05:58 -07:00
Bill Kendrick
b7e2aeca34 Remove printf() debugging left in fill.c 2021-03-08 01:39:47 -08:00
Bill Kendrick
f7e9fa2870 Fill antialiasing edges; Not perfect, but improved
Probably can still improve the ratio of
{old pixel's difference to initial color to be replaced}
to {new color being flood-filled}...
2021-03-08 01:36:07 -08:00
Bill Kendrick
866d5190bf Continuing to improve fill anti-aliasing 2021-03-08 01:18:00 -08:00
Bill Kendrick
3b5a0a1586 WIP: Fill tool improvement related to antialiasing
Fill tools do a better job at filling around
antialiased edges, and apply some blending.
(Blending does not yet occur with gradient tools.)
2021-03-07 01:00:53 -08:00
Bill Kendrick
f40dc07f37 Radial gradient fill improvement
Attempting to improve fading out to edges (so the
actual effect is more obvious).
2021-03-05 18:08:19 -08:00
Bill Kendrick
76cb1c5446 Linear gradient fill mode 2021-02-20 21:35:46 -08:00
Bill Kendrick
058191bd04 Radial gradient fill tool added
Note: Need to add to docs.
2021-02-20 18:08:06 -08:00
Bill Kendrick
aade790b1c Remove unused x/y args to would_flood_fill()
Copy-pasta'd them
2019-09-14 12:10:26 -07:00
Bill Kendrick
a54dd570b4 Make sure Fill uses undo (but also intelligently)
"Fill", as a new main-toolbar tool, was not recording snapshots
of the image for the "Undo" tool.  Mended.

However, also updated the tool so that it doesn't _bother_ recording
into the undo buffer if the fill action is a no-op (e.g., clicking
the same spot a second time, or otherwise attempting to fill an
area with a color that's identical to what's already on the canvas).
2019-09-14 11:16:46 -07:00
Bill Kendrick
2911b35a50 Elevate "Fill" from Magic Tool to real Tool
Replace the somewhat-recently-added "nothing" item in the tool bar
with the "Fill" tool, which has been converted back from a Magic tool
to a regular tool.

Also, change bash "==" to sh "=" in "if [ ... ]" tests in Makefile.

Also, link to math library (via "-lm") to make sure "max()" is available to
magic tools.

Also, add missing mention of "--newcolorslast" and "--newcolorsfirst" to manpage.
2019-09-12 23:04:13 -07:00