Path: utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: josh@cadnetix.com
Newsgroups: comp.sys.sun
Subject: Re: How to discover screen depth
Message-ID: <8811181805.AA12286@thorn.cadnetix.COM>
Date: 1 Dec 88 17:22:30 GMT
Sender: usenet@rice.edu
Organization: Rice University, Houston, Texas
Lines: 26
Approved: Sun-Spots@rice.edu
Original-Date: Fri, 18 Nov 88 11:05:43 MST
X-Sun-Spots-Digest: Volume 7, Issue 32, message 6 of 17

Here is a code fragment that determines the depth of a screen:

#include        

	...
	Pixrect *screen;
	...
	/* open frame buffer */
	if ((screen = pr_open("/dev/fb")) == 0)
		error("Can't open screen!\n");

	if (screen->pr_depth == 1) {
		/* Black and white screen */
	}
	else if (screen->pr_depth == 8) {
		/* 8 Bit (gray scale or color) */
	}
	else {
		error("Weird monitor depth: %d\n", screen->pr_depth);
	}
	...

    Joshua Goldstein	UUCP: cadnetix!josh
    Cadnetix Corp.	      {uunet,boulder,sunpeaks}!cadnetix!josh
    5775 Flatiron Pkwy
    Boulder, CO 80301