Is it possible to implement a "draw_target" function which you can pass a BMAP* as a render target, then all calls to 'draw_' functions will be rendered onto the BMAP*. If you pass NULL to the function it resets to normal rendering.
Code:
void draw_target(BMAP*);
//...
draw_target(pRenderTarget); // Set a render target
draw_line(vector(x1,y1,0),NULL,100);
draw_line(vector(x2,y1,0),_vec(0,0,255),100);
draw_line(vector(x2,y2,0),_vec(0,0,255),100);
draw_line(vector(x1,y2,0),_vec(0,0,255),100);
draw_line(vector(x1,y1,0),_vec(0,0,255),100);
draw_target(NULL); // Reset render target