diff options
author | Thomas White <taw@physics.org> | 2021-02-23 12:39:36 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-02-23 12:39:36 +0100 |
commit | 7f33f614b30a7d3526f48398048607e79f0d7bc0 (patch) | |
tree | f3007adcceaba9dd965800d9a720b5e98de3ed94 /src | |
parent | a9d1ecd69c7ca95de3ad21bfc7fc09e99a858415 (diff) |
CrystFELImageView: Use different colours for multiple crystals
This adds a cycle of four colours. It seems difficult to choose colours
that are always clearly visible, but maybe the list can be extended in
the future.
Diffstat (limited to 'src')
-rw-r--r-- | src/crystfelimageview.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c index 4a925b14..0d1cd519 100644 --- a/src/crystfelimageview.c +++ b/src/crystfelimageview.c @@ -439,7 +439,8 @@ static void draw_peaks(cairo_t *cr, CrystFELImageView *iv, static void draw_refls(cairo_t *cr, CrystFELImageView *iv, RefList *list, - int label_reflections) + int label_reflections, + double *colour) { const Reflection *refl; RefListIterator *iter; @@ -486,7 +487,11 @@ static void draw_refls(cairo_t *cr, if ( get_redundancy(refl) == 0 ) { cairo_set_source_rgba(cr, 0.7, 0.0, 0.0, 0.9); } else { - cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.9); + cairo_set_source_rgba(cr, + colour[0], + colour[1], + colour[2], + 0.9); } cairo_stroke(cr); @@ -495,7 +500,11 @@ static void draw_refls(cairo_t *cr, cairo_line_to(cr, x+0.2*p->pixel_pitch, y); cairo_move_to(cr, x, y-0.2*p->pixel_pitch); cairo_line_to(cr, x, y+0.2*p->pixel_pitch); - cairo_set_source_rgba(cr, 0.0, 0.4, 0.0, 0.9); + cairo_set_source_rgba(cr, + colour[0]/2.0, + colour[1]/2.0, + colour[2]/2.0, + 0.9); cairo_stroke(cr); } @@ -524,6 +533,17 @@ static void draw_refls(cairo_t *cr, } +static double crystal_cols[][3] = +{ + {0.0, 1.0, 1.0}, /* bright green */ + {1.0, 1.0, 0.0}, /* bright yellow */ + {0.0, 0.8, 0.8}, /* cyan */ + {1.0, 1.0, 1.0}, /* white */ +}; + +static int n_crystal_cols = 4; + + static gint draw_sig(GtkWidget *window, cairo_t *cr, CrystFELImageView *iv) { cairo_matrix_t m; @@ -565,7 +585,8 @@ static gint draw_sig(GtkWidget *window, cairo_t *cr, CrystFELImageView *iv) Crystal *cry = iv->image->crystals[i]; draw_refls(cr, iv, crystal_get_reflections(cry), - iv->label_refls); + iv->label_refls, + crystal_cols[i % n_crystal_cols]); } } |