[comp.sys.mac.programmer] Determining if monitor supports color?

weinstoc@sei.cmu.edu (Chuck Weinstock) (07/17/90)

According to the documentation of SysEnvirons, there is a highlevel
QuickDraw routine which will allow me to determine if there is a color
monitor present.  I've searched through IM and have been unable to
locate the reference to this routine.  Could someone tell me how to
decide whether a color monitor is present, or point me at the relevant
documentation?  Thanks.

Chuck Weinstock

jackiw@cs.swarthmore.edu (Nick Jackiw) (07/18/90)

weinstoc@sei.cmu.edu (Chuck Weinstock) writes:
> Could someone tell me how to
> decide whether a color monitor is present, or point me at the relevant
> documentation?  Thanks.
> 
> Chuck Weinstock

You have a graphics device capable of displaying color if

	GetMaxDevice^^.gdPMap^^.pixelSize>1

GetMaxDevice returns a handle to the Graphics Device of greatest pixel
depth.  gdPMap is the pixMap which images the device; pixelSize is the
number of bits allocated to an individual pixel on this device. 

Note that for most practical purposes you'll want to check if pixelSize>2.
2-bit mode, while technically colored, is pretty lame.  Note also that
this call doesn't distinguish between color and gray-scale.  Most of the
time, you'll want to ignore this distinction.  If not, you may want to 
examine theDevice^^.gdMode field...I'm not sure what needs to be done 
here.

Check out Chapter 5 of Inside Mac Volume 5.  Chapters 6 and 7 are related,
too.

-Nick



-- 
-----Nick Jackiw [jackiw@cs.swarthmore.edu|jackiw@swarthmr.bitnet------
"This orbe of starres fixed infinitely vp extendeth hitself in altitvde 
sphericallye, and therefore immovable the pallace of foelicity garnished
with perpetvall shining glorious lightes innvmerable." - Thomas Digges