diff options
author | Thomas White <taw@physics.org> | 2010-03-11 17:47:01 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-03-11 17:47:01 +0100 |
commit | 5f9185acec99456eb0673c9edb97cc8ae82de7ac (patch) | |
tree | 733579154170796c5ceb94560de595fc7145d74b /src/render.c | |
parent | 6ae81306a1be86cf47a7ec97a485b2184e22b4ff (diff) |
Multiple choice of colour scales
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/render.c b/src/render.c index 1ea36ea1..385944df 100644 --- a/src/render.c +++ b/src/render.c @@ -153,6 +153,14 @@ float *render_get_image_binned(DisplayWindow *dw, int binning, float *max) if ( val > max ) p = 1.0; \ r = 255.0*p; g = 255.0*p; b = 255.0*p; +#define RENDER_INVMONO \ + float p; \ + p = (float)val / (float)max; \ + p = 1.0 - p; \ + if ( val < 0.0 ) p = 1.0; \ + if ( val > max ) p = 0.0; \ + r = 255.0*p; g = 255.0*p; b = 255.0*p; + /* NB This function is shared between render_get_image() and * render_get_colour_scale() */ @@ -238,10 +246,23 @@ GdkPixbuf *render_get_image(DisplayWindow *dw) guchar r, g, b; val = hdr[x+w*y]; - if ( !dw->monochrome ) { + switch ( dw->scale ) { + case SCALE_COLOUR : { RENDER_RGB - } else { + break; + } + case SCALE_MONO : { RENDER_MONO + break; + } + case SCALE_INVMONO : { + RENDER_INVMONO + break; + } + default : { + RENDER_RGB; + break; + } } /* Stuff inside square brackets makes this pixel go to |