Select contiguous pixels?

For questions about using Classic.

Post » Mon Feb 28, 2011 1:39 pm

Trying to do something like the magic wand tool in most image editors, and I was wondering if anybody had a better idea on where to start.

My initial thoughts are to check mouse x/y on click, and if the alpha(its either transparent or not transparent) is greater than 0 add that coord to a list, it would then check the x/y's around that, and add them to the list if they qualify, but that's about as far as I've figured, as you would need to jump to one of the contiguous pixels, and check from there next.
Problem is how do you exclude it checking... what you've already checked?

Thoughts?
Ideas?
Your doing it wrong? :lol:
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Feb 28, 2011 2:04 pm

This is also known as flood fill, and here are two links. First is just the wiki, the second explains it very detailed.

[url:j78pozg5]http://en.wikipedia.org/wiki/Flood_fill[/url:j78pozg5]

[url:j78pozg5]http://losingfight.com/blog/2007/08/28/how-to-implement-a-magic-wand-tool/[/url:j78pozg5]

Good luck :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Feb 28, 2011 2:15 pm

Thanks I'll check it out.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests