home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / msysjour / vol03 / 04 / palette / palette.h < prev    next >
Text File  |  1988-04-08  |  2KB  |  94 lines

  1. /*
  2.  * WINDOWS COLOR PALETTE UTILITY - HEADER FILE
  3.  *
  4.  * LANGUAGE : Microsoft C 5.0
  5.  * TOOLKIT  : Windows 2.03 SDK
  6.  * MODEL    : Small or Medium
  7.  * STATUS   : Operational
  8.  *
  9.  * 03/20/88 - Kevin P. Welch - initial creation.
  10.  *
  11.  */
  12.  
  13. /* macro definitions */
  14. #define    ABS(x)                    ((x<0)?(-(x)):(x))
  15.  
  16. #define    MAX(a,b)                    ((a>b)?a:b)
  17. #define    MIN(a,b)                    ((a<b)?a:b)
  18.  
  19. #define    MAXIMUM(a,b,c)            ((a>b)?MAX(a,c):MAX(b,c))
  20. #define    MINIMUM(a,b,c)            ((a<b)?MIN(a,c):MIN(b,c))
  21.  
  22. #define    SPECTRUM1                GetDlgItem(hDlg,ID_SPECTRUM1)
  23. #define    SPECTRUM2                GetDlgItem(hDlg,ID_SPECTRUM2)
  24. #define    SPECTRUM3                GetDlgItem(hDlg,ID_SPECTRUM3)
  25.  
  26. #define    INSTANCE                    GetWindowWord(hDlg,GWW_HINSTANCE)
  27.  
  28. /* color definition structures */
  29. typedef struct {
  30.     DWORD        cRed        : 8;
  31.     DWORD        cGreen    : 8;
  32.     DWORD        cBlue        : 8;
  33.     DWORD        cUnused    : 8;
  34. } CRT;
  35.  
  36. typedef struct {
  37.     float        fRed;
  38.     float        fGreen;
  39.     float        fBlue;
  40. } RGB;
  41.  
  42. typedef struct {
  43.     float        fCyan;
  44.     float        fMagenta;
  45.     float        fYellow;
  46. } CMY;
  47.  
  48. typedef struct {
  49.     float        fHue;
  50.     float        fSaturation;
  51.     float        fValue;
  52. } HSV;
  53.  
  54. /* */
  55.  
  56. /* PALETTE DIALOG BOX DEFINITIONS */
  57.  
  58. /* Color Palette Dialog Box */
  59. #define    ID_RGB                    100        /* red, green, blue */
  60. #define    ID_CMY                    101        /* cyan, magenta, yellow */
  61. #define    ID_HSV                    102        /* hue, saturation & value */
  62. #define    ID_RED                    103        /* red equivalent */
  63. #define    ID_GREEN                    104        /* green equivalent */
  64. #define    ID_BLUE                    105        /* blue equivalent */
  65. #define    ID_SAMPLE                106        /* sample color patch */
  66. #define    ID_TITLE1                107        /* 1st spectrum title */
  67. #define    ID_TITLE2                108        /* 2nd spectrum title */
  68. #define    ID_TITLE3                109        /* 3rd spectrum title */
  69. #define    ID_SPECTRUM1            110        /* 1st spectrum */
  70. #define    ID_SPECTRUM2            111        /* 2nd spectrum */
  71. #define    ID_SPECTRUM3            112        /* 3rd spectrum */
  72. #define    ID_VALUE1                113        /* 1st spectrum value */
  73. #define    ID_VALUE2                114        /* 2nd spectrum value */
  74. #define    ID_VALUE3                115        /* 3rd spectrum value */
  75.  
  76. /* */
  77.  
  78. /* PALETTE FUNCTION DEFINITIONS */
  79.  
  80. /* Color conversion function definitions */
  81. BOOL                    RGBtoCRT( RGB *, CRT * );
  82. BOOL                    RGBtoCMY( RGB *, CMY * );
  83. BOOL                    RGBtoHSV( RGB *, HSV * );
  84. BOOL                    CRTtoRGB( CRT *, RGB * );
  85. BOOL                    CMYtoRGB( CMY *, RGB * );
  86. BOOL                  HSVtoRGB( HSV *, RGB * );
  87.  
  88. /* General function definitions */
  89. void                    SelectMixingModel( HANDLE, WORD );
  90. BOOL FAR PASCAL    PaletteDlgFn( HWND, WORD, WORD, LONG );
  91.  
  92.  
  93.  
  94.