From a5810983be9f1a01e060866e56fa3cc236c68634 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@98 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 146 +++++++++++++++++++++++++--------------- program/src/rrd_graph.h | 1 + 2 files changed, 94 insertions(+), 53 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index ea7ed0d2..111aaa67 100644 --- a/program/src/rrd_graph.c +++ b/program/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