Paint bucket functionality with Corona

Hi I want to create a paint bucket tool that fills in a color within a pattern like coloring book when I click on the area.
How can i fetch with area in between black boundaries and then fill color in whole boundry of area touched.Is there an easier way to do this?

I have attaached a demo of what i want in attachement. Please have a look

We do not have a way of doing a flood fill. Now if each area to be filled is a separate object, you can use our object.fill feature (see: https://docs.coronalabs.com/api/type/ShapeObject/fill.html) to fill areas with colors, images, gradients and other features.

Rob

Thanks Rob for answering

Can you please elaborate this that each area to be filled is a separate object.
How can i fetch white area as objects in between black boundaries from this picture in url attached, Same as paint bucket tool functionality?

http://www.halloweencostumes4u.com/images/clown-coloring.jpg

Actually i want to make an app for children so that they can select color and tap on any area of the drawing and whole boundary inbetween that black line would be filled with that color. To make ease to color drawing books for children by just tapping rather then to swipe and brush. Hope it clarifies what i needed,… Thanks

You would have to take each object, the balls, the clowns nose, his hands, feet etc. and use Photoshop and make separate images of each making the outside of the line transparent. In code you would load each pieces of the image and add a touch handler to it. When the kid touches that area, you would then call the fill methods above to put whatever color you want for the white part of the image.

It will be a whole lot easier if each sub-image is the same size. That way you don’t have to deal with positioning them when loading them. Think about using Photoshop layers where each part is on the same canvas. When you show and hide each layer the part is drawn where it belongs.

That wont work for me as i have much complex drawings that need hundreds of layers and i dont think that would be an appropriate solution to layering all images…

Can there be any solution on pixel level manipulation, So that we can get white area in between black boundary and then we can change color of all the pixels in between that boundary.

Thanks for quick replies Sir Rob. 

No. We don’t have a facility for that.

We do not have a way of doing a flood fill. Now if each area to be filled is a separate object, you can use our object.fill feature (see: https://docs.coronalabs.com/api/type/ShapeObject/fill.html) to fill areas with colors, images, gradients and other features.

Rob

Thanks Rob for answering

Can you please elaborate this that each area to be filled is a separate object.
How can i fetch white area as objects in between black boundaries from this picture in url attached, Same as paint bucket tool functionality?

http://www.halloweencostumes4u.com/images/clown-coloring.jpg

Actually i want to make an app for children so that they can select color and tap on any area of the drawing and whole boundary inbetween that black line would be filled with that color. To make ease to color drawing books for children by just tapping rather then to swipe and brush. Hope it clarifies what i needed,… Thanks

You would have to take each object, the balls, the clowns nose, his hands, feet etc. and use Photoshop and make separate images of each making the outside of the line transparent. In code you would load each pieces of the image and add a touch handler to it. When the kid touches that area, you would then call the fill methods above to put whatever color you want for the white part of the image.

It will be a whole lot easier if each sub-image is the same size. That way you don’t have to deal with positioning them when loading them. Think about using Photoshop layers where each part is on the same canvas. When you show and hide each layer the part is drawn where it belongs.

That wont work for me as i have much complex drawings that need hundreds of layers and i dont think that would be an appropriate solution to layering all images…

Can there be any solution on pixel level manipulation, So that we can get white area in between black boundary and then we can change color of all the pixels in between that boundary.

Thanks for quick replies Sir Rob. 

No. We don’t have a facility for that.