Viewing contents of file '../idllib/ghrs/pro/combine_vel.pro'
	PRO COMBINE_VEL, REVERSE_SWITCH=REVERSE_SWITCH,		$
		GREEN_SWITCH=GREEN_SWITCH, LIGHTEN=LIGHTEN,	$
		TURQUOISE=TURQUOISE
;+
; NAME:
;	COMBINE_VEL
; PURPOSE:
;	Combines the current color table in the common block COLORS with the
;	velocity color table as formed by LOAD_VEL.
; CALLING SEQUENCE:
;	COMBINE_VEL
; OPTIONAL KEYWORD_PARAMETERS:
;	REVERSE_SWITCH	= If passed, and non-zero, then the red and blue color
;			  tables in the velocity color table are switched.
;	TURQUOISE	= If set, then turquoise is used instead of blue.
;	GREEN_SWITCH	= If set, then red and green are used instead of red
;			  and blue.  Ignored if TURQUOISE is set.
;	LIGHTEN		= If set, then some green is added to the blue to
;			  lighten the image.  Ignored if TURQUOISE or
;			  GREEN_SWITCH are set.
; OUTPUTS:
;	None.
; OPTIONAL OUTPUT PARAMETERS:
;	None.
; COMMON BLOCKS:
;	Uses the common block COLORS which is also used by LOADCT, STRETCH, ...
; SIDE EFFECTS:
;	The color table is changed so that values in the lower half of the
;	device range (typically 0-127) represent velocities as formed by the
;	routine FORM_VEL, and values in the upper half (typically 128-255)
;	represent intensities.  Each part of the color table has only half the
;	resolution of the original color tables.
; 
;	If the color table in common block COLORS has not been initialized, 
;	then it will be initialized to a black & white grey scale.
; RESTRICTIONS:
;	None.
; PROCEDURE:
;	The procedure gets the current color tables from the common block 
;	COLORS, and then uses LOAD_VEL to get the velocity color table.
; 
;	To use this color table, scale velocities using FORM_VEL with the
;	/COMBINED keyword, and scale intensities using FORM_INT.
; 
; EXAMPLE:
;	The following example shows how to put a 256 by 256 intensity image I
;	next to its corresponding velocity image V.  Standard color table #3 is
;	used for the intensity image.
; 
;	LOADCT,3			   ;Select color table for int. image
;	COMBINE_VEL			   ;Combine with velocity color table
;	TV,FORM_INT(I),0,128		   ;Display intensity image on left
;	TV,FORM_VEL(V,/COMBINED),256,128   ;And velocity on right
; 
; MODIFICATION HISTORY:
;	W.T.T., Oct. 1987.
;	W.T.T., Nov. 1990.  Modified for version 2 of IDL.
;	W.T.T., Jan. 1991.  Changed REVERSE_SWITCH to keyword.  Added keywords
;			    GREEN_SWITCH and LIGHTEN.
;-
;
	COMMON COLORS,RED,GREEN,BLUE,CUR_RED,CUR_GREEN,CUR_BLUE
	ON_ERROR,2
;
;  Get the current color table.
;
	S = SIZE(RED)
	IF S(S(0) + 1) EQ 0 THEN LOADCT,0
	R1 = RED  &  G1 = GREEN  &  B1 = BLUE
;
;  Load the velocity color table, and combine with the color table saved above.
;
	LOAD_VEL,REVERSE_SWITCH=REVERSE_SWITCH,GREEN_SWITCH=GREEN_SWITCH,  $
		LIGHTEN=LIGHTEN,TURQUOISE=TURQUOISE
	R2 = RED  &  B2 = BLUE  &  G2 = GREEN
	X = BYTE(INDGEN(!D.N_COLORS/2)*2)
	RED = [R2(X),R1(X)]  &  GREEN = [G2(X),G1(X)]  &  BLUE = [B2(X),B1(X)]
	TVLCT,RED,GREEN,BLUE
;
	RETURN
	END