home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Appearance SDK 1.0.4 / Appearance Sample Code / Source / ColorUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-07-16  |  1.4 KB  |  61 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ColorUtils.h
  3.  
  4.     Contains:    Macros to help drawing in color.
  5.  
  6.     Version:    Appearance 1.0 SDK
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                Edward Voas
  13.  
  14.         Other Contact:        7 of 9, Borg Collective
  15.  
  16.         Technology:            OS Technologies Group
  17.  
  18.     Writers:
  19.  
  20.         (edv)    Ed Voas
  21.  
  22.     Change History (most recent first):
  23.  
  24.          <1>     9/11/97    edv        First checked in.
  25. */
  26.  
  27. #ifndef __COLOR_UTILS__
  28. #define __COLOR_UTILS__
  29.  
  30. #include "ColorPenState.h"
  31.  
  32. enum {
  33.     kBlack            = 0,
  34.     kGrayLevel1        = 0x1111,
  35.     kGrayLevel2        = 0x2222,
  36.     kGrayLevel3        = 0x3333,
  37.     kGrayLevel4        = 0x4444,
  38.     kGrayLevel5        = 0x5555,
  39.     kGrayLevel6        = 0x6666,
  40.     kGrayLevel7        = 0x7777,
  41.     kGrayLevel8        = 0x8888,
  42.     kGrayLevel9        = 0x9999,
  43.     kGrayLevelA        = 0xAAAA,
  44.     kGrayLevelB        = 0xBBBB,
  45.     kGrayLevelC        = 0xCCCC,
  46.     kGrayLevelD        = 0xDDDD,
  47.     kGrayLevelE        = 0xEEEE,
  48.     kWhite            = 0xFFFF
  49. };
  50.  
  51. #define IsColorGrafPort( port ) (((port)->portBits.rowBytes & 0xC000) == 0xC000)
  52. #define GetCurrentDepth( port )    ( IsColorGrafPort( port ) ? (**((CGrafPtr)port)->portPixMap).pixelSize : 1 )
  53. #define MakeGray( color, gray ) ((color).red = (color).green = (color).blue = gray )
  54.  
  55. #define SetForeGray( gray )    \
  56.     do { RGBColor temp; temp.red = temp.green = temp.blue = (gray); RGBForeColor( &temp ); } while( 0 )
  57. #define SetBackGray( gray )    \
  58.     do { RGBColor temp; temp.red = temp.green = temp.blue = (gray); RGBBackColor( &temp ); } while( 0 )
  59.  
  60. #endif // __COLOR_UTILS__
  61.