I'm learning CoreImage and Vision libraries in iOS by implementing a coloring app. The app shows a sketch with white background and black edges to the user to color, such as this image:
I can color a view using Canvas
and specify the line width and color. However, the challenges are:
1- how can I prevent the user from coloring those black lines in the original image?
2-if the user colors a specific area with black color, how can I allow the user to modify that area (erase the black color, or over the color of that area with a different color) while preventing the user from coloring the black lines in the original image?
3- if the user can select a sketch from a set of sketches and each sketch has a unique width and height, what is the best approach I should take to achieve the point in question number 1?
I followed this tutorial to detect the black line using contour detection: contour detection tutorial
because my code is too long, I'm using pastern.com: source code