From 2823f2e38bb785827733425c8691dc6b60d5f96c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 15 Jul 2010 14:36:57 +0200 Subject: render_hkl: Add --colour-key option, shuffle help message around --- src/render_hkl.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'src/render_hkl.c') diff --git a/src/render_hkl.c b/src/render_hkl.c index 829ceb4e..01f1b253 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -44,15 +44,21 @@ static void show_help(const char *s) printf( "Render intensity lists in various ways.\n" "\n" -" -h, --help Display this help message.\n" " --povray Render a 3D animation using POV-ray.\n" #ifdef HAVE_CAIRO " --zone-axis Render a 2D zone axis pattern.\n" #endif +"\n" " --boost= Squash colour scale by .\n" -" -j Run instances of POV-ray in parallel.\n" " -p, --pdb= PDB file from which to get the unit cell.\n" " -y, --symmetry= Expand reflections according to point group .\n" +"\n" +" -c, --colscale= Use the given colour scale. Choose from:\n" +" mono : Greyscale, black is zero.\n" +" invmono : Greyscale, white is zero.\n" +" colour : Colours scale:\n" +" black-blue-pink-red-orange-yellow-white\n" +"\n" " -w --weighting= Colour/shade the reciprocal lattice points\n" " according to:\n" " I : the intensity of the reflection.\n" @@ -61,6 +67,10 @@ static void show_help(const char *s) " (after correcting for 'epsilon')\n" " rawcts : the raw number of hits for the\n" " reflection (no 'epsilon' correction).\n" +"\n" +" --colour-key Draw (only) the key for the current colour scale.\n" +" -j Run instances of POV-ray in parallel.\n" +" -h, --help Display this help message.\n" ); } @@ -281,6 +291,45 @@ out: cairo_surface_finish(surface); cairo_destroy(dctx); } + +static int render_key(int colscale) +{ + cairo_surface_t *surface; + cairo_t *dctx; + float wh, ht; + float y; + + wh = 128; + ht = 1024; + + surface = cairo_pdf_surface_create("key.pdf", wh, ht); + + if ( cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS ) { + fprintf(stderr, "Couldn't create Cairo surface\n"); + cairo_surface_destroy(surface); + return 1; + } + + dctx = cairo_create(surface); + + for ( y=0; y