Given a line running through p1:(x1,y1) and p2:(x2,y2),
I need to calculate two points such that a new parallel line 20 pixels away from the given line runs through the two new points.
Edit: The newline can be 20 pixels in either direction (i.e., pick a direction; it does not matter).
The slope of your line is $m=\frac{y_2-y_1}{x_2-x_1}$, and the slope of the perpendicular is $\frac{-1}{m}=\frac{-(x_2-x_1)}{y_2-y_1}$. You want a segement along the perpendicular of length $20$. So if the $x$ offset is $\Delta x$ and the $y$ offset is $\Delta y$, we have $\Delta y=\frac{-(x_2-x_1)}{y_2-y_1}\Delta x$ and using the length $20=\Delta x \sqrt{1+(\frac{-(x_2-x_1)}{y_2-y_1})^2}$ where you choose the sign of the square root to get the correct side of the line you can find $\Delta x$.