Flood Fill Extension. Fill area of an image with a color

Hello friends,

  • Fill an area of ​​an image with a color.

  • You must copy the image to the ASD, in this example the image is copied from the asset to the ASD.

  • Canvas.Up and Canvas.Touched are necessary.

  • If you want to resize the image, use the "imageWidth" and "imageHeight" blocks.

  • Better with a pen android phone

  • Code based in:
    java - Android flood-fill algorithm - Stack Overflow with modifications.


- App example.

p187C2i_extension_rellenar.aia (194.0 KB)

Regards,
Juan Antonio Villalpando.

19 Likes

Great work Juan :+1:

3 Likes

Supubbbbbbbbb extension …

1 Like

Great work Juan :+1:

1 Like

Genius!!! :smile:

1 Like

Excelente explicación y muy bien aplicado, me gustaría saber si se podría aplicar a un dibujo libre realizado con color de pintura directamente sobre el lienzo?

Draw in Canvas and then save picture.
Load that picture.

1 Like

Muchas gracias

Well done @Juan_Antonio.
Great extension.

Buenas de nuevo Juan Antonio, quería consultarle otra duda con respecto a la extensión. ¿Se puede programar con la extensión de manera que se use como relleno el color de un pincel o de un selector de color, como en aplicaciones tipo Paint o Gimp?
Gracias de antemano

Try with Canvas.GetPixelColor

1 Like

thanks for your suggestions, i used drawshape. i need to refine, but it works.

hello Antonio,
it would be possible to know what method you took to color an area other than "drawshape". I'm trying to color a curve in a graph with a gradient towards transparent.
thanks for your reading.

I used an extension withy Java.

Try La inundación de lona llena un área por Scott Ferguson.

Gradient will be much more difficult

Here an extension about gradient
http://kio4.com/appinventor/287_extension_gradiente_color.htm

Hello
Is there anyway to not use the SD card file path?


I tried to use false but it didn't work.

You need to give a file path to the image file you want to use with the floodfill extension. Why would you put "false" ?

And what file path do I need to add?

You need to give a file path to the image file you want to use with the floodfill extension