From 515132d67b7839ef769ceb66489a65dd6b2d689f Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 5 Jan 2021 07:27:56 -0600 Subject: hackvr_svg. added some debugging comments and group names now output as links --- src/graphics_cs_svg.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/graphics_cs_svg.c b/src/graphics_cs_svg.c index 305ad39..1e3672e 100644 --- a/src/graphics_cs_svg.c +++ b/src/graphics_cs_svg.c @@ -66,6 +66,17 @@ void draw_cs_shape(cs_s_t s) {//this is implemented as draw_cs_line... hrm. it c char tmp[1024]; //cs_t smouse=c2_to_cs(gra_global.mouse); int i;//all cs shapes can have 1, 2, or 3+ points. guess I gotta do that logic here too. + char *url=0; + strcat(svg_global.backbuffer,""); + if(s.id[0] == '<' && s.id[strlen(s.id)-1] == '>') { + url=strdup(s.id); + url[strlen(s.id)-1]=0;//use url+1 + strcat(svg_global.backbuffer,""); + } switch(s.len) { case 1: break; @@ -80,11 +91,26 @@ void draw_cs_shape(cs_s_t s) {//this is implemented as draw_cs_line... hrm. it c strcat(svg_global.backbuffer,tmp); break; } + if(url) { + strcat(svg_global.backbuffer,""); + free(url); + } } void draw_cs_filled_shape(cs_s_t s) { int i; char tmp[1024]; + char *url=0; + strcat(svg_global.backbuffer,""); + if(s.id[0] == '<' && s.id[strlen(s.id)-1] == '>') { + url=strdup(s.id); + url[strlen(s.id)-1]=0;//use url+1 + strcat(svg_global.backbuffer,""); + } switch(s.len) { case 1: break; @@ -99,6 +125,10 @@ void draw_cs_filled_shape(cs_s_t s) { strcat(svg_global.backbuffer,tmp); break; } + if(url) { + strcat(svg_global.backbuffer,""); + free(url); + } } //should I do clipping in each graphics lib or make graphics.c just have clipping stuff? @@ -208,7 +238,7 @@ void set_title(char *t) { } int graphics_sub_init() {//this returns an fd we need to keep an eye one? :/ - svg_global.filename="/tmp/hackvr.html"; + svg_global.filename=getenv("HACKVR_SVG_OUTPUT")?getenv("HACKVR_SVG_OUTPUT"):"/tmp/hackvr.html"; svg_global.ansi_color[0]="black"; svg_global.ansi_color[1]="blue"; svg_global.ansi_color[2]="green"; -- cgit v1.2.3