Getting the color pallete without calling LoadCT first [message #19383] |
Sun, 19 March 2000 00:00  |
Ricardo Fonseca
Messages: 13 Registered: February 2000
|
Junior Member |
|
|
Hi
I need to get the color table from one of the default IDL colortables. Right
now I'm doing it like this:
loadct, ct, NCOLORS = 256
TVLCT, rr, gg, bb, /get
I was wondering I there was a way to do this without actually loading the
color pallete i.e. without calling loadct
Thanks in advance, Ricardo
|
|
|
Re: Getting the color pallete without calling LoadCT first [message #19524 is a reply to message #19383] |
Mon, 20 March 2000 00:00  |
John-David T. Smith
Messages: 384 Registered: January 2000
|
Senior Member |
|
|
Ricardo Fonseca wrote:
>
> Hi
>
> I need to get the color table from one of the default IDL colortables. Right
> now I'm doing it like this:
>
> loadct, ct, NCOLORS = 256
> TVLCT, rr, gg, bb, /get
>
> I was wondering I there was a way to do this without actually loading the
> color pallete i.e. without calling loadct
>
> Thanks in advance, Ricardo
The code for reading in the color tables is in loadct and it basically consists
of (modified slightly):
filename = filepath('colors1.tbl', subdir=['resource', 'colors'])
openr,lun, filename, /get_lun
aa=assoc(lun, bytarr(256),1) ;Read 256 long ints
r = aa[table_number*3]
g = aa[table_number*3+1]
b = aa[table_number*3+2]
You can obviously parse them all in at once this way if that's what you're
after.
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|