Ramin Sina wrote:
>
> % Unsupported X Windows visual (class: StaticGray, depth: 0).
> Substituting default (class: <UndefinedVisual>, Depth: 0).
> % Execution halted at: $MAIN$
>
You are probably working with 32 bits colordepth which is not supported
by IDL. There have been a couple of postings recently about this, check
www.deja.com for more information. If you set your X server to 8 bpp
(e.g. startx -- -bpp 8) IDL should work fine. Better of course is 24
bpp, but there are other programs that cause trouble in this mode, and
for my graphics card (Permedia II) it didn't work.
Liam Gumley has written a tool to set the correct display parameters. I
hope he doesn't mind if I attach it here. Make sure you start with no
startup file, then call colorset at the beginning of your session. Then
call colors which defines a few drawing colors. Then try
plot,findgen(10),color=1
and you should get a magenta line.
(didn't work for me unfortunately)
Martin.
--
|||||||||||||||\\\\\\\\\\\\\-------------------///////////// //|||||||||||||||
Martin Schultz, DEAS, Harvard University, 29 Oxford St., Pierce 109,
Cambridge, MA 02138 phone (617) 496 8318 fax (617) 495 4551
e-mail mgs@io.harvard.edu web http://www-as/people/staff/mgs/
PRO COLORSET, RETAIN=RETAIN, DECOMPOSED=DECOMPOSED, QUIET=QUIET
;+
; NAME:
; COLORSET
;
; PURPOSE:
; Select true color (24 bit) if available, or pseudo color (8 bit) visual
; consistently on X, Windows, and Macintosh.
;
; CATEGORY:
; Startup utilities.
;
; CALLING SEQUENCE:
; COLORSET
;
; INPUTS:
; None
;
; OPTIONAL INPUTS:
; None
;
; KEYWORD PARAMETERS:
; RETAIN Specifies the default method used
; for backing store when creating new windows.
; 0 => No backing store
; 1 => Server or window system performs backing store
; 2 => Make IDL perform backing store (DEFAULT)
; DECOMPOSED Specifies the the way in which graphics
; color index values are interpreted when using displays with
; decomposed color (TrueColor or DirectColor visuals).
; 0 = > Color indices given by single 8 bit values (DEFAULT)
; 1 = > Color indices given by three 8 bit values
; QUIET If set, no color information is printed
; (default is to print the color table size, and number of colors)
;
; OUTPUTS:
; None
;
; OPTIONAL OUTPUTS:
; None
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
; This routine changes the IDL visual for the rest of the IDL session.
;
; RESTRICTIONS:
; Only affects X, WIN, and MAC displays.
; Only has an effect if run before any windows have been
; created, and if no DEVICE commands have been executed.
;
; EXAMPLE:
; ;Execute the following command immediately after IDL startup.
; colorset
;
; MODIFICATION HISTORY:
; Written by: Liam.Gumley@ssec.wisc.edu
;-
rcs_id = "$Id: colorset.pro,v 1.2 1999/04/20 15:04:29 gumley Exp $"
;- Check keyword values
if n_elements( retain ) ne 1 then retain = 2
if n_elements( decomposed ) ne 1 then decomposed = 0
;- Check keyword flags
if not keyword_set( quiet ) then quiet = 0
;- Check if a window has been created previously
if !d.window ge 0 then begin
message, 'Window already created in this session - COLORSET may have no effect.', /continue
message, 'To ensure COLORSET works, call it before any windows are created.', /continue
endif
;- Test for supported displays
supported = 0
case 1 of
;- Windows case (visual cannot be changed)
!d.name eq 'WIN' : begin
device, decomposed=decomposed, retain=retain
supported = 1
end
;- X and Macintosh case (will revert to 8 bit visual if 24 bit fails)
!d.name eq 'X' or !d.name eq 'MAC' : begin
device, true_color=24, decomposed=decomposed, retain=retain
supported = 1
end
;- Unsupported display
else : message, 'Not supported on the ' + !d.name + ' device', /continue
endcase
;- If display supported, lock in window characteristics, and report what happened
if supported then begin
;- Create a window to lock in the visual type for this IDL session
old_window = !d.window
window, /free, /pixmap
wdelete, !d.window
if old_window ge 0 then wset, old_window
;- Report what happened
if not quiet then begin
print, 'Display device : ', !d.name
print, 'Color table size: ', strcompress( !d.table_size, /remove_all )
print, 'Number of colors: ', strcompress( !d.n_colors, /remove_all )
print, ''
endif
endif
END
PRO COLORS, START=START, NAMES=NAMES, VALUES=VALUES
;+
; NAME:
; COLORS
;
; PURPOSE:
; Load sixteen graphics colors into the color table.
;
; CATEGORY:
; Startup utilities.
;
; CALLING SEQUENCE:
; COLORS
;
; INPUTS:
; None
;
; OPTIONAL INPUTS:
; None
;
; KEYWORD PARAMETERS:
; START Start index in the color table where the graphics
; colors will be loaded (default = 0).
; NAMES If set to a named variable, returns an array of color names.
; VALUES If set to a named variable, returns an array of color index values.
;
; OUTPUTS:
; None
;
; OPTIONAL OUTPUTS:
; None
;
; COMMON BLOCKS:
; None
;
; SIDE EFFECTS:
; This routine modifies the color table.
;
; RESTRICTIONS:
; None
;
; EXAMPLE:
; ; Display a greyscale image with color text overlaid.
; device, decomposed=0
; window, /free, xs = 500, ys = 500
; colors, names=names
; bottom = 16B
; ncolors = !d.table_size - bottom
; loadct, 0, bottom=bottom, ncolors=ncolors
; tv, bytscl( dist(256), top=ncolors-1 ) + bottom
; for i=1,8 do xyouts, 30*i, 30*i, names[i], /device, charsize=1.5, color=i
;
; MODIFICATION HISTORY:
; Written by: Liam.Gumley@ssec.wisc.edu
;
; NOTES:
; The color table assignments are as follows
; Entry Color
; ----- -----
; 0 => Black
; 1 => Magenta
; 2 => Cyan
; 3 => Yellow
; 4 => Green
; 5 => Red
; 6 => Blue
; 7 => White
; 8 => Navy
; 9 => Gold
; 10 => Pink
; 11 => Aquamarine
; 12 => Orchid
; 13 => Gray
; 14 => Sky
; 15 => Beige
;-
rcs_id = "$Id: colors.pro,v 1.2 1999/04/20 15:14:45 gumley Exp $"
;- Check keyword values
if n_elements( start ) ne 1 then start = 0
;- Load graphics colors (derived from McIDAS)
r = [0,255,0,255,0,255,0,255,0,255,255,112,219,127,0,255]
g = [0,0,255,255,255,0,0,255,0,187,127,219,112,127,163,171]
b = [0,255,255,0,0,0,255,255,115,0,127,147,219,127,255,127]
tvlct, r, g, b, start
;- Set return keywords
names = [ $
'Black', 'Magenta', 'Cyan', 'Yellow', 'Green', 'Red', 'Blue', 'White', $
'Navy', 'Gold', 'Pink', 'Aquamarine', 'Orchid', 'Gray', 'Sky', 'Beige' ]
values = byte( indgen( 16 ) + start )
END
-
Attachment: colorset.pro
(Size: 3.27KB, Downloaded 95 times)
-
Attachment: colors.pro
(Size: 2.14KB, Downloaded 91 times)
|