diff options
author | epoch <epoch@enzo.thebackupbox.net> | 2021-01-05 07:27:56 -0600 |
---|---|---|
committer | epoch <epoch@enzo.thebackupbox.net> | 2021-01-05 07:27:56 -0600 |
commit | 515132d67b7839ef769ceb66489a65dd6b2d689f (patch) | |
tree | dbb683e324210a7e098b70b52077fb3a251a1057 /src | |
parent | 55284c5f1bed4ea9b3b4a21b2df74b999a6fb010 (diff) | |
download | hackvr-515132d67b7839ef769ceb66489a65dd6b2d689f.tar.gz hackvr-515132d67b7839ef769ceb66489a65dd6b2d689f.zip |
hackvr_svg. added some debugging comments and <URL> group names now output as links
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics_cs_svg.c | 32 |
1 files changed, 31 insertions, 1 deletions
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,"<!-- shape "); + strcat(svg_global.backbuffer,s.id); + 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,"<a href=\""); + strcat(svg_global.backbuffer,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,"</a>"); + free(url); + } } void draw_cs_filled_shape(cs_s_t s) { int i; char tmp[1024]; + char *url=0; + strcat(svg_global.backbuffer,"<!-- shape "); + strcat(svg_global.backbuffer,s.id); + 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,"<a href=\""); + strcat(svg_global.backbuffer,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,"</a>"); + 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"; |