- draw->lineTo(draw, p[pos].x+c, p[pos].y+s);
- draw->lineTo(draw, p[pos].x+c-s, p[pos].y+s+c);
- draw->lineTo(draw, p[pos].x-c-s, p[pos].y-s+c);
- draw->lineTo(draw, p[pos].x-c, p[pos].y-s);
+ if(cap == gfx_capButt) {
+ draw->lineTo(draw, p[pos].x+c, p[pos].y+s);
+ draw->lineTo(draw, p[pos].x-c, p[pos].y-s);
+ } else if(cap == gfx_capRound) {
+ draw_arc(draw, p[pos].x, p[pos].y, lastw-M_PI/2, lastw+M_PI/2, width);
+ } else if(cap == gfx_capSquare) {
+ double c = cos(lastw-M_PI/2)*width;
+ double s = sin(lastw-M_PI/2)*width;
+ draw->lineTo(draw, p[pos].x+c, p[pos].y+s);
+ draw->lineTo(draw, p[pos].x+c-s, p[pos].y+s+c);
+ draw->lineTo(draw, p[pos].x-c-s, p[pos].y-s+c);
+ draw->lineTo(draw, p[pos].x-c, p[pos].y-s);
+ }
+ lastw += M_PI; // for dots