make
make

Reputation: 10045

iOS - How to fill color in Prescribed area

when I touch one place,Within the Prescribed area fill the green color.like this:

like this

and this: enter image description here

click one of the fish,the both fish are red

Now I can only use the scan line seed filling algorithm to identify a closed area, but cannot identify multiple areas。

Like this coral, one click fills in multiple areas

if any one gives solution it would be so great,Thank you. (English is not my native language; please excuse typing errors.)

-----------------------------------------------------------

I have a crude idea.

  1. First find two seed points on the ear(A and B).
  2. Click on the picture, if you find that the stack contains seed point A, calling method floodFill(from: B) continue

but I don't konw how to implementation if you find that the stack contains seed point A in this demo

img

Upvotes: 11

Views: 1577

Answers (1)

make
make

Reputation: 10045

I have solved the problem, this is a Demo

This solution requires fixing two seed points on the leaves。 When a seed point is triggered for coloring, The other one is also coloring. show

If there's a better solution, let me know please.

Upvotes: 12

Related Questions