X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=program%2Fsrc%2Frrd_graph.c;h=a71a174a5001cc931a0013fed39a93e6d8302bc4;hb=3a856c49a6374cf7a17c3c5be67d1ddd96b3b0f6;hp=6dbece3612d84421b2ff20b274c4cbad6b27077b;hpb=60e8a2fc96e1b91e0c277032119cdd6526da2f3c;p=rrdtool-all.git diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 6dbece36..a71a174a 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -1977,6 +1977,17 @@ grid_paint(image_desc_t *im) 5.5, im->tabwidth, 270, GFX_H_RIGHT, GFX_V_TOP, "RRDTOOL / TOBI OETIKER"); + + /* graph watermark */ + if(im->watermark[0] != '\0') { + gfx_new_text( im->canvas, + im->ximg/2, im->yimg-6, + ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044, + im->text_prop[TEXT_PROP_AXIS].font, + 5.5, im->tabwidth, 0, + GFX_H_CENTER, GFX_V_BOTTOM, + im->watermark); + } /* graph labels */ if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) { @@ -2140,6 +2151,8 @@ graph_size_location(image_desc_t *im, int elements ** |v+--+-------------------------------+--------+ ** | |..............legends......................| ** +-+-------------------------------------------+ + ** | watermark | + ** +---------------------------------------------+ */ int Xvertical=0, Ytitle =0, @@ -2152,7 +2165,9 @@ graph_size_location(image_desc_t *im, int elements #if 0 Xlegend =0, Ylegend =0, #endif - Xspacing =15, Yspacing =15; + Xspacing =15, Yspacing =15, + + Ywatermark =4; if (im->extra_flags & ONLY_GRAPH) { im->xorigin =0; @@ -2239,12 +2254,13 @@ graph_size_location(image_desc_t *im, int elements xtr(im,0); /* The vertical size is interesting... we need to compare - ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend} with Yvertical - ** however we need to know {Ytitle+Ymain+Yxlabel} in order to - ** start even thinking about Ylegend. + ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with + ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel} + ** in order to start even thinking about Ylegend or Ywatermark. ** ** Do it in three portions: First calculate the inner part, - ** then do the legend, then adjust the total height of the img. + ** then do the legend, then adjust the total height of the img, + ** adding space for a watermark if one exists; */ /* reserve space for main and/or pie */ @@ -2273,7 +2289,10 @@ graph_size_location(image_desc_t *im, int elements */ if(leg_place(im)==-1) return -1; - + + if (im->watermark[0] != '\0') { + im->yimg += Ywatermark; + } #if 0 if (Xlegend > im->ximg) { @@ -2899,6 +2918,7 @@ rrd_graph_init(image_desc_t *im) im->step = 0; im->ylegend[0] = '\0'; im->title[0] = '\0'; + im->watermark[0] = '\0'; im->minval = DNAN; im->maxval = DNAN; im->unitsexponent= 9999; @@ -2934,8 +2954,8 @@ rrd_graph_init(image_desc_t *im) windir = getenv("windir"); /* %windir% is something like D:\windows or C:\winnt */ if (windir != NULL) { - strncpy(rrd_win_default_font,windir,999); - rrd_win_default_font[999] = '\0'; + strncpy(rrd_win_default_font,windir,500); + rrd_win_default_font[500] = '\0'; strcat(rrd_win_default_font,"\\fonts\\"); strcat(rrd_win_default_font,RRD_DEFAULT_FONT); for(i=0;icanvas->font_aa_threshold = atof(optarg); break; + case 'W': + strncpy(im->watermark,optarg,100); + im->watermark[99]='\0'; + break; + case '?': if (optopt != 0) rrd_set_error("unknown option '%c'", optopt);