Subversion Repositories planix.SVN

Rev

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

Rev Author Line No. Line
2 - 1
/*
2
 *
3
 * BGI opcodes.
4
 *
5
 */
6
 
7
#define BRCHAR		033		/* rotated character mode */
8
#define BCHAR		034		/* graphical character mode */
9
#define BGRAPH		035		/* graphical master mode */
10
 
11
#define BSUB		042		/* subroutine definition */
12
#define BRET		043		/* end of subroutine */
13
#define BCALL		044		/* subroutine call */
14
 
15
#define BEND		045		/* end page */
16
#define BERASE		046		/* erase - obsolete */
17
#define BREP		047		/* repeat */
18
#define BENDR		050		/* end repeat */
19
 
20
#define BSETX		051		/* set horizontal position */
21
#define BSETY		052		/* set vertical position */
22
#define BSETXY		053		/* set horizontal and vertical positions */
23
#define BINTEN		054		/* intensify - mark current pixel */
24
 
25
#define BVISX		055		/* manhattan vector - change x first */
26
#define BINVISX		056		/* same as BVISX but nothing drawn */
27
#define BVISY		057		/* manhattan vector - change y first */
28
#define BINVISY		060		/* same as BVISY but nothing drawn */
29
 
30
#define BVEC		061		/* arbitrary long vector */
31
#define BSVEC		062		/* arbitrary short vector */
32
#define BRECT		063		/* outline rectangle */
33
#define BPOINT1		064		/* point plot - mode 1 */
34
#define BPOINT		065		/* point plot - mode 2 */
35
#define BLINE		066		/* line plot */
36
 
37
#define BCSZ		067		/* set character size */
38
#define BLTY		070		/* select line type */
39
#define BARC		071		/* draw circular arc */
40
#define BFARC		072		/* filled circular arc */
41
#define BFRECT		073		/* filled rectangle */
42
#define BRASRECT	074		/* raster rectangle */
43
#define BCOL		075		/* select color */
44
#define BFTRAPH		076		/* filled trapezoid */
45
#define BPAT		077		/* pattern are for filling - no info */
46
 
47
#define BNOISE		0		/* from bad file format */
48
 
49
/*
50
 *
51
 * Character size is controlled by the spacing of dots in a 5x7 dot matrix, which
52
 * by default is set to BGISIZE.
53
 *
54
 */
55
 
56
#define BGISIZE		2		/* default character grid spacing */
57
 
58
/*
59
 *
60
 * Definitions used to decode the bytes read from a BGI file.
61
 *
62
 */
63
 
64
#define CHMASK		0177		/* characters only use 7 bits */
65
#define DMASK		077		/* data values use lower 6 bits */
66
#define MSB		0100		/* used to check for data or opcode */
67
#define SGNB		040		/* sign bit for integers */
68
#define MSBMAG		037		/* mag of most sig byte in a BGI int */
69
 
70
/*
71
 *
72
 * Descriptions of BGI vectors and what's done when they're drawn.
73
 *
74
 */
75
 
76
#define X_COORD		0		/* change x next in manhattan vector */
77
#define Y_COORD		1		/* same but y change comes next */
78
#define LONGVECTOR	2		/* arbitrary long vector */
79
#define SHORTVECTOR	3		/* components given in 6 bits */
80
 
81
#define VISIBLE		0		/* really draw the vector */
82
#define INVISIBLE	1		/* just move the current position */
83
 
84
/*
85
 *
86
 * What's done with a closed path.
87
 *
88
 */
89
 
90
#define OUTLINE		0		/* outline the defined path */
91
#define FILL		1		/* fill it in */
92
 
93
/*
94
 *
95
 * BGI line style definitions. They're used as an index into the STYLES array,
96
 * which really belongs in the prologue.
97
 *
98
 */
99
 
100
#define SOLID		0
101
#define DOTTED		1
102
#define SHORTDASH	2
103
#define DASH		3
104
#define LONGDASH	4
105
#define DOTDASH		5
106
#define THREEDOT	6
107
 
108
#define STYLES								\
109
									\
110
	{								\
111
	    "[]",							\
112
	    "[.5 2]",							\
113
	    "[2 4]",							\
114
	    "[4 4]",							\
115
	    "[8 4]",							\
116
	    "[.5 2 4 2]",						\
117
	    "[.5 2 .5 2 .5 2 4 2]"					\
118
	}
119
 
120
/*
121
 *
122
 * Three constants used to choose which component (RED, GREEN, or BLUE) we're
123
 * interested in. BGI colors are specified as a single data byte and pulling a
124
 * particular  component out of the BGI color byte is handled by procedure
125
 * get_color().
126
 *
127
 */
128
 
129
#define RED		0
130
#define GREEN		1
131
#define BLUE		2
132
 
133
/*
134
 *
135
 * An array of type Disp is used to save the horizontal and vertical displacements
136
 * that result after a subroutine has been called. Needed so we can properly adjust
137
 * our horizontal and vertical positions after a subroutine call. Entries are made
138
 * immediately after a subroutine is defined and used after the call. Subroutine
139
 * names are integers that range from 0 to 63 (assigned in the BG file) and the
140
 * name is used as an index into the Disp array when we save or retrieve the
141
 * displacement.
142
 *
143
 */
144
 
145
typedef struct {
146
	int	dx;			/* horizontal and */
147
	int	dy;			/* vertical displacements */
148
} Disp;
149
 
150
/*
151
 *
152
 * An array of type Fontmap helps convert font names requested by users into
153
 * legitimate PostScript names. The array is initialized using FONTMAP, which must
154
 * end with and entry that has NULL defined as its name field.
155
 *
156
 */
157
 
158
typedef struct {
159
	char	*name;			/* user's font name */
160
	char	*val;			/* corresponding PostScript name */
161
} Fontmap;
162
 
163
#define FONTMAP								\
164
									\
165
	{								\
166
	    "R", "Courier",						\
167
	    "I", "Courier-Oblique",					\
168
	    "B", "Courier-Bold",					\
169
	    "CO", "Courier",						\
170
	    "CI", "Courier-Oblique",					\
171
	    "CB", "Courier-Bold",					\
172
	    "CW", "Courier",						\
173
	    "PO", "Courier",						\
174
	    "courier", "Courier",					\
175
	    "cour", "Courier",						\
176
	    "co", "Courier",						\
177
	    NULL, NULL							\
178
	}
179
 
180
/*
181
 *
182
 * Two macros that are useful in processing BGI files:
183
 *
184
 *       MAG(A, B)    - Takes bytes A and B which have been read from a BGI file
185
 *                      and returns the magnitude of the integer represented by
186
 *                      the two bytes.
187
 *
188
 *       LINESPACE(A) - Takes BGI size A and returns the number of address units
189
 *                      that can be used for a reasonable interline spacing.
190
 *
191
 */
192
 
193
#define MAG(A, B)	(((A & MSBMAG) << 6) | (B & DMASK))
194
#define LINESPACE(A)	(8 * A)
195
 
196
/*
197
 *
198
 * Some of the non-integer valued functions in postdmd.c.
199
 *
200
 */
201
 
202
char	*get_font();
203