1 /* Copyright (C) 2001-2006 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, modified 8 or distributed except as expressly authorized under the terms of that 9 license. Refer to licensing information at http://www.artifex.com/ 10 or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, 11 San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. 12 */ 13 /* $Id: gdevmgr.h 8022 2007-06-05 22:23:38Z giles $*/ 14 /* Common header file for MGR devices */ 15 16 #ifndef gdevmgr_INCLUDED 17 # define gdevmgr_INCLUDED 18 19 #define MGR_RESERVEDCOLORS 16 20 21 /* Color mapping routines for 8-bit color (with a fixed palette). */ 22 dev_proc_map_rgb_color(mgr_8bit_map_rgb_color); 23 dev_proc_map_color_rgb(mgr_8bit_map_color_rgb); 24 25 26 /* extract from dump.h */ 27 28 /* 29 * format for saved bitmaps 30 */ 31 32 #define B_PUTHDR8(hdr, w, h, d) ( \ 33 (hdr)->magic[0] = 'y', (hdr)->magic[1] = 'z', \ 34 (hdr)->h_wide = (((w) >> 6) & 0x3f) + ' ', \ 35 (hdr)->l_wide = ((w) & 0x3f) + ' ', \ 36 (hdr)->h_high = (((h) >> 6) & 0x3f) + ' ', \ 37 (hdr)->l_high = ((h) & 0x3f) + ' ', \ 38 (hdr)->depth = ((d) & 0x3f) + ' ', \ 39 (hdr)->_reserved = ' ' ) 40 41 struct b_header { 42 char magic[2]; /* magics */ 43 char h_wide; /* upper byte width (biased with 0x20) */ 44 char l_wide; /* lower byte width (biased with 0x20) */ 45 char h_high; /* upper byte height (biased with 0x20) */ 46 char l_high; /* lower byte height (biased with 0x20) */ 47 char depth; /* depth (biased with 0x20) */ 48 char _reserved; /* for alignment */ 49 }; 50 51 /* 52 * Color lookup table information 53 */ 54 struct nclut { 55 unsigned short colnum; 56 unsigned short red, green, blue; 57 } ; 58 59 60 /* extract from color.h */ 61 62 /* 63 * MGR Color Definitions 64 */ 65 66 #define LUT_BW 0 67 #define LUT_GREY 1 68 #define LUT_BGREY 2 69 #define LUT_VGA 3 70 #define LUT_BCT 4 71 #define LUT_USER 5 72 #define LUT 6 73 #define LUT_8 LUT 74 75 #define RGB_RED 0 76 #define RGB_GREEN 1 77 #define RGB_BLUE 2 78 #define RGB 3 79 80 #define LUTENTRIES 16 81 82 #define BW_RED 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0 83 #define BW_GREEN BW_RED 84 #define BW_BLUE BW_RED 85 86 #define GREY_RED 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 87 #define GREY_GREEN GREY_RED 88 #define GREY_BLUE GREY_RED 89 90 #define BGREY_RED 1, 0, 2, 8, 4, 3, 13, 11, 7, 6, 10, 12, 14, 5, 9, 15 91 #define BGREY_GREEN BGREY_RED 92 #define BGREY_BLUE BGREY_RED 93 94 #define VGA_RED 0, 0, 0, 0, 8, 8, 8, 12, 8, 0, 0, 0, 15, 15, 15, 15 95 #define VGA_GREEN 0, 0, 8, 8, 0, 0, 8, 12, 8, 0, 15, 15, 0, 0, 15, 15 96 #define VGA_BLUE 0, 8, 0, 8, 0, 8, 0, 12, 8, 15, 0, 15, 0, 15, 0, 15 97 98 #define BCT_RED 1, 7, 6, 15, 14, 3, 13, 11, 7, 13, 13, 15, 15, 5, 9, 15 99 #define BCT_GREEN 1, 7, 13, 12, 5, 3, 13, 11, 7, 14, 15, 15, 14, 5, 9, 15 100 #define BCT_BLUE 1, 14, 6, 8, 5, 3, 13, 11, 7, 15, 14, 12, 13, 5, 9, 15 101 102 #define USER_RED 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 103 #define USER_GREEN USER_RED 104 #define USER_BLUE USER_RED 105 106 static char mgrlut[LUT][RGB][LUTENTRIES] = { 107 { { BW_RED }, { BW_GREEN }, { BW_BLUE } }, 108 { { GREY_RED }, { GREY_GREEN }, { GREY_BLUE } }, 109 { { BGREY_RED }, { BGREY_GREEN }, { BGREY_BLUE } }, 110 { { VGA_RED }, { VGA_GREEN }, { VGA_BLUE } }, 111 { { BCT_RED }, { BCT_GREEN }, { BCT_BLUE } }, 112 { { USER_RED }, { USER_GREEN }, { USER_BLUE } } 113 }; 114 115 #endif /* gdevmgr_INCLUDED */ 116