2 static char *RCSid() { return RCSid("$Id: bitmap.c,v 1.24.2.1 2008/05/22 21:22:16 sfeam Exp $"); }
5 /* GNUPLOT - bitmap.c */
8 * Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
10 * Permission to use, copy, and distribute this software and its
11 * documentation for any purpose with or without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and
13 * that both that copyright notice and this permission notice appear
14 * in supporting documentation.
16 * Permission to modify the software is granted, but not the right to
17 * distribute the complete modified source code. Modifications are to
18 * be distributed as patches to the released version. Permission to
19 * distribute binaries produced by compiling modified sources is granted,
21 * 1. distribute the corresponding source modifications from the
22 * released version in the form of a patch file along with the binaries,
23 * 2. add special version identification to distinguish your version
24 * in addition to the base release version number,
25 * 3. provide your name and address as the primary contact for the
26 * support of your modified version, and
27 * 4. retain our contact information in regard to use of the base
29 * Permission to distribute the released version of the source code along
30 * with corresponding source modifications in the form of a patch file is
31 * granted with same provisions 2 through 4 for binary distributions.
33 * This software is provided "as is" without express or implied warranty
34 * to the extent permitted by applicable law.
42 * Jyrki Yli-Nokari <jty@intrin.UUCP>
43 * Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
44 * Russell Lang <rjl@monu1.cc.monash.edu.au>
49 ** General raster plotting routines.
50 ** Raster routines written and copyrighted 1987 by
51 ** Jyrki Yli-Nokari (jty@intrin.UUCP)
54 ** You may use this code for anything you like as long as
55 ** you are not selling it and the credit is given and
56 ** this message retained.
60 /* Bitmap plotting routines derived from above raster plotting routines
68 #include "term_api.h" /* EAM - to pick up fillstyle definitions */
70 /* global variables */
71 bitmap *b_p = (bitmap *) NULL; /* global pointer to bitmap */
73 unsigned int b_xsize, b_ysize; /* the size of the bitmap */
74 unsigned int b_planes; /* number of color planes */
75 unsigned int b_psize; /* size of each plane */
76 unsigned int b_rastermode; /* raster mode rotates -90deg */
77 unsigned int b_linemask = 0xffff; /* 16 bit mask for dotted lines */
78 unsigned int b_angle; /* rotation of text */
82 /* Local prototypes */
83 static void b_putc __PROTO((unsigned int, unsigned int, int, unsigned int));
84 static GP_INLINE void b_setpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
85 static GP_INLINE void b_setmaskpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
86 static void b_line __PROTO((unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2));
88 /* file-scope variables */
90 static unsigned int b_value = 1; /* colour of lines */
91 static unsigned int b_currx, b_curry; /* the current coordinates */
92 static unsigned int b_hchar; /* width of characters */
93 static unsigned int b_hbits; /* actual bits in char horizontally */
94 static unsigned int b_vchar; /* height of characters */
95 static unsigned int b_vbits; /* actual bits in char vertically */
96 static char_box b_font[FNT_CHARS]; /* the current font */
97 static unsigned int b_pattern[] = { 0xffff, 0x1111, 0xffff, 0x5555,
98 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f };
99 static unsigned int b_lastx;
100 static unsigned int b_lasty; /* last pixel set - used by b_line */
103 /* 5x9 font, bottom row first, left pixel in lsb */
104 const char_row GPFAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
105 /* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000},
106 /*!*/ {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
107 /*"*/ {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
108 /*#*/ {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
109 /*$*/ {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
110 /*%*/ {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
111 /*&*/ {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
112 /*'*/ {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
113 /*(*/ {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
114 /*)*/ {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
115 /***/ {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
116 /*+*/ {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
117 /*,*/ {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
118 /*-*/ {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
119 /*.*/ {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
120 /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
121 /*0*/ {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
122 /*1*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
123 /*2*/ {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
124 /*3*/ {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
125 /*4*/ {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
126 /*5*/ {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
127 /*6*/ {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
128 /*7*/ {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
129 /*8*/ {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
130 /*9*/ {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
131 /*:*/ {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
132 /*;*/ {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
133 /*<*/ {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
134 /*=*/ {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
135 /*>*/ {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
136 /*?*/ {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
137 /*@*/ {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
138 /*A*/ {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
139 /*B*/ {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
140 /*C*/ {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
141 /*D*/ {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
142 /*E*/ {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
143 /*F*/ {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
144 /*G*/ {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
145 /*H*/ {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
146 /*I*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
147 /*J*/ {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
148 /*K*/ {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
149 /*L*/ {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
150 /*M*/ {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
151 /*N*/ {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
152 /*O*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
153 /*P*/ {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
154 /*Q*/ {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
155 /*R*/ {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
156 /*S*/ {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
157 /*T*/ {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
158 /*U*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
159 /*V*/ {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
160 /*W*/ {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
161 /*X*/ {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
162 /*Y*/ {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
163 /*Z*/ {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
164 /*[*/ {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
165 /*\ */ {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
166 /*]*/ {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
167 /*^*/ {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
168 /*_*/ {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
169 /*`*/ {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
170 /*a*/ {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
171 /*b*/ {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
172 /*c*/ {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
173 /*d*/ {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
174 /*e*/ {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
175 /*f*/ {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
176 /*g*/ {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
177 /*h*/ {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
178 /*i*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
179 /*j*/ {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
180 /*k*/ {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
181 /*l*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
182 /*m*/ {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
183 /*n*/ {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
184 /*o*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
185 /*p*/ {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
186 /*q*/ {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
187 /*r*/ {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
188 /*s*/ {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
189 /*t*/ {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
190 /*u*/ {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
191 /*v*/ {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
192 /*w*/ {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
193 /*x*/ {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
194 /*y*/ {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
195 /*z*/ {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
196 /*{*/ {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
197 /*|*/ {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
198 /*}*/ {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
199 /*~*/ {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
200 /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
203 /* 9x17 font, bottom row first, left pixel in lsb */
204 const char_row GPFAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
205 /* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
206 000000,000000,000000,000000,000000,000000,000000,000000},
207 /*!*/ {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
208 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
209 /*"*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
210 000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
211 /*#*/ {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
212 0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
213 /*$*/ {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
214 0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
215 /*%*/ {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
216 0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
217 /*&*/ {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
218 0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
219 /*'*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
220 000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
221 /*(*/ {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
222 0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
223 /*)*/ {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
224 0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
225 /***/ {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
226 0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
227 /*+*/ {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
228 0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
229 /*,*/ {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
230 000000,000000,000000,000000,000000,000000,000000,000000},
231 /*-*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
232 000000,0x01ff,000000,000000,000000,000000,000000,000000},
233 /*.*/ {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
234 000000,000000,000000,000000,000000,000000,000000,000000},
235 /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
236 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
237 /*0*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
238 0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
239 /*1*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
240 0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
241 /*2*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
242 0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
243 /*3*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
244 0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
245 /*4*/ {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
246 0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
247 /*5*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
248 0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
249 /*6*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
250 0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
251 /*7*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
252 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
253 /*8*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
254 0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
255 /*9*/ {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
256 0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
257 /*:*/ {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
258 000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
259 /*;*/ {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
260 000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
261 /*<*/ {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
262 0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
263 /*=*/ {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
264 000000,000000,000000,0x01ff,000000,000000,000000,000000},
265 /*>*/ {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
266 0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
267 /*?*/ {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
268 0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
269 /*@*/ {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
270 0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
271 /*A*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
272 0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
273 /*B*/ {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
274 0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
275 /*C*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
276 0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
277 /*D*/ {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
278 0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
279 /*E*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
280 0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
281 /*F*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
282 0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
283 /*G*/ {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
284 0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
285 /*H*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
286 0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
287 /*I*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
288 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
289 /*J*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
290 0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
291 /*K*/ {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
292 0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
293 /*L*/ {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
294 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
295 /*M*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
296 0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
297 /*N*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
298 0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
299 /*O*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
300 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
301 /*P*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
302 0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
303 /*Q*/ {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
304 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
305 /*R*/ {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
306 0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
307 /*S*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
308 0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
309 /*T*/ {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
310 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
311 /*U*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
312 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
313 /*V*/ {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
314 0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
315 /*W*/ {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
316 0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
317 /*X*/ {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
318 0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
319 /*Y*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
320 0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
321 /*Z*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
322 0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
323 /*[*/ {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
324 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
325 /*\ */ {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
326 0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
327 /*]*/ {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
328 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
329 /*^*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
330 000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
331 /*_*/ {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
332 000000,000000,000000,000000,000000,000000,000000,000000},
333 /*`*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
334 000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
335 /*a*/ {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
336 0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
337 /*b*/ {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
338 0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
339 /*c*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
340 0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
341 /*d*/ {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
342 0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
343 /*e*/ {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
344 0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
345 /*f*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
346 0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
347 /*g*/ {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
348 0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
349 /*h*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
350 0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
351 /*i*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
352 0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
353 /*j*/ {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
354 0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
355 /*k*/ {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
356 0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
357 /*l*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
358 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
359 /*m*/ {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
360 0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
361 /*n*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
362 0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
363 /*o*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
364 0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
365 /*p*/ {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
366 0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
367 /*q*/ {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
368 0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
369 /*r*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
370 0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
371 /*s*/ {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
372 0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
373 /*t*/ {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
374 0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
375 /*u*/ {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
376 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
377 /*v*/ {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
378 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
379 /*w*/ {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
380 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
381 /*x*/ {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
382 0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
383 /*y*/ {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
384 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
385 /*z*/ {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
386 0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
387 /*{*/ {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
388 0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
389 /*|*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
390 000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
391 /*}*/ {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
392 0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
393 /*~*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
394 000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
395 /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
396 000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
399 /* 13x25 font, bottom row first, left pixel in lsb */
400 const char_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
401 /* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
402 000000,000000,000000,000000,000000,000000,000000,000000,000000,
403 000000,000000,000000,000000,000000,000000,000000},
404 /*!*/ {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
405 000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
406 0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
407 /*"*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
408 000000,000000,000000,000000,000000,000000,000000,000000,000000,
409 0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
410 /*#*/ {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
411 0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
412 0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
413 /*$*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
414 0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
415 0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
416 /*%*/ {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
417 0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
418 0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
419 /*&*/ {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
420 0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
421 0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
422 /*'*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
423 000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
424 0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
425 /*(*/ {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
426 0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
427 0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
428 /*)*/ {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
429 0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
430 0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
431 /***/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
432 0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
433 0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
434 /*+*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
435 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
436 0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
437 /*,*/ {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
438 0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
439 000000,000000,000000,000000,000000,000000,000000},
440 /*-*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
441 000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
442 000000,000000,000000,000000,000000,000000,000000},
443 /*.*/ {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
444 0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
445 000000,000000,000000,000000,000000,000000,000000},
446 /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
447 0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
448 0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
449 /*0*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
450 0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
451 0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
452 /*1*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
453 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
454 0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
455 /*2*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
456 0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
457 0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
458 /*3*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
459 0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
460 0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
461 /*4*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
462 0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
463 0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
464 /*5*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
465 0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
466 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
467 /*6*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
468 0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
469 0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
470 /*7*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
471 0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
472 0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
473 /*8*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
474 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
475 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
476 /*9*/ {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
477 0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
478 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
479 /*:*/ {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
480 0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
481 0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
482 /*;*/ {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
483 0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
484 0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
485 /*<*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
486 0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
487 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
488 /*=*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
489 000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
490 0x1fff,000000,000000,000000,000000,000000,000000},
491 /*>*/ {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
492 0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
493 0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
494 /*?*/ {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
495 000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
496 0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
497 /*@*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
498 0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
499 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
500 /*A*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
501 0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
502 0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
503 /*B*/ {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
504 0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
505 0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
506 /*C*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
507 0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
508 0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
509 /*D*/ {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
510 0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
511 0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
512 /*E*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
513 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
514 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
515 /*F*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
516 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
517 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
518 /*G*/ {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
519 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
520 0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
521 /*H*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
522 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
523 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
524 /*I*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
525 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
526 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
527 /*J*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
528 0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
529 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
530 /*K*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
531 0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
532 0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
533 /*L*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
534 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
535 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
536 /*M*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
537 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
538 0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
539 /*N*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
540 0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
541 0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
542 /*O*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
543 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
544 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
545 /*P*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
546 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
547 0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
548 /*Q*/ {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
549 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
550 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
551 /*R*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
552 0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
553 0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
554 /*S*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
555 0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
556 0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
557 /*T*/ {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
558 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
559 0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
560 /*U*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
561 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
562 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
563 /*V*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
564 0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
565 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
566 /*W*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
567 0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
568 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
569 /*X*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
570 0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
571 0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
572 /*Y*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
573 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
574 0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
575 /*Z*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
576 0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
577 0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
578 /*[*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
579 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
580 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
581 /*\ */ {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
582 0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
583 0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
584 /*]*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
585 0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
586 0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
587 /*^*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
588 000000,000000,000000,000000,000000,000000,000000,000000,000000,
589 0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
590 /*_*/ {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
591 000000,000000,000000,000000,000000,000000,000000,000000,000000,
592 000000,000000,000000,000000,000000,000000,000000},
593 /*`*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
594 000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
595 0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
596 /*a*/ {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
597 0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
598 0x03f8,000000,000000,000000,000000,000000,000000},
599 /*b*/ {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
600 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
601 0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
602 /*c*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
603 0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
604 0x03f8,000000,000000,000000,000000,000000,000000},
605 /*d*/ {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
606 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
607 0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
608 /*e*/ {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
609 0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
610 0x03f8,000000,000000,000000,000000,000000,000000},
611 /*f*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
612 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
613 0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
614 /*g*/ {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
615 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
616 0x13f8,000000,000000,000000,000000,000000,000000},
617 /*h*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
618 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
619 0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
620 /*i*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
621 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
622 000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
623 /*j*/ {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
624 0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
625 000000,000000,000000,0x0700,0x0700,0x0700,000000},
626 /*k*/ {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
627 0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
628 0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
629 /*l*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
630 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
631 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
632 /*m*/ {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
633 0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
634 0x0209,000000,000000,000000,000000,000000,000000},
635 /*n*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
636 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
637 0x03f9,000000,000000,000000,000000,000000,000000},
638 /*o*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
639 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
640 0x03f8,000000,000000,000000,000000,000000,000000},
641 /*p*/ {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
642 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
643 0x03f9,000000,000000,000000,000000,000000,000000},
644 /*q*/ {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
645 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
646 0x13f8,000000,000000,000000,000000,000000,000000},
647 /*r*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
648 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
649 0x03f9,000000,000000,000000,000000,000000,000000},
650 /*s*/ {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
651 0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
652 0x07f8,000000,000000,000000,000000,000000,000000},
653 /*t*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
654 0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
655 0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
656 /*u*/ {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
657 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
658 0x1001,000000,000000,000000,000000,000000,000000},
659 /*v*/ {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
660 0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
661 0x1001,000000,000000,000000,000000,000000,000000},
662 /*w*/ {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
663 0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
664 0x1001,000000,000000,000000,000000,000000,000000},
665 /*x*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
666 0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
667 0x1001,000000,000000,000000,000000,000000,000000},
668 /*y*/ {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
669 0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
670 0x1001,000000,000000,000000,000000,000000,000000},
671 /*z*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
672 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
673 0x1fff,000000,000000,000000,000000,000000,000000},
674 /*{*/ {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
675 0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
676 0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
677 /*|*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
678 0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
679 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
680 /*}*/ {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
681 0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
682 0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
683 /*~*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
684 000000,000000,000000,000000,000000,000000,000000,000000,000000,
685 0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
686 /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
687 0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
688 0x1249,000000,000000,0x1249,000000,000000,0x1249},
691 /* Moved here from gif.trm */
692 struct rgb web_color_rgbs[] =
694 { 0xff, 0xff, 0xff }, /* background: white */
695 { 0x00, 0x00, 0x00 }, /* borders: black */
696 { 0xa0, 0xa0, 0xa0 }, /* x & y axes: grey */
697 { 0xff, 0x00, 0x00 }, /* color 01: red */
698 { 0x00, 0xc0, 0x00 }, /* color 02: dark green */
699 { 0x00, 0x80, 0xff }, /* color 03: dark blue */
700 { 0xc0, 0x00, 0xff }, /* color 04: dark magenta */
701 { 0x00, 0xee, 0xee }, /* color 05: cyan */
702 { 0xc0, 0x40, 0x00 }, /* color 06: orange */
703 { 0xee, 0xee, 0x00 }, /* color 07: yellow */
704 { 0x20, 0x20, 0xc0 }, /* color 08: royal blue */
705 { 0xff, 0xc0, 0x20 }, /* color 09: goldenrod1 */
706 /* please note: these colors are optimized for web216 compatibility */
707 { 0x00, 0x80, 0x40 }, /* SpringGreen4 */
708 { 0xa0, 0x80, 0xff }, /* MediumPurple1 */
709 { 0x80, 0x40, 0x00 }, /* DarkOrange4 */
710 { 0xff, 0x80, 0xff }, /* orchid1 */
711 { 0x00, 0xc0, 0x60 }, /* SpringGreen3 */
712 { 0x00, 0xc0, 0xc0 }, /* cyan3 */
713 { 0x00, 0x60, 0x80 }, /* DeepSkyBlue4 */
714 { 0xc0, 0x60, 0x80 }, /* PaleVioletRed3 */
715 { 0x00, 0x80, 0x00 }, /* green4 */
716 { 0x40, 0xff, 0x80 }, /* Sea green */
717 { 0x30, 0x60, 0x80 }, /* SteelBlue4 */
718 { 0x80, 0x60, 0x00 }, /* DarkGoldenrod4 */
719 { 0x40, 0x40, 0x40 }, /* grey25-31 */
720 { 0x40, 0x80, 0x00 }, /* chartreuse4 */
721 { 0x00, 0x00, 0x80 }, /* dark blue, navy blue */
722 { 0x80, 0x60, 0x10 }, /* goldenrod4 */
723 { 0x80, 0x60, 0x60 }, /* pink4 */
724 { 0x80, 0x60, 0x80 }, /* plum4 */
725 { 0x00, 0x00, 0xc0 }, /* medium blue */
726 { 0x00, 0x00, 0xff }, /* blue */
727 { 0x00, 0x60, 0x00 }, /* dark green */
728 { 0xe3, 0xb0, 0xc0 }, /* plum */
729 { 0x40, 0xc0, 0x80 }, /* SeaGreen3 */
730 { 0x60, 0xa0, 0xc0 }, /* SkyBlue3 */
731 { 0x60, 0xc0, 0x00 }, /* chartreuse3 */
732 { 0x60, 0xc0, 0xa0 }, /* medium aquamarine */
733 { 0x80, 0x00, 0x00 }, /* dark red */
734 { 0x80, 0x00, 0x80 }, /* dark magenta */
735 { 0x60, 0x20, 0x80 }, /* DarkOrchid4 */
736 { 0x60, 0x60, 0x60 }, /* dim grey */
737 { 0x20, 0x20, 0x20 }, /* grey13-18 */
738 { 0x20, 0x40, 0x40 }, /* dark slate grey */
739 { 0x20, 0x40, 0x80 }, /* RoyalBlue4 */
740 { 0x60, 0x80, 0x20 }, /* olive drab */
741 { 0x60, 0x80, 0x60 }, /* DarkSeaGreen4 */
742 { 0x60, 0x80, 0x80 }, /* LightBlue4, PaleTurquoise4 */
743 { 0x80, 0x80, 0x40 }, /* LightGoldenrod4, khaki4 */
744 { 0x20, 0x80, 0x20 }, /* forest green */
745 { 0x80, 0x80, 0x80 }, /* grey51-56 */
746 { 0xa0, 0xa0, 0xa0 }, /* dark grey, grey63-68 */
747 { 0xa0, 0xd0, 0xe0 }, /* light blue */
748 { 0xc0, 0x20, 0x20 }, /* firebrick3 */
749 { 0x00, 0x80, 0x80 }, /* dark cyan, turquoise4 */
750 { 0xc0, 0x60, 0x00 }, /* DarkOrange3 */
751 { 0x80, 0xc0, 0xe0 }, /* sky blue */
752 { 0xc0, 0x60, 0xc0 }, /* orchid3 */
753 { 0xc0, 0x80, 0x00 }, /* orange3 */
754 { 0xc0, 0x80, 0x60 }, /* LightSalmon3 */
755 { 0xff, 0x40, 0x00 }, /* orange red */
756 { 0xff, 0x40, 0x40 }, /* brown1, tomato */
757 { 0x80, 0xc0, 0xff }, /* light sky blue */
758 { 0xff, 0x80, 0x60 }, /* salmon */
759 { 0xff, 0x80, 0x80 }, /* light coral */
760 { 0xc0, 0xa0, 0x00 }, /* gold3 */
761 { 0xc0, 0xc0, 0xc0 }, /* grey76-81, honeydew3, ivory3, snow3 */
762 { 0xc0, 0xff, 0xc0 }, /* DarkSeaGreen1 */
763 { 0xff, 0x00, 0x00 }, /* red */
764 { 0xff, 0x00, 0xff }, /* magenta */
765 { 0xff, 0x80, 0xa0 }, /* PaleVioletRed1 */
766 { 0xc0, 0xc0, 0xa0 }, /* LemonChiffon3 */
767 { 0xff, 0x60, 0x60 }, /* IndianRed1 */
768 { 0x00, 0xff, 0x00 }, /* green */
769 { 0xff, 0x80, 0x00 }, /* dark orange */
770 { 0xff, 0xa0, 0x00 }, /* orange */
771 { 0x80, 0xe0, 0xe0 }, /* CadetBlue2, DarkSlateGray2 */
772 { 0xa0, 0xe0, 0xe0 }, /* pale turquoise */
773 { 0xa0, 0xff, 0x20 }, /* green yellow */
774 { 0xc0, 0x00, 0x00 }, /* red3 */
775 { 0xc0, 0x00, 0xc0 }, /* magenta3 */
776 { 0xa0, 0x20, 0x20 }, /* brown */
777 { 0xa0, 0x20, 0xff }, /* purple */
778 { 0x80, 0x20, 0x00 }, /* OrangeRed4 */
779 { 0x80, 0x20, 0x20 }, /* brown4 */
780 { 0x80, 0x40, 0x20 }, /* sienna4 */
781 { 0x80, 0x40, 0x80 }, /* orchid4 */
782 { 0x80, 0x60, 0xc0 }, /* MediumPurple3 */
783 { 0x80, 0x60, 0xff }, /* SlateBlue1 */
784 { 0x80, 0x80, 0x00 }, /* yellow4 */
785 { 0xc0, 0xc0, 0x00 }, /* yellow3 */
786 { 0xff, 0x80, 0x40 }, /* sienna1 */
787 { 0xff, 0xa0, 0x40 }, /* tan1 */
788 { 0xff, 0xa0, 0x60 }, /* sandy brown */
789 { 0xff, 0xa0, 0x70 }, /* light salmon */
790 { 0xff, 0xc0, 0xc0 }, /* RosyBrown1, pink */
791 { 0xff, 0xff, 0x00 }, /* yellow */
792 { 0xff, 0xff, 0x80 }, /* khaki1 */
793 { 0xff, 0xff, 0xc0 } /* lemon chiffon */
797 ** The plotting area is defined as a huge bitmap.
798 ** The bitmap is stored in a dynamically allocated pixel array b_p
800 ** The bitmap is allocated (and initialized to zero) with
801 ** b_makebitmap(xsize, ysize, planes)
802 ** and freed with b_freebitmap()
803 ** xsize and ysize will be rounded up to a multiple of 8.
805 ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
807 ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
808 ** where the point (x,y) is the target to go from the current point
809 ** To set the color use b_setvalue(value) where value is the value
810 ** (0 or 1 or a color number) to be stored in every pixel.
811 ** To get dotted line styles, use b_setlinetype(linetype).
813 ** Internally all plotting goes through b_setpixel(x, y, value).
817 /* bitmaps used for filled boxes style (ULIG) */
819 #define fill_bitmap_width 8
820 #define fill_bitmap_height 8
822 #define fill_halftone_num 5
823 static unsigned char fill_halftone_bitmaps[fill_halftone_num][8] ={
824 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* no fill */
825 { 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44 }, /* 25% pattern */
826 { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa }, /* 50% pattern */
827 { 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd }, /* 75% pattern */
828 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } /* solid pattern */
831 #define fill_pattern_num 8
832 static unsigned char fill_pattern_bitmaps[fill_pattern_num][8] ={
833 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } /* no fill */
834 ,{ 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x01 } /* cross-hatch (1) */
835 ,{ 0x88, 0x55, 0x22, 0x55, 0x88, 0x55, 0x22, 0x55 } /* double crosshatch(2) */
836 ,{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } /* solid fill (3) */
837 ,{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 } /* diagonal stripes (4) */
838 ,{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 } /* diagonal stripes (5) */
839 ,{ 0x11, 0x11, 0x22, 0x22, 0x44, 0x44, 0x88, 0x88 } /* diagonal stripes (6) */
840 ,{ 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11 } /* diagonal stripes (7) */
842 ,{ 0x03, 0x0C, 0x30, 0xC0, 0x03, 0x0C, 0x30, 0xC0 } /* diagonal stripes (8) */
843 ,{ 0xC0, 0x30, 0x0C, 0x03, 0xC0, 0x30, 0x0C, 0x03 } /* diagonal stripes (9) */
848 * set pixel (x, y, value) to value value (this can be 1/0 or a color number).
850 static GP_INLINE void
851 b_setpixel(unsigned int x, unsigned int y, unsigned int value)
858 /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
859 row = x; /* temp storage */
861 y = b_ysize - 1 - row;
863 if ((x < b_xsize) && (y < b_ysize)) {
867 for (i = 0; i < b_planes; i++) {
869 *((*b_p)[row] + x) |= mask;
871 *((*b_p)[row] + x) &= ~mask;
879 fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
880 b_ysize - 1 - y, x, value);
882 fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
890 * get pixel (x,y) value
893 b_getpixel(unsigned int x, unsigned int y)
897 unsigned short value=0; /* HBB 991123: initialize! */
905 if ((x < b_xsize) && (y < b_ysize)) {
906 row = y/8 + (b_planes-1)*b_psize;
909 for (i=0; i<b_planes; i++) {
910 if ( *((*b_p)[row]+x) & mask )
916 /* HBB 991123: the missing '>>1' was the 'every second color' problem
917 * with PNG in 3.8a...*/
922 fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
925 fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
933 * allocate the bitmap
936 b_makebitmap(unsigned int x, unsigned int y, unsigned int planes)
941 x = 8 * (unsigned int) (x / 8.0 + 0.9); /* round up to multiple of 8 */
942 y = 8 * (unsigned int) (y / 8.0 + 0.9); /* round up to multiple of 8 */
943 b_psize = y / 8; /* size of each plane */
944 rows = b_psize * planes; /* total number of rows of 8 pixels high */
947 b_currx = b_curry = 0;
952 /* allocate row pointers */
953 b_p = (bitmap *) gp_alloc(rows * sizeof(pixels *), "bitmap row buffer");
954 memset(b_p, 0, rows * sizeof(pixels *));
955 for (j = 0; j < rows; j++) {
956 /* allocate bitmap buffers */
957 (*b_p)[j] = (pixels *) gp_alloc(x * sizeof(pixels), (char *) NULL);
958 if ((*b_p)[j] == (pixels *) NULL) {
959 b_freebitmap(); /* free what we have already allocated */
960 int_error(NO_CARET, "out of memory for bitmap buffer");
962 memset((*b_p)[j], 0, x * sizeof(pixels));
968 * free the allocated bitmap
973 unsigned int j, rows;
975 rows = b_psize * b_planes; /* total number of rows of 8 pixels high */
976 for (j = 0; j < rows; j++) {
977 (void) free((char *) (*b_p)[j]);
979 (void) free((char *) b_p);
980 b_p = (bitmap *) (NULL);
985 * set pixel at (x,y) with color b_value and dotted mask b_linemask.
987 static GP_INLINE void
988 b_setmaskpixel(unsigned int x, unsigned int y, unsigned int value)
990 /* dotted line generator */
991 if ((b_linemask >> b_maskcount) & (unsigned int) (1)) {
992 b_setpixel(x, y, value);
994 b_maskcount = (b_maskcount + 1) % 16;
995 b_lastx = x; /* last pixel set with mask */
1001 * draw a line from (x1,y1) to (x2,y2)
1002 * with color b_value and dotted mask b_linemask.
1005 b_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)
1010 unsigned int xplot, yplot;
1013 dx = abs((int) (x1) - (int) (x2));
1020 dy = abs((int) (y1) - (int) (y2));
1031 if ((b_linemask == 0xffff) ||
1032 ((xplot != b_lastx) && (yplot != b_lasty)))
1033 b_setmaskpixel(xplot, yplot, b_value);
1034 while (xplot != x2) {
1037 if (runcount >= (dx - runcount)) {
1041 b_setmaskpixel(xplot, yplot, b_value);
1045 if ((b_linemask == 0xffff) ||
1046 ((xplot != b_lastx) && (yplot != b_lasty)))
1047 b_setmaskpixel(xplot, yplot, b_value);
1048 while (yplot != y2) {
1051 if (runcount >= (dy - runcount)) {
1055 b_setmaskpixel(xplot, yplot, b_value);
1062 * set character size
1065 b_charsize(unsigned int size)
1070 b_hchar = FNT5X9_HCHAR;
1071 b_hbits = FNT5X9_HBITS;
1072 b_vchar = FNT5X9_VCHAR;
1073 b_vbits = FNT5X9_VBITS;
1074 for (j = 0; j < FNT_CHARS; j++)
1075 b_font[j] = fnt5x9[j];
1078 b_hchar = FNT9X17_HCHAR;
1079 b_hbits = FNT9X17_HBITS;
1080 b_vchar = FNT9X17_VCHAR;
1081 b_vbits = FNT9X17_VBITS;
1082 for (j = 0; j < FNT_CHARS; j++)
1083 b_font[j] = fnt9x17[j];
1086 b_hchar = FNT13X25_HCHAR;
1087 b_hbits = FNT13X25_HBITS;
1088 b_vchar = FNT13X25_VCHAR;
1089 b_vbits = FNT13X25_VBITS;
1090 for (j = 0; j < FNT_CHARS; j++)
1091 b_font[j] = fnt13x25[j];
1094 int_error(NO_CARET, "Unknown character size");
1100 * put characater c at (x,y) rotated by angle with color b_value.
1103 void b_putc(unsigned int x, unsigned int y, int c, unsigned int c_angle)
1105 unsigned int i, j, k;
1111 return; /* unknown (top-bit-set ?) character */
1113 for (i = 0; i < b_vbits; i++) {
1115 if (c == '_') { /* treat underline specially */
1116 if (fc) { /* this this the underline row ? */
1117 /* draw the under line for the full h_char width */
1118 for (k = (b_hbits - b_hchar) / 2;
1119 k < (b_hbits + b_hchar) / 2; k++) {
1122 b_setpixel(x + k + 1, y + i, b_value);
1125 b_setpixel(x - i, y + k + 1, b_value);
1131 /* draw character */
1132 for (k = 0; k < b_hbits; k++) {
1133 if ((fc >> k) & 1) {
1136 b_setpixel(x + k + 1, y + i, b_value);
1139 b_setpixel(x - i, y + k + 1, b_value);
1150 ** set b_linemask to b_pattern[linetype]
1153 b_setlinetype(int linetype)
1157 b_linemask = b_pattern[linetype + 2];
1163 * set b_value to value
1166 b_setvalue(unsigned int value)
1176 b_move(unsigned int x, unsigned int y)
1184 * draw to (x,y) with color b_value
1187 b_vector(unsigned int x, unsigned int y)
1189 /* We can't clip properly, but we can refuse to draw out of bounds */
1190 if (x < term->xmax && y < term->ymax
1191 && b_currx < term->xmax && b_curry < term->ymax)
1192 b_line(b_currx, b_curry, x, y);
1199 * put text str at (x,y) with color b_value and rotation b_angle
1202 b_put_text(unsigned int x, unsigned int y, const char *str)
1210 for (; *str; ++str, x += b_hchar)
1211 b_putc(x, y, *str, b_angle);
1214 for (; *str; ++str, y += b_hchar)
1215 b_putc(x, y, *str, b_angle);
1222 b_text_angle(int ang)
1224 b_angle = (unsigned int) (ang ? 1 : 0);
1229 /* New function by ULIG */
1233 unsigned int x, unsigned int y,
1234 unsigned int w, unsigned int h)
1236 unsigned int ix, iy;
1237 int pixcolor, actpix, pat, mask, idx, bitoffs, shiftcnt;
1238 unsigned char *fillbitmap;
1240 switch( style & 0xf ) {
1242 /* use halftone fill pattern according to filldensity */
1243 /* filldensity is from 0..100 percent */
1244 idx = (int) ((style >> 4) * (fill_halftone_num - 1) / 100 );
1247 if( idx >= fill_halftone_num )
1248 idx = fill_halftone_num-1;
1249 fillbitmap = fill_halftone_bitmaps[idx];
1253 /* use fill pattern according to fillpattern */
1254 idx = (style >> 4); /* fillpattern is enumerated */
1257 idx %= fill_pattern_num;
1258 fillbitmap = fill_pattern_bitmaps[idx];
1263 /* fill with background color */
1264 fillbitmap = fill_halftone_bitmaps[0];
1268 /* this implements a primitive raster generator, which plots the */
1269 /* bitmaps point by point calling b_setpixel(). Perhaps someone */
1270 /* will implement a more efficient solution */
1273 for( iy = y; iy < y+h; iy ++ ) { /* box height */
1274 pat = fillbitmap[bitoffs % fill_bitmap_width];
1276 mask = 1 << (fill_bitmap_width - 1);
1278 for(ix = x; ix < x+w; ix ++) { /* box width */
1279 /* actual pixel = 0 or color, according to pattern */
1280 actpix = (pat & mask) ? pixcolor : 0;
1283 mask = 1 << (fill_bitmap_width - 1);
1285 b_setpixel(ix, iy, actpix);