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 
Return to the default flat view Create a new topic Submit Reply
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
[Message index]
 
Read Message
Read Message
Previous Topic: Polygon Clipping Algo in IDL
Next Topic: Leaving XMANAGER

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

Current Time: Fri Oct 10 07:29:20 PDT 2025

Total time taken to generate the page: 0.55993 seconds