I have a problem which I can’t seem to find a different solution for at the moment that is a bit more efficient to my current idea.
I am making a little game with XNA which will have a randomly generated path to move along, but I don’t know how to separate the textures above and below the lines, since the lines are randomly generated. I hope this image can explain the problem:

So the line(s) are randomly added. My own idea was to create a lot of rectangles with different heights and position them next to each other, but I think that is a little bit inefficient and it also forces me the line to be thick enough such that the rectangle can be a bit wider than only 1-2 pixel, otherwise you might see some “emtpy” spots near the line.
If anything is unclear, please feel free to ask and I will add it to the question, but I think my problem should be clear enough.
You could replace pixels you don’t need with transparent pixels:
You don’t even have to do this for the bottom one, just draw the top one above it.