i am trying to develop an android application in python that fills the area which is touched (exactly like the fill color tool in ms paint, which fills the closed area with color, or if not closed the color spreads everywhere).Given the xy position of touch, how can i fill the transparent area of a RGBA image using PIL or cv2, then save it? given below is the pseudo code:
#rgb_value is the rgb value of the color with which to fill
#touchx, touchy are the xy positions of touch
#src is the source image, dst is the filename with which to save the output image
def fill_color(src, rgb_value, touchx, touchy, dst):
#code goes here
#then the image is saved
fill_color("freehand.png", [0,0,0], 5, 1000, "freehand(filled).png")
given below is freehand.png:(the patterned area is transparent)
