diff options
author | David Robillard <d@drobilla.net> | 2015-02-22 00:39:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-22 00:39:53 +0000 |
commit | 99b449b7e39f0a74b04f37c4abd74f20d05d87b2 (patch) | |
tree | a82f4e91c5f4d1d11b8c6ef12b106ecb378d304a /src/circle.c | |
parent | 1e73d9839e79807324f6c002502411377b44e69e (diff) | |
download | ganv-99b449b7e39f0a74b04f37c4abd74f20d05d87b2.tar.gz ganv-99b449b7e39f0a74b04f37c4abd74f20d05d87b2.tar.bz2 ganv-99b449b7e39f0a74b04f37c4abd74f20d05d87b2.zip |
Improve appearance of graphs with circle nodes.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5596 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/circle.c')
-rw-r--r-- | src/circle.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/circle.c b/src/circle.c index fe2a54b..2863e7d 100644 --- a/src/circle.c +++ b/src/circle.c @@ -189,12 +189,13 @@ ganv_circle_vector(const GanvNode* self, const double other_x = GANV_ITEM(other)->impl->x; const double other_y = GANV_ITEM(other)->impl->y; + const double border = circle->node.impl->border_width; const double xdist = other_x - cx; const double ydist = other_y - cy; const double h = sqrt((xdist * xdist) + (ydist * ydist)); const double theta = asin(xdist / (h + DBL_EPSILON)); const double y_mod = (cy < other_y) ? 1 : -1; - const double ret_h = h - circle->impl->coords.radius; + const double ret_h = h - circle->impl->coords.radius - border / 2.0; const double ret_x = other_x - sin(theta) * ret_h; const double ret_y = other_y - cos(theta) * ret_h * y_mod; @@ -296,19 +297,23 @@ ganv_circle_draw(GanvItem* item, ganv_node_get_draw_properties( &circle->node, &dash_length, &border_color, &fill_color); + // Fill cairo_new_path(cr); cairo_arc(cr, x, y, - impl->coords.radius, + impl->coords.radius + (impl->coords.width / 2.0), 0, 2 * G_PI); - - // Fill color_to_rgba(fill_color, &r, &g, &b, &a); cairo_set_source_rgba(cr, r, g, b, a); - cairo_fill_preserve(cr); + cairo_fill(cr); // Border + cairo_arc(cr, + x, + y, + impl->coords.radius, + 0, 2 * G_PI); color_to_rgba(border_color, &r, &g, &b, &a); cairo_set_source_rgba(cr, r, g, b, a); cairo_set_line_width(cr, impl->coords.width); |