Hide part of image with a certain color
Hello Unity Community. I have a mobile painting app. I want player to be able to draw in a certain region of the image. Here is an example: Player begins to draw in the wheel. As you can see it is possible to leave the area of the wheel and draw on disk or car carcass. I don't want it to happen. The player is to draw inside the wheel, and when he leaves the wheel region everything that he'd drawn must be hidden. For now I have a color map(unique color for each region where player can draw), and when player clicks on the image, I get certain pixels of this color map. Drawing itself is implemented through creating new little images everywhere player clicks, and when he releases the touch, I read pixels and copy them into the texture to save everything and destroy all the created image gameobjects. Now I want something to overlay everything that is drawn outside of the region without hiding the other part of already drawn picture. Here is what I want: I realise that I need somehow to duplicate the main layer and cover it with the duplicated image, and the duplicate also has to cover the area outside of the drawing region. I know I can do that with GetPixels, and use SetPixels and Apply every time player finishes drawing. But this operation hits performance strongly. Is there a way to do it without killing the device memory?