[comp.graphics] help, A SUNview routine

abed@saturn.wustl.edu (Abed M. Hammoud) (01/17/91)

	Hello, 

	I wrote this routine that can be called from a C program to display
	an image on a sparc 1+ station. 
===========================================================================
#include <suntool/sunview.h>
#include <suntool/canvas.h>
#include <sunwindow/cms_rainbow.h>

void mesh(unsigned char picture[], int rsize, int csize)
{
  Frame frame;
  Canvas canvas;
  Pixwin *pw, *pw_open();
  int   j, i, start, stop;
  unsigned char red[CMS_RAINBOWSIZE],
		green[CMS_RAINBOWSIZE],
		blue[CMS_RAINBOWSIZE];
  unsigned char *ptr; 
/*---------------------------------------------------------------------*/  
  frame = window_create (NULL, FRAME,FRAME_LABEL, "MESH GRAPHICS ROUTINE
		.        Version 0.1  WU-ESSRL              1/11/1990",0);
  canvas = window_create( frame, CANVAS, 0);

  cms_rainbowsetup(red, green, blue); 
  pw = (Pixwin *) canvas_pixwin(canvas);
  pw_setcmsname(pw, CMS_RAINBOW); 
  pw_putcolormap(pw, 0, CMS_RAINBOWSIZE, red, green, blue); 

  pw_batch_on(pw);
  for (ptr=picture, i=0; i < rsize; i++)
    for (j=0; j < csize; j++, ++ptr)
      pw_put(pw, i, j, (int) *ptr);
  pw_batch_off(pw);

  window_main_loop(frame);
  window_done(frame); 
}
===========================================================================

	I like the above routine and I used it in some of my programs
	and it worked fine. My problem is that I do not like the color
	tables that are available on my system. I would like something
	like a heated body color table. Something good to display colored
	images.

	The color tables available on my station are:
	cms_rgb.h	
	cms_grays.h	
	cms_mono.h	
	cms_rainbow.h	

	please if any body could help me with any comments I would
	appreciate it. 

        thanks a million 

	--------------------------------------------------------------
	| Abed  M. Hammoud			abed@saturn.wustl.edu|
	| Washington University.	        office:(314)726-7547 |
	| Electronic Systems & Signals Research Laboratory.          |
	| Dept. of Electrical/Biomedical Engineering.		     |
	| St.Louis Mo U.S.A                                          |
	--------------------------------------------------------------