home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Snippets / Sideways / MSUtil.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-22  |  720 b   |  34 lines  |  [TEXT/KAHL]

  1.  
  2.  
  3.  
  4. #include "MSUtil.h"
  5.  
  6. /* check current grafPort support for color drawing    */
  7. Boolean MSColorIndexesOK()    
  8. {
  9.     return ( MSColorQDExists() && MSColorGrafPortIsTrue());
  10. }
  11.  
  12. /* Check for Color QuickDraw available at runtime    */
  13. Boolean MSColorQDExists()    
  14. {
  15.     SysEnvRec    theWorld;
  16.     OSErr        theErr;
  17.  
  18.     theErr = SysEnvirons( 20, &theWorld );
  19.     return theWorld.hasColorQD;
  20. }
  21.  
  22. /* check current grafPort for color    */
  23. Boolean MSColorGrafPortIsTrue()            
  24. {
  25.     CGrafPtr    colorPortPtr;
  26.     short        versionHold;
  27.  
  28.     GetPort( (GrafPtr *)&colorPortPtr );
  29.     versionHold = colorPortPtr->portVersion;
  30.  
  31.     /* If the first two bits of portVersion are set, this is a color GrafPort    */
  32.     return (BitTst( (Ptr)&versionHold, 0 ) && BitTst( (Ptr)&versionHold, 1 ));
  33. }
  34.