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

Home » Public Forums » archive » New Drawing Color Object
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
New Drawing Color Object [message #17701] Tue, 09 November 1999 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Hi Folks,

As promised, I have put a new drawing color tool on my web page.

http://www.dfanning.com/programs/drawcolors__define.pro

The purpose of the tool is to have a flexible way of handling
drawing colors. I have been experimenting with these ideas
for some time, first with my program GetColor, and more
recently with a program entitled PickColor. This new
DrawColor object incorporates the functionality of these
two programs and adds more besides.

I wish I could tell you it is amazingly robust and
useful everywhere, but that is where you come in.
I'm looking for testers and suggesters. Have at it.
You know where to find me. :-)

Here is a short tutorial in how it can be used. Note
that this doesn't exhaust all the possibilities.

1. Create the object.

IDL> colors = Obj_New("DrawColors")

2. Find out what colors it knows about.

IDL> colors->GetProperty, Names=colorNames
IDL> Print, colorNames

3. Ask for a color by name and load it at a color
index. Draw a plot in that color.

IDL> yellow = colors->GetColor("yellow")
IDL> TVLCT, yellow, 200
IDL> Device, Decomposed=0
IDL> Plot, Findgen(11), Color=200

4. Do the same thing, but in DECOMPOSED color.

IDL> Device, Decomposed=1
IDL> green = colors->GetColor("green", /TrueColor)
IDL> Plot, Findgen(11), Color=green

5. Find the color index number of the sky blue color.

IDL> Device, Decomposed=0
IDL> skyIndex = colors->GetColor("sky", /IndexNumber)
IDL> Plot, Findgen(11), Color=skyIndex

6. Load all 16 drawing colors at color index 32.

IDL> colors->LoadColors, 32
IDL> CIndex ; See them, if you have CINDEX from my library.

7. Get a structure of colors, with each field set to
the appropriate index number of its associated color.

IDL> Device, Decomposed=0
IDL> col = colors->GetColors(/IndexNumber, /Structure)
IDL> Plot, Findgen(11), Color=col.yellow, Background=col.charcoal

8. Allow the user to select a color from a GUI, then
load it and use it.

IDL> Device, Decomposed=0
IDL> theColor = colors->Select(Cancel=cancelled)
IDL> IF NOT cancelled THEN TVLCT, theColor, 10
IDL> Plot, Findgen(11), Color=10

9. Allow the user to choose 16 new drawing colors.
(Requires my XCOLORS program.)

IDL> colors->XColors
IDL> colors->Select()

10. Call the GUI from within a widget program and load the
new color.

newcolor = info.colors->Select(Group_Leader=event.top, $
Cancel=cancelled)
IF NOT cancelled THEN TVLCT, newcolor, info.drawColor

11. Destroy the object.

IDL> Obj_Destroy, colors

I look forward to hearing from you. :-)

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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: openr,/xdr & readu,structure problems
Next Topic: Re: changing IDLgrAxis and IDLgrSurface ranges

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

Current Time: Wed Oct 08 17:43:29 PDT 2025

Total time taken to generate the page: 0.00581 seconds