pro contrast, dummy
;
; MDM - 15-Aug-89
; SLF - august 2, 1989

;----- use a new window
;
nlinbar = 45
window, /FREE, xsiz=256, ysiz=256+nlinbar, title='Color Stretcher'
windex = !d.window
plot, [0,0], [0,0], xrange=[0,256], yrange=[0,256+nlinbar], xstyle=5, ystyle=5
;
bar=byte(indgen(256, 30))
tv, bar, 0, 0
oplot, [0, 256], [0, 256]+nlinbar, /device
oplot, [0, 256], [0, 0]+nlinbar, /device
;
print, 'Press Left Button to "stretch" the color table'
print, 'Press Center Button to exit'
print, 'Press Right Button to rotate through the color tables'
;
set_xy, 0, 1, 0, 1	;needed?
;
y = 0
x = 255
icolor = 0
repeat begin
   cursor, x, y, 2, /device
   ;
   case !err of
	1: begin	;left button
		repeat begin
		    cursor, x, y0, 2, /device
		    y = y0 - nlinbar
		    if ((x ne -1) and (y ne -1)) then begin
			stretch, y, x

			tv, bytarr(30,15), 0, 30
			xyouts, /device, 0, 32, string(y,'(i3)')
			tv, bytarr(30,15), 256-30, 30
			xyouts, /device, 256-30, 32, string(x,'(i3)')
		    end

		    wait, .1
		end until ((!err and '04'x) eq 0)
	   end
	;
	4: begin	;right button
		icolor = icolor+1
		if (icolor gt 15) then icolor = 0
		loadct, icolor
	   end
	else:
   end
   ;
end until (!err eq 2)
;
; give the window back
wdelete
;
end
