diff options
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 70 |
1 files changed, 57 insertions, 13 deletions
@@ -226,7 +226,7 @@ void draw_trapezium(int x1, int y1, char st, char fix){ f = draw_xy; /* This is valid only for "upper" trapezoids */ - if ((st & BOX_TRAP_U) == BOX_TRAP_U){ + if (STYLE_IS(st, BOX_TRAP_U)){ #ifdef DEBUG fprintf(stderr, "This is an 'upward' trapezium\n"); #endif @@ -237,7 +237,7 @@ void draw_trapezium(int x1, int y1, char st, char fix){ left_c = '/'; right_c = '\\'; } - else if ((st & BOX_TRAP_D) == BOX_TRAP_D){ + else if (STYLE_IS(st, BOX_TRAP_D)){ #ifdef DEBUG fprintf(stderr, "This is a 'downward' trapezium\n"); #endif @@ -248,25 +248,69 @@ void draw_trapezium(int x1, int y1, char st, char fix){ right_c = '/'; left_c = '\\'; } + /* Long side */ for(i=xmin+1; i<=xmax; i++){ f(i, ylong, line_h); } - if (st & 0x02){ /* Centred trapezium */ - for(i=xmin+xoff; i<=xmax-xoff; i++){ + /* short side */ + for(i=xmin+xoff; i<=xmax-xoff; i++){ + f(i, yshort, line_h); + } + + if (STYLE_IS(st, BOX_TRAP_L)){ + left_c = '/'; + right_c = line_v; + for(i=xmax-xoff;i<xmax; i++){ f(i, yshort, line_h); } + xoff = dy; + if (STYLE_IS(st, BOX_TRAP_D)){ + xoff = 0; + left_c = '\\'; + } + for(i=ymin; i<ymax; i++, xoff += xincr){ + f(xmin+xoff, i, left_c); + f(xmax, i, right_c); + } + xoff = dy; + f(xmin+xoff, yshort, corner); + f(xmax, yshort, corner); } - f(xmin+xoff, yshort, corner); + else if (STYLE_IS(st, BOX_TRAP_R)){ + right_c = '\\'; + left_c = line_v; + for(i=xmin; i<xmin+xoff; i++){ + f(i, yshort, line_h); + } + xoff = dy-1; + if (STYLE_IS(st, BOX_TRAP_D)){ + xoff = 1; + right_c = '/'; + } + for(i=ymin+1; i<ymax; i++, xoff += xincr){ + f(xmin, i, left_c); + f(xmax-xoff, i, right_c); + } + xoff = dy; + f(xmin, yshort, corner); + f(xmax-xoff, yshort, corner); + } + else if (STYLE_IS(st, BOX_TRAP_C)){ + xoff = dy - 1; + if (STYLE_IS(st, BOX_TRAP_D)) + xoff = 1; + for(i=ymin+1; i<ymax; i++, xoff += xincr){ + f(xmin + xoff, i, left_c); + f(xmax - xoff, i, right_c); + } + xoff = dy; + f(xmin+xoff, yshort, corner); + f(xmax-xoff, yshort, corner); + } + + f(xmin, ylong, corner); - f(xmax-xoff, yshort, corner); f(xmax, ylong, corner); - xoff --; - if ((st & BOX_TRAP_DC) == BOX_TRAP_DC) - xoff = 1; - for(i=ymin+1; i<ymax; i++, xoff += xincr){ - f(xmin + xoff, i, left_c); - f(xmax - xoff, i, right_c); - } if (fix == FIX) |