diff options
author | Thomas White <taw@physics.org> | 2014-08-13 13:25:15 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-08-13 13:25:31 +0200 |
commit | 5625ca80961b26aa8be3962b500febccec24fdf5 (patch) | |
tree | 826eabde0dc81734b6adcbc22c9c7592dd7b3c5f | |
parent | f210d6eff87a8ab5260a6cedd2adda518c7e9de8 (diff) |
hdfsee/render_hkl: Show negative values on colour scale
-rw-r--r-- | libcrystfel/src/render.c | 13 | ||||
-rw-r--r-- | src/hdfsee-render.c | 15 |
2 files changed, 19 insertions, 9 deletions
diff --git a/libcrystfel/src/render.c b/libcrystfel/src/render.c index 5d0cf9e8..17318782 100644 --- a/libcrystfel/src/render.c +++ b/libcrystfel/src/render.c @@ -3,11 +3,11 @@ * * Render a high dynamic range buffer in some sensible way * - * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2009-2012 Thomas White <taw@physics.org> + * 2009-2012,2014 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -57,8 +57,11 @@ static void render_rgb(double val, double max, r = 0.0; g = 0.0; b = 0.0; if ( (val < 0.0) ) { - s = 0; - p = 0; + p = fabs(val) / (max/6.0); + *rp = 0.0; + *gp = 0.5*p; + *bp = 0.0; + return; } if ( (val > max) ) { s = 6; diff --git a/src/hdfsee-render.c b/src/hdfsee-render.c index c78aa677..abbb2ccd 100644 --- a/src/hdfsee-render.c +++ b/src/hdfsee-render.c @@ -3,11 +3,11 @@ * * Rendering bits for hdfsee * - * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2011-2012 Thomas White <taw@physics.org> + * 2011-2012,2014 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -253,7 +253,7 @@ GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale) double r, g, b; int val; - val = y; + val = y-(h/6); render_scale(val, max, scale, &r, &g, &b); @@ -268,6 +268,13 @@ GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale) } + y = h/6; + for ( x=1; x<w; x++ ) { + data[3*( x+w*(h-1-y) )+0] = 255; + data[3*( x+w*(h-1-y) )+1] = 255; + data[3*( x+w*(h-1-y) )+2] = 255; + } + return gdk_pixbuf_new_from_data(data, GDK_COLORSPACE_RGB, FALSE, 8, w, h, w*3, render_free_data, NULL); } |