I'm writing a game for a mobile device that display a sequence of colored balls against a background.
If the user touches the balls, I want to zoom them and show a message.

As the number and size of the balls is aleatory, I tried to flood fill the area ocupied by the balls and get the boundary rectangle to pass to the zoom function.

This only works if the user, by chance, doesn't touche over a ball or inside a closed path...

Here's a graphical representation of my problem:

\*, dark color background

spaces, light color background

+, are the balls

```
*********************************

***                           ***

***                           ***

***                           ***

***   +    +  + ++    ++      ***

*** +     +     ++   +   +    ***

***   +    +    + +  +    +   ***

*** +        +     + +   +    ***

***        +    +  + ++       ***

*** +     +     ++   +   +    ***

***                           *** 

*********************************

```

I want to know the coordinates of the rectangle that includes all balls.

Any suggestions?

Thanks,
pmc