comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Getting the current color table
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Getting the current color table [message #46685] Tue, 06 December 2005 10:44 Go to next message
inaki.ugarte is currently offline  inaki.ugarte
Messages: 3
Registered: December 2005
Junior Member
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

Newsgroups: comp.lang.idl-pvwave
From: XXX
Date: Tue, 11 Nov 2003 14:37:52 -0000

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
Re: Getting the current color table [message #46734 is a reply to message #46685] Mon, 12 December 2005 06:49 Go to previous message
rm is currently offline  rm
Messages: 4
Registered: June 2005
Junior Member
Well there are two things you could do:-

1) The quick way is to modify LOADCT. Add an extra COMMON block into
the code to store the table number then write a two line function to
return this value.

function whichct()

common lastct, ct
return, (n_elements(ct) eq 0) ? -1: ct

end



I'll leave it to others to dissuade you from this coarse. Though the
Lord knows there are many RSI routines which could do with being
written properly (MEAD, STDDEV, REFORM...)

2) The slow way is to reload the colour tables till you find a match

function whichct

oldquiet=!quiet
!quiet=1

common colors, r0, g0, b0, r1, g1, b1

if (n_elements(r0) eq 0) then return, -1

r=r1
g=g1
b=b1
for i=0, 40 do begin
loadct, i
if (array_equal(r,r1) and array_equal(g,g1) and
array_equal(b,b1)) then goto, finish
endfor

i=-1

finish:

!quiet=oldquiet
return, i

end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Polygon Clipping Algo in IDL
Next Topic: Leaving XMANAGER

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:26:24 PDT 2025

Total time taken to generate the page: 0.03342 seconds