Re: problem with Fanning's getcolor [message #59953 is a reply to message #59944] |
Mon, 21 April 2008 12:16  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Conor writes:
> well... maybe not. I've included getcolor in a larger program that
> some of my collaborators are using. At the moment it seems to be
> breaking the program. I'm calling:
>
> test = getcolor('red')
>
> and it is returning a [255,0,0] The problem is that I was expecting a
> long integer, not an array. What conditions are causing it to return
> an array with three elements? I thought it always returned an
> integer.
Well, first of all, I wouldn't be using GETCOLOR. I would
be using FSC_COLOR. GETCOLOR is at least 10 years old and
was abandoned years ago.
That said, unless you tell GetColor where to load the color
by specifying the index (which no one did, which is why I
wrote FSC_COLOR), then it returns a color triple, which
presumably you can load where you want to load it.
The program works like this:
IDL> Device, Decomposed=0
IDL> print, getcolor('yellow, 20)
20
IDL> print, getcolor('yellow')
255
255
0
IDL> Device, Decomposed=1
IDL> print, getcolor('yellow')
65535
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|