Well, I didn't use a line equation for my program, but you have a square let's say, and at the bottom left corner, you have a line that extends to the top right corner. That's lineLR. (left to right)

lineRL has an origin at the right bottom corner, and extending to the top left corner of the square.

Both of these lines have a slope. and you can calculate any point inside the square, AS IF it had a line going back to the bottom of lineLR, and calculate it's slope.

Now you can compare that imaginary line slope, with lineLR's slope, and use a while loop or for loop, to make the same logic, work for every pixel in the same colored area.

Not only can you use that logic for comparison with the slope (and thus the position relative to the line), for lineLR, but you can also use it for a calculation with lineRL. This time imagining that the line to your pixel runs down to the bottom right hand corner.

Consider the magenta color in your pic. The magenta color is printed when the slope to the point being considered, is greater (steeper), than the slope of lineRL && the slope of the line to point lower left corner, is also steeper than the slope of the lineLR.

Code:

^ * * * * * * # #-lineLR
* ^ * * * * # *
* * ^ * * # * * ^-lineRL
* * * ^ # * * *
* * * # ^ * * * L-point of origin for lineLR
* * # * * ^ * *
* # * * * * ^ * R-point of origin for lineRL
L * * * * * * R

I'm no math whiz, and I used a simpler approach, but if I had to use the slope of the line formula, that's how I'd do it. If the slope ever got too vertical, I'd just create an extra "border" row around the array, and work from 1 column to the left of the actual square, and one column to the right of the actual square, to avoid that problem.