Re: Getting the color pallete without calling LoadCT first [message #19379] |
Mon, 20 March 2000 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Ricardo Fonseca (zamb@physics.ucla.edu) writes:
> 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
You can use the Palette object:
theColors = Obj_New('IDLgrPalette')
theColors->LoadCT, ct
theColors, GetProperty, Red=r, Green=b, Blue=b
Obj_Destroy, theColors
Or, you can load and obtain the colors in the Z-buffer,
which is a 256 color device. (This is what I used to do
before objects.)
thisDevice = !D.Name
Set_Plot, 'Z'
LoadCT, ct, /Silent
TVLCT, r, g, b, /Get
Set_Plot, thisDevice
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Getting the color pallete without calling LoadCT first [message #19380 is a reply to message #19379] |
Mon, 20 March 2000 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
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
not really. But why don't you do:
TVLCT, rold, gold, bold, /GET
loadct, ct, NCOLORS=256
TVLCT, rr, gg, bb, /GET
TVLCT, rold, gold, bold
which restores the original one with only two lines extra.
Also: if working on a 8 bit colordepth device you must be careful with
NCOLORS=256,
so perhaps you should select a different device before you do this
(off-hand I know of PS to always support 256 colors -- after
device,bits_per_pixel=8) but you could try others (e.g. the NULL device
??)
Cheers,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ 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 [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
|
|
|