Paint application - the eraser

Hi

I have designed a small app that allows the user to draw coloured pixels onto a background texture (non-white). Is it possible to have an imitation of the background texture under the texture with the modifications so that to erase I would apply coloured pixels of Color.clear and the user could see the layer underneath?

So far I have tried:
GUI.DrawTexture(new Rect(100, 0, backgroundTexture.width * zoom, backgroundTexture.height * zoom), backgroundTexture);
GUI.DrawTexture(new Rect(100, 0, topTexture.width * zoom, topTexture.height * zoom), topTexture);
GUILayout.EndArea();

to no success. I just see a black background where I erase

Any suggestions please?

Calculate the pixels that you are wanting to erase and then use the GetPixels function on your background texture to get what colours you want to make these pixels.

var pixels : Color[] = tex.GetPixels (stX,stY,lengthX,lengthY,0);
var originalPixels : Color[] = original.GetPixels(stX,stY,lengthX,lengthY,0);

//logic to calculate what pixels you want to change

tex.SetPixels (start.x,start.y,lengthX,lengthY,pixels,0);
tex.Apply();
`
`