Re: variable number of colors available on screen [message #8322] |
Mon, 24 February 1997 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Geir Willy Rogde wrote:
>
> When starting idl I get different number of available colors each time.
> Is it possible forcing idl to use 256 colors?
> (I'm on a Unix-workstation.)
You can use an entry like the following in a user's ~/.Xdefaults
file or the system Xdefaults file (/usr/openwin/lib/Xdefaults for
Solaris 2.X):
idl.colors 256
The manual suggests that you can also use the following:
WINDOW, COLORS=256, /PIXMAP ; Before any other windows
WDELETE ; are created!
which explicitly tells IDL to allocate 256 colors. If enough
colors aren't available, it will use a private colormap. This may
be your only alternative if you _need_ 256 colors; however, you
will have the problem of "color flashing" as input focus changes
from IDL to other programs on the screen.
If you can live with fewer colors, you can use a lower number to
avoid using the private colormap. You can also specify a negative
number to tell IDL to allocate all but the specified number of colors,
leaving some for other applications:
WINDOW, COLORS=-8, /PIXMAP ; Leaves 8 colors unallocated
WDELETE
You can put these commands in your "idl_startup" file.
The documentation is not clear as to whether this same behavior
is achieved using "idl.colors" in the Xdefaults file. It simply
states that you can use it to set the number of colors used by IDL.
You might want to give it a try. Anyone know if this works?
Having only 100 to 150 colors seems pretty low. Do you have any
applications that are grabbing up colors? (One common culprit is
Netscape...you can start it with "netscape -install" to avoid this.
Programs written in IDL should not count on there being a constant
number of colors available. You can use !D.N_COLORS or !D.TABLE_SIZE
(don't remember the distinction, someone please remind us) to allow
your programs to account for the number of colors available.
Hope this is useful.
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
[ UCSD Mail Code 0949 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|