Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/~valenti/idl/c24.pro
Дата изменения: Wed Dec 19 13:51:46 2012
Дата индексирования: Sat Mar 1 23:59:19 2014
Кодировка:

Поисковые слова: http astrokuban.info astrokuban
function c24, index
;Set colors for plotting. Note that the number of colors in the color map
; may change when the first window is created. This can lead to a default
; plotting color other than white. Either create the window before calling
; colors, or call colors again once the window has been created.
;27-Mar-1994 JAV Created.
;16-Mar-2009 JAV Added logic to handle case when device, decomposed=0.

;Specify progression of colors.
r = [ 0.0, 1.0, 1.0, 0.2, 0.0, 1.0, 1.0, 1.0, 0.2 $
, 1.0, 0.4, 0.6, 0.6, 1.0, 0.2, 0.6 ]
g = [ 0.0, 1.0, 0.0, 1.0, 0.4, 1.0, 0.4, 0.6, 1.0 $
, 0.8, 0.6, 0.0, 0.4, 0.4, 0.8, 0.6 ]
b = [ 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 $
, 0.6, 0.0, 0.6, 0.0, 0.0, 0.4, 0.4 ]
ncolors = n_elements(r)

;Scale to fill full 8 bit range.
r = long(255 * r)
g = long(255 * g)
b = long(255 * b)

;Set last entry in color map to white.
imod = index mod ncolors

;Get decomposed state.
decomposed = 0
if max(!d.name eq ['WIN', 'X', 'Z']) eq 1 then begin
if !d.n_colors gt 256 then device, get_decomposed=decomposed
endif

;Calculate return value.
if decomposed then begin
return, b(imod)*256L^2 + g(imod)*256L + r(imod)
endif else begin
colors
return, index
endelse

end