Getting the current color table [message #36968] |
Tue, 11 November 2003 06:37  |
Nuno Oliveira
Messages: 75 Registered: October 2003
|
Member |
|
|
Hi, perhaps you can help me here.
Is there a way that I (in the case, the program) can know which is the
current color table?
The program provides the function XLOADCT in which the user can change the
color table. And I would like to know which one is in use. I have a feeling
that that has to be somewhere, :). I tried to see if there is any parameter
in XLOADCT and LOACT that provides me the number of the color table in the
use. I believe that information is somewhere, but where? I looked also in
the graphics system variables but I don't find it. Seems to have everything
but the index of the color table in use.
Cheers, N.
|
|
|
Re: Getting the current color table [message #46679 is a reply to message #36968] |
Tue, 06 December 2005 13:55  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 06 Dec 2005 10:44:05 -0800, inaki.ugarte wrote:
> Hi,
> is there any recent development in this previously asked question? How do
> I get the color table number used by the last call to LOADCT? I would
> prefer to do it in a general way, without having to call external
> routines.
> Cheers,
> Inaki
I think at some point many years ago this bugged me enough that I wrote a
tool called cload which stores the color table, and the color
min/max/gamma as well, in a custom system variable. I don't use it
anymore, but it might be of interest. If someone else uses LOADCT in the
meantime, you'd be out of luck.
;; load with loadct, but set the !ctabl system variable too.
pro cload, table_number, NO_SET=ns,_REF_EXTRA=e
if n_elements(table_number) ne 0 then begin
loadct,table_number,/SILENT,_EXTRA=e
!ctabl.cmap=table_number
if NOT keyword_set(ns) then begin
!ctabl.high=1.
!ctabl.low=0.
!ctabl.gamma=1.
endif
endif else loadct,_EXTRA=e
end
you have to setup that sysvar first:
pro cdef,_EXTRA=e
defsysv,'!ctabl',Exists=exi
if exi eq 1 then return
;; we need to define it...
;; make and delete window to get the *actual* number of colors used
window,1,xsize=1,ysize=1,/PIXMAP,_EXTRA=e
wdelete
defsysv,'!ctabl',{!ctabl,cmap:0,low:0.,high:1.,gamma:1.0}
return
end
|
|
|
Re: Getting the current color table [message #46680 is a reply to message #36968] |
Tue, 06 December 2005 12:35  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
inaki.ugarte@gmail.com wrote:
> Well, it wasn't me and the date of the email was 2003, but thanks for
> replying. I thought things might have changed since.
> I'll keep track of it.
Don't hold your breath. The point is that since the last call to LOADCT,
the colour table may have been further changed by calls to TVLCT. So the
*number* of the last-loaded colour table is not necessarily meaningful,
while the RGB *values* that make up the current colour table (as
returned by TVLCT, /GET) is.
--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
|
Re: Getting the current color table [message #46684 is a reply to message #36968] |
Tue, 06 December 2005 10:54  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
inaki.ugarte@gmail.com writes:
> How do I get the color table number used by the last call to LOADCT?
> Is there any recent development in this previously asked question?
No, it has only been a month since you asked. Too soon for a new
IDL release. :-)
The answer is still "no". If you want to know, you
have to keep track of it. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|