how can I mask image after applying paint to selected image area in iOS

I want to achieve to achieve similar thing appeared in images

user paint over the area which he wants to select and then masking the image similar like this

any help would be appreciated

anyone to help me out

how can I mask image after applying paint to selected image area in iOS
 
 
Q