[comp.sys.mac] How Many Colors?

singer@endor.UUCP (10/04/87)

How does one tell how many bits per pixel are set in the Control Panel?
I know that it's possible, because I see demos that refuse to run
unless 8 bits per pixel (256 colors) are set up -- they display a
message saying "8 bits per pixel required" if it isn't set up.

I assume I'm missing something from IM 5; can anyone set me straight?

		--Rich



**The opinions stated herein are my own opinions and do not necessarily
represent the policies or opinions of my employer (THINK Technologies, Inc).

* Richard M. Siegel | {decvax, ucbvax, sun}!harvard!endor!singer    *
* Customer Support  | singer@endor.harvard.edu			    *
* THINK Technologies, Inc.  (No snappy quote)                       *

fry@huma1.UUCP (10/04/87)

In article <2927@husc6.UUCP> singer@endor.UUCP (Richard Siegel) writes:
>How does one tell how many bits per pixel are set in the Control Panel?
>I know that it's possible, because I see demos that refuse to run
>unless 8 bits per pixel (256 colors) are set up -- they display a
>message saying "8 bits per pixel required" if it isn't set up.

Let screenRect be a rectangle that defines the area you want
to know the pixel depth of.  If you only have one monitor
attached then screenRect can be screenBits.bounds, but you may
want to be more specific for multiple monitors.  If you just
want to know the greatest depth of any monitor attached (which
is the normal thing to do) let screenRect be the rectangle
enclosing the GrayRgn, the desktop even for multiple screen
setups.

Once you've got screenRect figured out, call 
maxdev = GetMaxDevice(&screenRect);
    /* returns gDevice handle of deepest device */

and then

theDepth = (**((**maxdev).gdPMap)).pixelSize;

will give you the bits per pixel of that screen.

jww@sdcsvax.UCSD.EDU (Joel West) (10/04/87)

Well, in any PixMap (including global screen) there is a pixelSize
value, which is 1,2,4 or 8.

If you want to get an exact answer, you have to check each display,
which are represented by gDevice's, each of which has a PixMap.
-- 
	Joel West  (c/o UCSD)
	Palomar Software, Inc., P.O. Box 2635, Vista, CA  92083
	{ucbvax,ihnp4}!sdcsvax!jww 	jww@sdcsvax.ucsd.edu
   or	ihnp4!crash!palomar!joel	joel@palomar.cts.com

stew@endor.harvard.edu (Stew Rubenstein) (10/04/87)

In article <2927@husc6.UUCP> singer@endor.UUCP (Richard Siegel) writes:
>How does one tell how many bits per pixel are set in the Control Panel?
>I know that it's possible, because I see demos that refuse to run
>unless 8 bits per pixel (256 colors) are set up -- they display a
>message saying "8 bits per pixel required" if it isn't set up.
>
>I assume I'm missing something from IM 5; can anyone set me straight?
>
>		--Rich

Look at the routine GetMaxDevice, on page 37 of the March APDA draft IM V.
You can also look at the pixelSize field in the PixMap for a CGrafPort or
GDevice.

Stew Rubenstein
Cambridge Scientific Computing, Inc.
UUCPnet:    seismo!harvard!rubenstein            CompuServe: 76525,421
Internet:   rubenstein@harvard.harvard.edu       MCIMail:    CSC