[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining the number of the current color table

In article <383905FE.199BD844@mpia-hd.mpg.de>,
	Markus Feldt <mfeldt@mpia-hd.mpg.de> writes:
> --------------044D86DA089246E71003A164
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>  Hi All,
>   currently I am writing a package of software that for some reason has
> to keep track of the currently active colortable.  To give the user a
> chance to adjust this table,  I am calling (since it all has to be
> GUIfied these days...) xloadct - but xloadct itself does not give back
> the number of the loaded table.
>   Does anybody know how to comfortably obtain this number?  I know there
> is XCOLORS which might help via an event,  but I'd rather rely on
> standard functions...
This is not as easy as you may think: first of all, LOADCT (the non-GUI
equivalent of XLOADCT) accepts keywords like BOTTOM or NCOLORS which have
an obvious effect on *how* the color table is loaded *and* which allow
you to have more than one "active" colortable at a time. Furthermore,
you can manipulate individual entries in the colortable (see for example
David F's GETCOLOR program). Therefore, strictly speaking, there is no
such thing as "the currently active colortable". What is offered in IDL
though, is the retrieval of the three currently active color vectors:
This returns one vector for each red, green, and blue typically of length
100-220 on 8 bit displays, and 256(?) on 24 bit displays. If you want to make
sure to use exactly these same colors again later on, you can store these
values in the UVALUE field of your widget (as you mentioned everything is 
GUIfied), then call TVLCT,r,g,b to set them back. But be aware of side-effects
when you have more than one window on the screen!


[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[