On 2/25/07, John Bintz <jcoswell@...1414...> wrote:
Inkscape now has a very rudimentary flood fill tool. It works by performing a bitmap-based flood fill on a rendered version of the visible canvas, then tracing the resulting fill using potrace and placing the traced path on the canvas.
Excellent work, thanks! Already very useful.
This tool is in a very basic state, and there are issues with rendering accuracy and memory usage. Some improvements that I can see being done are:
- If the [Ctrl] key is held down, clicking on an object changes the fill
color to the current fill color, and [Shift]-[Ctrl] changes the stroke color to the current stroke color
Yes. This should behave exactly like drag-dropping a color from the palette onto drawing (i.e. disregard selection and grouping). You can just pick the code from there and reuse in your tool.
- A way to either manually or dynamically increase the resolution of the
rendered version so that the accuracy of the flood fill is better
I think this can be fixed very simply. Instead of rendering the bitmap always at 100%, render it at the current zoom. This makes sense - since our tool is already "perceptual", it's not a bad thing for its results to depend on how you view your image. If you need more precision, just zoom in closer.
This presents another problem, however: if you're zoomed in too closely, rendering the entire image at this zoom may become prohibitively slow. To work around that, I propose to render not the entire drawing but only its visible part plus, say, 20% on each of the four sides. That will render about as fast as screen redraw. This means you won't be able to fill in a big area while zooming in to only a part of it, and you'll need to zoom out to see all of the area. But I think it's a reasonable choice; by zooming in and out, you will be able to find the exact balance between the coverage and precision.