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

Re: device,decomposed=0

R.Bauer (R.Bauer@fz-juelich.de) writes:

> David Fanning wrote:
> > R.Bauer (R.Bauer@fz-juelich.de) writes:
> >
> > > Solution is:
> > >
> > > FUNCTION def_n_colors
> > >       IF !d.n_colors GT 256 THEN RETURN,256 ELSE RETURN,!d.n_colors
> > > END
> >
> > Well, not exactly. But probably close enough for government work. :-)
> True, but how else could I handle 8Bit color displays accessing only 236
> colors and true color displays with decomposed,0 having 256 colors?

No, you are absolutely right. I'm sure this works for you.
I'm just saying that you cannot depend upon !D.N_Colors
reflecting the *correct* number of colors for all versions of
IDL all the time. And depending upon what you are doing,
you don't really want to know the number of colors anyway.
What you more often want to know is how many color table
elements are available. The system variable !D.Table_Size
is a more accurate value for this purpose.

But, of course, what you *really* want to know is the
type of color visual, the depth of the display, and
whether color decomposition is turned on or off at this
particular moment. All of this information is now available
in IDL 5.2 via keywords to the DEVICE command. If everyone
would just upgrade to IDL 5.2, we would have the color
situation licked. :-)


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