diff options
author | Thomas White <taw@physics.org> | 2020-06-29 13:55:20 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:44 +0200 |
commit | 6dfea8ddd0b7cb717fc120dc68edc42b0e1fbdd8 (patch) | |
tree | 0579adcdcee8bb37c8028c26065b068276868204 /src/geoptimiser.c | |
parent | 93be7a848a320d8eaa0966f57aa56b0337525d4c (diff) |
Break render.c down and move to geoptimiser and CrystFELImageView
These two functions will diverge in the future. Also, this change
removes the last remaining dependency of libcrystfel on
Gdk/Gtk-anything.
Diffstat (limited to 'src/geoptimiser.c')
-rw-r--r-- | src/geoptimiser.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/geoptimiser.c b/src/geoptimiser.c index ec4fbcd4..385a85d4 100644 --- a/src/geoptimiser.c +++ b/src/geoptimiser.c @@ -59,7 +59,6 @@ #include "crystal.h" #include "image.h" #include "utils.h" -#include "render.h" #include "colscale.h" struct imagefeature; @@ -157,6 +156,49 @@ struct gpanel }; +static GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale) +{ + guchar *data; + size_t x, y; + int max; + + data = malloc(3*w*h); + if ( data == NULL ) return NULL; + + max = h-(h/6); + + for ( y=0; y<h; y++ ) { + + double r, g, b; + int val; + + val = y-(h/6); + + render_scale(val, max, scale, &r, &g, &b); + + data[3*( 0+w*(h-1-y) )+0] = 0; + data[3*( 0+w*(h-1-y) )+1] = 0; + data[3*( 0+w*(h-1-y) )+2] = 0; + for ( x=1; x<w; x++ ) { + data[3*( x+w*(h-1-y) )+0] = 255*r; + data[3*( x+w*(h-1-y) )+1] = 255*g; + data[3*( x+w*(h-1-y) )+2] = 255*b; + } + + } + + 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); +} + + static void compute_x_y(double fs, double ss, struct panel *p, double *x, double *y) { |