comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: problem with Fanning's getcolor
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: problem with Fanning's getcolor [message #59944] Tue, 22 April 2008 06:47
Conor is currently offline  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!
Re: problem with Fanning's getcolor [message #59953 is a reply to message #59944] Mon, 21 April 2008 12:16 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Saving Workbench Layout?
Next Topic: Dialog_pickfile problem

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

Current Time: Fri Oct 10 16:50:44 PDT 2025

Total time taken to generate the page: 1.36157 seconds