You must calculate for each point, whether above the line or below. If a line is given in its form of the equation Ax+By+C , then it is as simple as calculating the sign of this expression for your point (x,y) . If your lines are in any other form, you must first calculate the form above. (Here here and here )
Let L1 be the set of all points below the first line, and L2 be the set of all points below the second line. Then your set X = Xor(L1,L2)
[
] Xor [
]
Equally:

Here is the Matlab code that solves the problem for corner points based on the solution you described. You can customize linear equations in your code.
function CreateMask() rows = 100; cols = 200; [X,Y] = ndgrid(1:cols,1:rows); belowFirstLine = X*(1/cols) + Y*(-1/rows) + 0 < 0; belowSecondLine = X*(-1/cols) + Y*(-1/rows) + 1 < 0; figure;imshow( transpose(xor(belowSecondLine,belowFirstLine))); end
source share