aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-01 17:01:12 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:16 +0100
commit6e61cea30023df93be0a896be56df6107bd09763 (patch)
tree886c6bdbc9b49167598f9e4b0fec1f8a37ad90f9
parent43337144f55e73426f2c6a2f33f12e45117da1a6 (diff)
hdfsee: Centre the resolution shell labels
-rw-r--r--src/dw-hdfsee.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 9c42bf5b..115d29f4 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -146,6 +146,7 @@ static double ring_radius(struct image *image, double d)
static void show_ring(cairo_t *cr, DisplayWindow *dw,
double d, const char *label)
{
+ cairo_text_extents_t size;
cairo_identity_matrix(cr);
cairo_translate(cr, -dw->min_x/dw->binning, dw->max_y/dw->binning);
cairo_arc(cr, 0.0, 0.0, ring_radius(dw->image, d)/dw->binning,
@@ -153,10 +154,15 @@ static void show_ring(cairo_t *cr, DisplayWindow *dw,
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
cairo_set_line_width(cr, 1.0);
cairo_stroke(cr);
+
cairo_rotate(cr, -M_PI/4.0);
cairo_translate(cr, 0.0,
ring_radius(dw->image, d)/dw->binning-5.0);
cairo_set_font_size(cr, 20.0);
+ cairo_text_extents(cr, label, &size);
+ cairo_translate(cr, -size.width/2.0, 0.0);
+
+
cairo_show_text(cr, label);
cairo_fill(cr);
}