From c2a7f0a7c81f0e60e6e2204bac700388f228bf87 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 21 Mar 2002 12:00:51 +0000 Subject: [PATCH] Pie charts didn't have anti-aliasing; building them clockwise seems to solve this problem. git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@98 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_graph.c | 146 ++++++++++++++++++++++++++++++------------------ src/rrd_graph.h | 1 + 2 files changed, 94 insertions(+), 53 deletions(-) diff --git a/src/rrd_graph.c b/src/rrd_graph.c index ea7ed0d..111aaa6 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -1844,6 +1844,51 @@ int lazy_check(image_desc_t *im){ return size; } +void +pie_part(gfx_canvas_t *canvas, gfx_color_t color, + double PieCenterX, double PieCenterY, double Radius, + double startangle, double endangle) +{ + gfx_node_t *node; + double angle; + double step=M_PI/50; /* Number of iterations for the circle; + ** 10 is definitely too low, more than + ** 50 seems to be overkill + */ + + /* Strange but true: we have to work clockwise or else + ** anti aliasing nor transparency don't work. + ** + ** This test is here to make sure we do it right, also + ** this makes the for...next loop more easy to implement. + ** The return will occur if the user enters a negative number + ** (which shouldn't be done according to the specs) or if the + ** programmers do something wrong (which, as we all know, never + ** happens anyway :) + */ + if (endangle