From 7da61bc0541d265e6cabb1facf7e2c1a0920c6c7 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Mon, 30 Nov 2020 23:20:06 +0100 Subject: [PATCH] draw wide lines (bus=true attribute) in svg export --- src/svgdraw.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/svgdraw.c b/src/svgdraw.c index 884ede2b..ee310c2e 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -44,10 +44,11 @@ static void svg_restore_lw(void) svg_linew = xctx->lw*1.2; } -static void svg_xdrawline(int layer, double x1, double y1, double x2, double y2, int dash) +static void svg_xdrawline(int layer, int bus, double x1, double y1, double x2, double y2, int dash) { fprintf(fd,"zoom, 1.4*dash/xctx->zoom); + if(bus) fprintf(fd, "style=\"stroke-width:%g;\" ", BUS_WIDTH * svg_linew); fprintf(fd,"d=\"M%g %gL%g %g\"/>\n", x1, y1, x2, y2); } @@ -167,7 +168,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a } -static void svg_drawline(int gc, double linex1,double liney1,double linex2,double liney2, int dash) +static void svg_drawline(int gc, int bus, double linex1,double liney1,double linex2,double liney2, int dash) { double x1,y1,x2,y2; @@ -177,7 +178,7 @@ static void svg_drawline(int gc, double linex1,double liney1,double linex2,doubl y2=Y_TO_SVG(liney2); if( clip(&x1,&y1,&x2,&y2) ) { - svg_xdrawline(gc, x1, y1, x2, y2, dash); + svg_xdrawline(gc, bus, x1, y1, x2, y2, dash); } } @@ -345,7 +346,7 @@ static void old_svg_draw_string(int layer, const char *str, ROTATION(rot, flip, x,y,curr_x1,curr_y1,rx1,ry1); ROTATION(rot, flip, x,y,curr_x2,curr_y2,rx2,ry2); ORDER(rx1,ry1,rx2,ry2); - svg_drawline(layer, rx1, ry1, rx2, ry2, 0); + svg_drawline(layer, 0, rx1, ry1, rx2, ry2, 0); } pos++; } @@ -362,18 +363,18 @@ static void svg_drawgrid() x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz; if(y>areay1 && yareax1 && xyorigin* xctx->mooz,delta); for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);xinst[n].ptr+ xctx->sym)->polygons[layer];j++) @@ -677,7 +678,7 @@ void svg_draw(void) for(c=0;clines[c];i++) - svg_drawline(c, xctx->line[c][i].x1, xctx->line[c][i].y1, + svg_drawline(c, xctx->line[c][i].bus, xctx->line[c][i].x1, xctx->line[c][i].y1, xctx->line[c][i].x2, xctx->line[c][i].y2, xctx->line[c][i].dash); for(i=0;irects[c];i++) { @@ -701,7 +702,7 @@ void svg_draw(void) for(i=0;iwires;i++) { - svg_drawline(WIRELAYER, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0); + svg_drawline(WIRELAYER, xctx->wire[i].bus, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0); } { double x1, y1, x2, y2;