26 #define MSG_NOSIGNAL 0 29 #include <sys/socket.h> 30 #include <netinet/in.h> 31 #include <arpa/inet.h> 37 #define MSG_NOSIGNAL 0 132 fout = fopen(_outputfilename,
"w");
168 sprintf(buf,
"\n<svgend></svgend>\n");
174 sprintf(buf,
"gendDraw\n");
206 int ret,bytes_left,first_byte;
208 if(
sout == NULL)
return -1;
209 if(*
sout == -1)
return -1;
211 bytes_left = strlen(
text);
214 while(bytes_left > 0)
236 else if(
fout != NULL)
243 else if(
pipe != NULL)
259 svg.
printf(
"<svg width=\"%dpx\" height=\"%dpx\" viewBox=\"0 0 %d %d\" style=\"background: rgb(%d,%d,%d)\"\n",
width, height,
width, height, rbackground, gbackground, bbackground);
260 svg +=
" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" baseProfile=\"tiny\">\n";
261 svg +=
" <desc>svgvdi for smf files</desc>\n";
326 return text(
tx(x),
ty(y), txt, alignment);
344 svg.
printf(
"<g transform=\"translate(%d,%d)\" >\n <g transform=\"rotate(-90)\" >\n <text x=\"0\" y=\"0\" text-anchor=\"middle\" %s>%s</text>\n </g>\n</g>\n", x, y,
textoptions.
text(), txt);
368 const char *
rlSvgVdi::boxWithText(
int x,
int y,
int w,
int h,
int fontsize,
const char *xlabel,
const char *ylabel,
const char * rylabel)
389 char *cptr = strchr(text,
'.');
392 char *end = cptr + strlen(cptr) - 1;
395 if (*end ==
'0') { *end =
'\0'; }
396 else if(*end ==
'.') { *end =
'\0';
break; }
400 if(cptr == end) *cptr =
'\0';
437 if(draw==0)
return "";
452 if(start < 0.0f && end > 0.0f)
470 if(draw==0)
return "";
485 if(start < 0.0f && end > 0.0f)
502 if(draw==0)
return "";
520 if(start < 0.0f && end > 0.0f)
591 svg3 =
"<polyline points=\"";
592 for(
int i=0; i<n; i++)
594 sprintf(buf,
" %d,%d",
tx(x[i]),
ty(y[i]));
599 svg3 +=
" fill=\"none\"/>\n";
611 sprintf(
stroke,
"#%02x%02x%02x", r, g, b);
632 if(weight == 1)
fontstring.
printf(
"font-family=\"%s\" font-weight=\"%s\" font-size=\"%d\"", family,
"normal", size);
633 else fontstring.
printf(
"font-family=\"%s\" font-weight=\"%s\" font-size=\"%d\"", family,
"bold", size);
634 if(italic == 1)
fontstring +=
" font-style=\"italic\"";
698 if(ret < 0)
return "";
706 sprintf(buf,
"M %d %d", x[0], y[0]);
708 for(
int i=1; i<count; i++)
710 sprintf(buf,
" L %d %d", x[i], y[i]);
722 for(
int i=0; i<count; i++)
724 sprintf(buf,
" %d,%d", x[i], y[i]);
const char * setWidth(int w)
const char * rect(int x, int y, int w, int h)
const char * svgHeader(int width=1280, int height=1024, int rbackground=255, int gbackground=255, int bbackground=255)
const char * comment(const char *text)
const char * moveTo(int x, int y)
const char * lineTo(int x, int y)
const char * svg_points(int *x, int *y, int count)
int writeString(const char *buf)
const char * textInAxis(float x, float y, const char *text, int alignment)
const char * svg_d(int *x, int *y, int count)
const char * box(int x, int y, int w, int h)
const char * setColor(int r, int g, int b)
const char * line(int x1, int y1, int x2, int y2)
static int beautyval(char *text)
const char * drawEllipse(int x, int y, int rx, int ry)
int perhapsSend(const char *text)
const char * yAxis(float start, float delta, float end, int draw=1)
int rlvsnprintf(char *text, int len, const char *format, va_list ap)
const char * text(int x, int y, const char *text, int alignment=ALIGN_LEFT)
const char * svgTrailer()
const char * drawSymbol(int x, int y, int type)
const char * rightYAxis(float start, float delta, float end, int draw=1)
const char * setLinestyle(const char *dasharray)
const char * boxWithText(int x, int y, int w, int h, int fontsize, const char *xlabel, const char *ylabel, const char *rylabel)
int printf(const char *format,...)
int setOutput(int *socket_out, int idForPvbrowser=0)
const char * setFont(const char *family, int size, int weight, int italic)
const char * xAxis(float start, float delta, float end, int draw=1)
const char * svg_put(const char *text)
const char * svg_printf(const char *format,...)