[comp.sys.mac.programmer] How does one determine the current number of bitplanes?

mentat@walt.cc.utexas.edu (Robert Dorsett) (08/13/89)

I have an application which uses Old QuickDraw, along with copybits and
ForeColor, to display color-coded information.  A different representational
approach is used for users on monochrome machines.  The problem facing me is
how to determine (a) the presence of a color monitor, and (b) the number of
bitplanes selected on that monitor.  Does anyone out there have any tips
or advice on how to accomplish this latter feat?





Robert Dorsett 
Internet: mentat@walt.cc.utexas.edu
UUCP: ...cs.utexas.edu!walt.cc.utexas.edu!mentat

oster@dewey.soe.berkeley.edu (David Phillip Oster) (08/13/89)

In article <16995@ut-emx.UUCP> mentat@walt.cc.utexas.edu (Robert Dorsett) writes:
>The problem facing me is
>how to determine (a) the presence of a color monitor, and (b) the number of
>bitplanes selected on that monitor.

/* myWin is a WIndowPtr parameter */
	SysEnvRec	world;
	Rect		r;
	GDHandle	gd;

	SysEnvirons(1, &world);
	if(world.hasColorQD){
		r = myWin->portRect;
		LocalToGlobal(&topLeft(r));
		LocalToGlobal(&botRight(r));
		gd = GetMaxDevice(&r);
		(**(**gd).gdPMap).pixelSize /* the number of bitplanes */
		TestDeviceAttribute(gd, gdDevType) /* true for color */i
	}

This is all clearly documented in Inside Mac Vol 5, Graphic Devices.


--- David Phillip Oster            --"Unix Version 7 was an improvement not
Arpa: oster@dewey.soe.berkeley.edu --only over its predeccessors, but also its
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu --successors."