[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HELP - Changing color map in Mac IDl



Liam E.Gumley (Liam.Gumley@ssec.wisc.edu) writes:

> However consider the following wrappers for TVSCL and XLOADCT in IDL
> 5.3:
> 
> PRO TVSCL24, IMAGE, DATA=DATA
> if (n_elements(image) gt 0) then begin
> tvscl, image
> return
> endif
> if (n_elements(data) gt 0) then begin
> tvscl, data
> return
> endif
> message, ’No image argument was specified’
> END
> 
> PRO XLOADCT24, IMAGE
> xloadct, updatecallback=’tvscl24’, updatecbdata=image
> END
> 
> These wrappers will update the image whenever the color table is
> changed, e.g.
> 
> image = dist(256)
> tvscl24, image
> xloadct24, image

As long as Liam brings it up, here is another plug for
my XCOLORS program, a program I like better than XLOADCT
for a number of reasons. Don't try this at home with XLOADCT
because it won't work. Ten bonus points to the person who
has been reading this newsgroup for less than a year who
can tell me why. :-)

Be sure you do this on a 16-bit or 24-bit display. Create 
a small image display program. Something like this:

   PRO DisplayIt, Image=image, Wid=wid
   IF N_Elements(wid) NE 0 THEN WSet, wid
   IF N_Elements(image) NE 0 THEN TVImage, image
   END

Next, type these commands:

   image = Dist(256)

   Window, 0
   LoadCT, 5
   TVImage, image
   XColors, Title='Window 0 Colors', Wid=0, Image=image, $
	NotifyPro='DisplayIt', XOffset=50
   Window, 1
   LoadCT, 3
   TVImage, image
   XColors, Title='Window 1 Colors', Wid=1, Image=image, $
      NotifyPro='DisplayIt', XOffset=250

Now you have two windows on the display and you can change
the colors independently in each one and the colors are
updated automatically. There is no limit to how many windows
and how many color table tools you can have open at once.
(Well, no *practical* limit.)

In addition to XColors, you will need my TVImage program
because, well..., because I always use TVImage instead of
TV. Doesn't make sense not to. :-)

   http://www.dfanning.com/programs/xcolors.pro
   http://www.dfanning.com/programs/tvimage.pro

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