Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

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