home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / HyperCard / BitDepth XFCN 1.0.2 / BitDepth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-07  |  1.2 KB  |  64 lines  |  [TEXT/CWIE]

  1. /* ----------------------------------------------------------------------
  2.  
  3.     BitDepth XFCN
  4.     version 1.0.2
  5.     
  6.     Written by: Paul Celestin
  7.     
  8.     Copyright © 1993-1996 Celestin Company, Inc.
  9.     
  10.     This XFCN returns the bit depth of the main screen.
  11.     
  12.     930925 - 1.0.0 - initial release
  13.     951215 - 1.0.1 - updated for CW7
  14.     960704 - 1.0.2 - updated for CW9
  15.  
  16. ---------------------------------------------------------------------- */
  17.  
  18. #include <A4Stuff.h>
  19. #include <HyperXCmd.h>
  20.  
  21. void DoIt(XCmdPtr paramPtr);
  22.  
  23. pascal void main(XCmdPtr paramPtr)
  24. {
  25.     long oldA4 = SetCurrentA4();
  26.     DoIt( paramPtr );
  27.     SetA4(oldA4);
  28. }
  29.  
  30. void DoIt(XCmdPtr paramPtr)
  31. {
  32.     Str255            copyright = "\pCopyright © 1993-1996 Celestin Company, Inc.";
  33.     long            depth;
  34.     Str255            myString;
  35.     GDHandle        curDev;
  36.     PixMapHandle    myPixMap;
  37.     SysEnvRec        myComputer;
  38.  
  39.     if (paramPtr->paramCount != 0)
  40.     {
  41.         paramPtr->returnValue = PasToZero(paramPtr,"\pNo arguments required!");
  42.     }
  43.     else
  44.     {
  45.         SysEnvirons(2,&myComputer);
  46.         if (myComputer.hasColorQD)
  47.         {
  48.             curDev = GetMainDevice();
  49.             if (curDev != 0)
  50.             {
  51.                 myPixMap = (**curDev).gdPMap;
  52.                 depth = (**myPixMap).pixelSize;
  53.             }
  54.             else
  55.                 depth = 1;
  56.         }
  57.         else depth = 1;
  58.  
  59.         NumToStr(paramPtr,depth,myString);
  60.         paramPtr->returnValue = PasToZero(paramPtr,myString);
  61.     }
  62.  
  63. }
  64.