Re: problem with Fanning's getcolor [message #59944] |
Tue, 22 April 2008 06:47  |
Conor
Messages: 138 Registered: February 2007
|
Senior Member |
|
|
On Apr 21, 3:16 pm, David Fanning <n...@dfanning.com> wrote:
> 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.")
Thanks David!
|
|
|