pavelkukov / q-floodfill

Optimized, non-recursive flood fill using a scan line search
MIT License
32 stars 5 forks source link

An option to return canvas with only filled pixels #3

Closed msurguy closed 4 years ago

msurguy commented 4 years ago

Hi! I'd like to know if there is an easy option to return a canvas that only has modified pixels instead of the original canvas + modified pixels.

Thank you!

pavelkukov commented 4 years ago

Hi @msurguy , The class mutates ImageData directly. If you need a canvas with a single black and white area, you have to create it. I threw a quick example here: https://codepen.io/pavelkukov/pen/abvYwdd?editors=1011

Did I understand your question correctly?

msurguy commented 4 years ago

Thank you! Yes, that is exactly what I was looking for. Thanks again!