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

Re: unexpected colors

Ben Tupper (tupper@seadas.bigelow.org) writes:

> I'ld like to say that my code has only had 1 error in the last three
> versions, but I don't want any of you to get a hernia from giggling.
> Wow!


> I have a widget application with two separate draw widgets.  The first
> has GRAPHICS_LEVEL =2 (object graphics), the second has
> GRAPHICS_LEVEL not set to anything (direct graphics.)   I am using
> Liam's  IMDISP , but I have also used David's TVIMAGE and plain old
> vanilla TV.   Here's the trouble, I'm getting a beautiful image
> displayed in lovely colors... but it is supposed to be greyscale.   Even
> if I call LoadCT,0 just prior to displaying the image, I get a colored
> image instead.
> I have narrowed down the occurance, but no the reason or the solution.

Here is your trouble, right here:

> IDL> help,/device
> Available Graphics Devices: CGM HP LJ NULL PCL PRINTER PS REGIS TEK X Z
> Current graphics device: X
>     Server: X11.0, Sun Microsystems, Inc., Release 3610
>     Display Depth, Size: 8 bits, (1152,900)
>     Visual Class: PseudoColor (3)

> Any suggestions?   

Get a 24-bit display device. No, seriously. :-)

It is impossible to avoid this kind of color problem
when you combine direct and object graphics on an 8-bit
display. The reason is that there is only one color table
and direct and object graphics use it in two completely
different (and incompatible) ways. As soon as you get
things set up for your direct graphics window, the object
graphics window loads its own color table, and the colors
go bonkers. And since the object graphics window knows how
to protect its own colors (better believe it!), it always
changes the color table when it redraws itself, and visa

I'm afraid it's back to the design table for you, Ben, my boy.
Either that, or get the folks to cough up some cash for
a new graphics card. Sell them on the numerous advantages.
And point out that it's almost the end of the 20th century. :-)



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