[comp.sys.sun] Frame buffer depth

crawford@eagle.crd.ge.com (Carl Crawford) (05/24/91)

I am using a number of Sparcstations under Sunview. Some of the Sparcs are
1 bit monochrome and some are 8 bit gray scale. From within a program how
can you tell which frame buffer your system has?

Carl R. Crawford	   Voice: 414-521-6572
GE Medical Systems	   Fax: 414-521-6575
P.O. Box 414, W-875	   Uucp: {sun!sunbird,uunet!crdgw1}!gemed!carl
Milwaukee, WI 53201	   Internet: carl@gemed.ge.com

larry@uunet.uu.net (Larry Martell) (06/05/91)

In article <2883@brchh104.bnr.ca> crawford@eagle.crd.ge.com (Carl Crawford) writes:
>I am using a number of Sparcstations under Sunview. Some of the Sparcs are
>1 bit monochrome and some are 8 bit gray scale. From within a program how
>can you tell which frame buffer your system has?
>

The depth of the frame buffer is kept in the pw_pixrect->pr_depth member
of the Pixwin struct. For a window you get a pointer to the Pixwin struct
using window_get:

Canvas  canvas;
Pixwin  *pw;
	pw = (Pixwin *)window_get(canvas,WIN_PIXWIN);

For a canvas use canvas_pixwin:

	pw = (Pixwin *)canvas_pixwin(canvas);

In ether case the frame buffer depth can be found in:

	pw->pw_pixrect->pr_depth 

See page 108 of ther SunView Programmers Guide: "Is My Application Running
on a Color Display?"
-- 
Larry Martell                  "Opinions are like assholes; everybody has one, 
212-668-9478		        but nobody wants to look at the other guys"
uunet!st-andy!larry