[comp.windows.x] Determining color/black-white

jla@AI.MIT.EDU (Joseph Arceneaux) (06/24/89)

What is the best method of determining if a screen supports color or
not?  DisplayCells doesn't work, while checking number of planes seems
to be a reasonable test.

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (06/24/89)

	What is the best method of determining if a screen supports color 
	or not?

Walk down the visuals of the screen using XGetVisualInfo.  There is an example
of how this routine is called in the client xdpyinfo.  Or, you could use 
XMatchVisualInfo to do the searching.  See Rosenthal and Lemke's paper 
"Visualizing X11 Clients" available through anonymous ftp from expo.lcs.mit.edu
as /contrib/Visuals.shar.


	DisplayCells doesn't work,

It tells you how many cells are in the colormap of the default visual.  If
the default visual is single-plane StaticGray or GrayScale, then you'll miss
out if there are other visuals available.


	checking number of planes seems to be a reasonable test.

Depends on whether or not you consider multiple shades of gray to be 
"colors" (i.e. think of displays with StaticGray or GrayScale visuals).

converse@EXPO.LCS.MIT.EDU (Donna Converse) (06/24/89)

> What is the best method of determining if a screen supports color or
> not?  

Use XGetVisualInfo() to determine which visuals are available on 
the screen, then select a visual appropriate to your application.
Also, check the colormap size fields of the visual types.

Remember, a screen can have multiple visuals, and the default
visual of a screen with color capability is not necessarily
a visual with color capability.

See section 10.8 of Scheifler, Gettys & Newman.
See also "Visualizing X11 Clients", by David Lemke and David
Rosenthal, published in the Usenix Winter 89 conference proceedings.


Donna Converse
converse@expo.lcs.mit.edu

nsche@ATR-8.HAC.COM (Norm Scherer) (06/24/89)

>What is the best method of determining if a screen supports color
Why not just look at the default visual....if it is StaticGray and
the default depth is 1 I think you can conclude you have monochrome
and so on..... Planes is not a good test 'cause you may have multi
planes and still be GrayScale or StaticGray....