home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / GDEVMGR.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  4KB  |  113 lines

  1. /* Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gdevmgr.h */
  20. /* Common header file for MGR devices */
  21.  
  22. #define MGR_RESERVEDCOLORS 16
  23.  
  24.  
  25. /* extract from dump.h */
  26.  
  27. /*
  28.  * format for saved bitmaps
  29.  */
  30.  
  31. #define B_PUTHDR8(hdr, w, h, d) (            \
  32.     (hdr)->magic[0]  = 'y', (hdr)->magic[1] = 'z',  \
  33.     (hdr)->h_wide    = (((w) >> 6) & 0x3f) + ' ',    \
  34.     (hdr)->l_wide    = ((w) & 0x3f) + ' ',        \
  35.     (hdr)->h_high    = (((h) >> 6) & 0x3f) + ' ',    \
  36.     (hdr)->l_high    = ((h) & 0x3f) + ' ',        \
  37.     (hdr)->depth     = ((d) & 0x3f) + ' ',        \
  38.     (hdr)->_reserved = ' ' )
  39.  
  40. struct b_header {
  41.   char magic[2];           /* magics */
  42.   char h_wide;             /* upper byte width (biased with 0x20) */
  43.   char l_wide;             /* lower byte width (biased with 0x20) */
  44.   char h_high;             /* upper byte height (biased with 0x20) */
  45.   char l_high;             /* lower byte height (biased with 0x20) */
  46.   char depth;              /* depth (biased with 0x20) */
  47.   char _reserved;          /* for alignment */
  48. };
  49.  
  50. /*
  51.  * Color lookup table information
  52.  */
  53. struct nclut {
  54.   unsigned short colnum;
  55.   unsigned short red, green, blue;
  56. } ;
  57.  
  58.  
  59. /* extract from color.h */
  60.  
  61. /*
  62.  * MGR Color Definitions
  63.  */
  64.  
  65. #define LUT_BW    0
  66. #define LUT_GREY  1
  67. #define LUT_BGREY 2
  68. #define LUT_VGA   3
  69. #define LUT_BCT   4
  70. #define LUT_USER  5
  71. #define LUT       6
  72. #define LUT_8     LUT
  73.  
  74. #define RGB_RED   0
  75. #define RGB_GREEN 1
  76. #define RGB_BLUE  2
  77. #define RGB       3
  78.  
  79. #define LUTENTRIES 16
  80.  
  81. #define BW_RED       15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0
  82. #define BW_GREEN     BW_RED
  83. #define BW_BLUE      BW_RED
  84.  
  85. #define GREY_RED     0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  86. #define GREY_GREEN   GREY_RED
  87. #define GREY_BLUE    GREY_RED
  88.  
  89. #define BGREY_RED    1, 0, 2, 8, 4, 3, 13, 11, 7, 6, 10, 12, 14, 5, 9, 15
  90. #define BGREY_GREEN  BGREY_RED
  91. #define BGREY_BLUE   BGREY_RED
  92.  
  93. #define VGA_RED      0, 0, 0, 0, 8, 8, 8, 12, 8,  0,  0,  0, 15, 15, 15, 15
  94. #define VGA_GREEN    0, 0, 8, 8, 0, 0, 8, 12, 8,  0, 15, 15,  0,  0, 15, 15
  95. #define VGA_BLUE     0, 8, 0, 8, 0, 8, 0, 12, 8, 15,  0, 15,  0, 15,  0, 15
  96.  
  97. #define BCT_RED      1,  7,  6, 15, 14, 3, 13, 11, 7, 13, 13, 15, 15, 5, 9, 15
  98. #define BCT_GREEN    1,  7, 13, 12,  5, 3, 13, 11, 7, 14, 15, 15, 14, 5, 9, 15
  99. #define BCT_BLUE     1, 14,  6,  8,  5, 3, 13, 11, 7, 15, 14, 12, 13, 5, 9, 15
  100.  
  101. #define USER_RED     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  102. #define USER_GREEN   USER_RED
  103. #define USER_BLUE    USER_RED
  104.  
  105. static char mgrlut[LUT][RGB][LUTENTRIES] = {
  106.   { { BW_RED },    { BW_GREEN },    { BW_BLUE } },
  107.   { { GREY_RED },  { GREY_GREEN },  { GREY_BLUE } },
  108.   { { BGREY_RED }, { BGREY_GREEN }, { BGREY_BLUE } },
  109.   { { VGA_RED },   { VGA_GREEN },   { VGA_BLUE } },
  110.   { { BCT_RED },   { BCT_GREEN },   { BCT_BLUE } },
  111.   { { USER_RED },  { USER_GREEN },  { USER_BLUE } }
  112. };
  113.