-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flood fill paint function #2683
Conversation
I was able to generate some torture tests that hit the stack limit around 3000, so I've changed the stack size to 4000. I'm not sure how to generate an absolute worst case, so I'm not sure how large is too large. |
Definitely worth it but might need another implementation; I think this painter depends on stopping at its own color. |
I went back to check the behavior of QB paint when it's given a border color, and it turns out there's always a border color that just defaults to the paint color. For reference: I'm thinking tic paint should replicate this behavior if a border color is provided, but then unlike QB paint if no border color is given it should fill whatever contiguous space starts at the seed point, like I've implemented so far. |
I'm finding QB paint is silly and shouldn't be replicated exactly. When a boundary color is given it's hard to predict whether the paint will leak through its own color: Rather than using QB as reference the behavior I'm going to pursue is: if a border color is given then paint to within the border color or the paint color itself, and as before, when no border color is given then effectively every color is border except the color at the seed point. |
I found a worse worst case for memory usage which suggested the stack limit should be about 10,000 to be safe, so I've replaced the stack with a much smaller queue. |
This is an implementation of Paul Heckbert's flood fill, providing the functionality of the QBasic PAINT method. This fills a contiguous area of solid color starting from a seed point.
All languages are supported, but not all languages are tested.
There's a closed/wishlist for this: #2022
Edit: Actually this isn't quite like QB's PAINT. Continued below.