From 3b24830048322f604fb1cc5dd8b13e3b9e09fa73 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 5 Apr 2005 20:17:45 +0000 Subject: [PATCH] * fix transparency rendering by rewinding the paths propperly * fix x-axis label drawing by considering label precision git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@359 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_gfx.c | 26 ++++++++++++++------------ program/src/rrd_graph.c | 16 ++++++++++++---- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/program/src/rrd_gfx.c b/program/src/rrd_gfx.c index 21838275..0a443443 100644 --- a/program/src/rrd_gfx.c +++ b/program/src/rrd_gfx.c @@ -211,10 +211,6 @@ gfx_node_t *gfx_new_text (gfx_canvas_t *canvas, enum gfx_v_align_en v_align, char* text){ gfx_node_t *node = gfx_new_node(canvas,GFX_TEXT); -/* if (angle != 0.0){*/ - /* currently we only support 0 and 270 */ -/* angle = 270.0; - }*/ node->text = strdup(text); node->size = size; @@ -384,7 +380,7 @@ gfx_string gfx_string_create(FT_Face face,const char *text, gfx_char glyph; /* current glyph in table */ unsigned int n; int error; - int gottab; + int gottab = 0; ft_pen.x = 0; /* start at (0,0) !! */ ft_pen.y = 0; @@ -521,25 +517,31 @@ int gfx_render_png (gfx_canvas_t *canvas, switch (node->type) { case GFX_LINE: case GFX_AREA: { - ArtVpath *vec; + ArtVpath *vec,*pvec; double dst[6]; - ArtSVP *svp; + ArtSVP *svp,*usvp,*rsvp; art_affine_scale(dst,canvas->zoom,canvas->zoom); vec = art_vpath_affine_transform(node->path,dst); if (node->closed_path) gfx_libart_close_path(node, &vec); gfx_round_scaled_coordinates(vec); + pvec = art_vpath_perturb(vec); + art_free(vec); if(node->type == GFX_LINE){ - svp = art_svp_vpath_stroke ( vec, ART_PATH_STROKE_JOIN_ROUND, + svp = art_svp_vpath_stroke ( pvec, ART_PATH_STROKE_JOIN_ROUND, ART_PATH_STROKE_CAP_ROUND, node->size*canvas->zoom,1,1); } else { - svp = art_svp_from_vpath ( vec ); + svp = art_svp_from_vpath ( pvec ); } - art_free(vec); - art_rgb_svp_alpha (svp ,0,0, pys_width, pys_height, - node->color, buffer, rowstride, NULL); + art_free(pvec); + usvp=art_svp_uncross(svp); art_free(svp); + rsvp=art_svp_rewind_uncrossed(usvp,ART_WIND_RULE_ODDEVEN); + art_free(usvp); + art_rgb_svp_alpha (rsvp ,0,0, pys_width, pys_height, + node->color, buffer, rowstride, NULL); + art_free(rsvp); break; } case GFX_TEXT: { diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 22f3f542..0279d49d 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -1805,15 +1805,15 @@ vertical_grid( } /* paint the labels below the graph */ - for(ti = find_first_time(im->start, + for(ti = find_first_time(im->start - im->xlab_user.precis/2, im->xlab_user.labtm, im->xlab_user.labst); - ti <= im->end; + ti <= im->end - im->xlab_user.precis/2; ti = find_next_time(ti,im->xlab_user.labtm,im->xlab_user.labst) ){ tilab= ti + im->xlab_user.precis/2; /* correct time for the label */ /* are we inside the graph ? */ - if (ti < im->start || ti > im->end) continue; + if (tilab < im->start || tilab > im->end) continue; #if HAVE_STRFTIME localtime_r(&tilab, &tm); @@ -1962,6 +1962,14 @@ grid_paint(image_desc_t *im) im->tabwidth,"M", 0)*1.2; boxV = boxH; + /* make sure transparent colors show up all the same */ + node = gfx_new_area(im->canvas, + X0,Y0-boxV, + X0,Y0, + X0+boxH,Y0, + im->graph_col[GRC_CANVAS]); + gfx_add_point ( node, X0+boxH, Y0-boxV ); + node = gfx_new_area(im->canvas, X0,Y0-boxV, X0,Y0, @@ -1970,7 +1978,7 @@ grid_paint(image_desc_t *im) gfx_add_point ( node, X0+boxH, Y0-boxV ); node = gfx_new_line(im->canvas, X0,Y0-boxV, X0,Y0, - 1,0x000000FF); + 1,im->graph_col[GRC_FONT]); gfx_add_point(node,X0+boxH,Y0); gfx_add_point(node,X0+boxH,Y0-boxV); gfx_close_path(node); -- 2.30.2