[BACK]Return to bitmap.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot

Annotation of OpenXM_contrib/gnuplot/bitmap.c, Revision 1.1

1.1     ! maekawa     1: #ifndef lint
        !             2: static char *RCSid = "$Id: bitmap.c,v 1.16 1998/03/22 22:31:19 drd Exp $";
        !             3: #endif
        !             4:
        !             5: /* GNUPLOT - bitmap.c */
        !             6:
        !             7: /*[
        !             8:  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
        !             9:  *
        !            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.
        !            15:  *
        !            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,
        !            20:  * provided you
        !            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
        !            28:  *    software.
        !            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.
        !            32:  *
        !            33:  * This software is provided "as is" without express or implied warranty
        !            34:  * to the extent permitted by applicable law.
        !            35: ]*/
        !            36:
        !            37:
        !            38: /*
        !            39:  * AUTHORS
        !            40:  *
        !            41:  *   Original Software:
        !            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>
        !            45:  */
        !            46:
        !            47:
        !            48: /*
        !            49:    ** General raster plotting routines.
        !            50:    ** Raster routines written and copyrighted 1987 by
        !            51:    ** Jyrki Yli-Nokari (jty@intrin.UUCP)
        !            52:    ** Intrinsic, Ltd.
        !            53:    **
        !            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.
        !            57:    **
        !            58:  */
        !            59:
        !            60: /* Bitmap plotting routines derived from above raster plotting routines
        !            61:  * Russell Lang, 1990
        !            62:  */
        !            63:
        !            64: #include "plot.h"
        !            65: #include "bitmap.h"
        !            66:
        !            67: /* forward decls */
        !            68:
        !            69: static void b_putc __PROTO((unsigned int, unsigned int, int, unsigned int));
        !            70:
        !            71: bitmap *b_p = (bitmap *) NULL; /* global pointer to bitmap */
        !            72: unsigned int b_currx, b_curry; /* the current coordinates */
        !            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_value = 1;      /* colour of lines */
        !            79: unsigned int b_hchar;          /* width of characters */
        !            80: unsigned int b_hbits;          /* actual bits in char horizontally */
        !            81: unsigned int b_vchar;          /* height of characters */
        !            82: unsigned int b_vbits;          /* actual bits in char vertically */
        !            83: unsigned int b_angle;          /* rotation of text */
        !            84: char_box b_font[FNT_CHARS];    /* the current font */
        !            85: unsigned int b_pattern[] =
        !            86: {0xffff, 0x1111,
        !            87:  0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
        !            88: int b_maskcount = 0;
        !            89: unsigned int b_lastx, b_lasty; /* last pixel set - used by b_line */
        !            90:
        !            91: #define IN(i,size)  ((unsigned)i < (unsigned)size)
        !            92:
        !            93: /* 5x9 font, bottom row first, left pixel in lsb */
        !            94: char_row GPFAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
        !            95:   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
        !            96:   /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
        !            97:   /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
        !            98:   /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
        !            99:   /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
        !           100:   /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
        !           101:   /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
        !           102:   /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
        !           103:   /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
        !           104:   /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
        !           105:   /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
        !           106:   /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
        !           107:   /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
        !           108:   /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
        !           109:   /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
        !           110:   /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
        !           111:   /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
        !           112:   /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
        !           113:   /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
        !           114:   /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
        !           115:   /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
        !           116:   /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
        !           117:   /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
        !           118:   /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
        !           119:   /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
        !           120:   /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
        !           121:   /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
        !           122:   /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
        !           123:   /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
        !           124:   /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
        !           125:   /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
        !           126:   /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
        !           127:   /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
        !           128:   /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
        !           129:   /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
        !           130:   /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
        !           131:   /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
        !           132:   /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
        !           133:   /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
        !           134:   /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
        !           135:   /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
        !           136:   /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
        !           137:   /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
        !           138:   /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
        !           139:   /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
        !           140:   /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
        !           141:   /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
        !           142:   /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
        !           143:   /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
        !           144:   /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
        !           145:   /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
        !           146:   /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
        !           147:   /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
        !           148:   /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
        !           149:   /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
        !           150:   /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
        !           151:   /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
        !           152:   /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
        !           153:   /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
        !           154:   /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
        !           155:   /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
        !           156:   /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
        !           157:   /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
        !           158:   /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
        !           159:   /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
        !           160:   /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
        !           161:   /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
        !           162:   /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
        !           163:   /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
        !           164:   /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
        !           165:   /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
        !           166:   /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
        !           167:   /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
        !           168:   /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
        !           169:   /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
        !           170:   /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
        !           171:   /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
        !           172:   /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
        !           173:   /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
        !           174:   /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
        !           175:   /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
        !           176:   /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
        !           177:   /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
        !           178:   /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
        !           179:   /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
        !           180:   /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
        !           181:   /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
        !           182:   /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
        !           183:   /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
        !           184:   /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
        !           185:   /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
        !           186:   /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
        !           187:   /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
        !           188:   /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
        !           189:   /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
        !           190:   /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
        !           191: };
        !           192:
        !           193: /* 9x17 font, bottom row first, left pixel in lsb */
        !           194: char_row GPFAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
        !           195:   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           196:           000000,000000,000000,000000,000000,000000,000000,000000},
        !           197:   /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
        !           198:           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
        !           199:   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           200:           000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
        !           201:   /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
        !           202:           0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
        !           203:   /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
        !           204:           0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
        !           205:   /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
        !           206:           0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
        !           207:   /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
        !           208:           0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
        !           209:   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           210:           000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
        !           211:   /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
        !           212:           0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
        !           213:   /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
        !           214:           0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
        !           215:   /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
        !           216:           0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
        !           217:   /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
        !           218:           0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
        !           219:   /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
        !           220:           000000,000000,000000,000000,000000,000000,000000,000000},
        !           221:   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           222:           000000,0x01ff,000000,000000,000000,000000,000000,000000},
        !           223:   /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
        !           224:           000000,000000,000000,000000,000000,000000,000000,000000},
        !           225:   /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
        !           226:           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
        !           227:   /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
        !           228:           0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
        !           229:   /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
        !           230:           0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
        !           231:   /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
        !           232:           0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
        !           233:   /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
        !           234:           0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
        !           235:   /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
        !           236:           0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
        !           237:   /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
        !           238:           0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
        !           239:   /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
        !           240:           0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
        !           241:   /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
        !           242:           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
        !           243:   /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
        !           244:           0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
        !           245:   /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
        !           246:           0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
        !           247:   /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
        !           248:           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
        !           249:   /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
        !           250:           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
        !           251:   /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
        !           252:           0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
        !           253:   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
        !           254:           000000,000000,000000,0x01ff,000000,000000,000000,000000},
        !           255:   /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
        !           256:           0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
        !           257:   /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
        !           258:           0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
        !           259:   /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
        !           260:           0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
        !           261:   /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
        !           262:           0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
        !           263:   /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
        !           264:           0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
        !           265:   /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
        !           266:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
        !           267:   /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
        !           268:           0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
        !           269:   /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
        !           270:           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
        !           271:   /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
        !           272:           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
        !           273:   /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
        !           274:           0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
        !           275:   /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
        !           276:           0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
        !           277:   /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
        !           278:           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
        !           279:   /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
        !           280:           0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
        !           281:   /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
        !           282:           0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
        !           283:   /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
        !           284:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
        !           285:   /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
        !           286:           0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
        !           287:   /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
        !           288:           0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
        !           289:   /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
        !           290:           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
        !           291:   /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
        !           292:           0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
        !           293:   /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
        !           294:           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
        !           295:   /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
        !           296:           0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
        !           297:   /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
        !           298:           0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
        !           299:   /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
        !           300:           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
        !           301:   /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
        !           302:           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
        !           303:   /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
        !           304:           0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
        !           305:   /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
        !           306:           0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
        !           307:   /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
        !           308:           0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
        !           309:   /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
        !           310:           0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
        !           311:   /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
        !           312:           0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
        !           313:   /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
        !           314:           0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
        !           315:   /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
        !           316:           0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
        !           317:   /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
        !           318:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
        !           319:   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           320:           000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
        !           321:   /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
        !           322:           000000,000000,000000,000000,000000,000000,000000,000000},
        !           323:   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           324:           000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
        !           325:   /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
        !           326:           0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
        !           327:   /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
        !           328:           0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
        !           329:   /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
        !           330:           0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
        !           331:   /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
        !           332:           0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
        !           333:   /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
        !           334:           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
        !           335:   /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
        !           336:           0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
        !           337:   /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
        !           338:           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
        !           339:   /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
        !           340:           0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
        !           341:   /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
        !           342:           0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
        !           343:   /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
        !           344:           0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
        !           345:   /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
        !           346:           0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
        !           347:   /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
        !           348:           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
        !           349:   /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
        !           350:           0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
        !           351:   /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
        !           352:           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
        !           353:   /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
        !           354:           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
        !           355:   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
        !           356:           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
        !           357:   /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
        !           358:           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
        !           359:   /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
        !           360:           0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
        !           361:   /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
        !           362:           0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
        !           363:   /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
        !           364:           0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
        !           365:   /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
        !           366:           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
        !           367:   /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
        !           368:           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
        !           369:   /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
        !           370:           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
        !           371:   /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
        !           372:           0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
        !           373:   /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
        !           374:           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
        !           375:   /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
        !           376:           0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
        !           377:   /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
        !           378:           0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
        !           379:   /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
        !           380:           000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
        !           381:   /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
        !           382:           0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
        !           383:   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           384:           000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
        !           385:   /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
        !           386:           000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
        !           387: };
        !           388:
        !           389: /* 13x25 font, bottom row first, left pixel in lsb */
        !           390: char_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
        !           391:   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           392:           000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           393:           000000,000000,000000,000000,000000,000000,000000},
        !           394:   /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
        !           395:           000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
        !           396:           0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
        !           397:   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           398:           000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           399:           0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
        !           400:   /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
        !           401:           0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
        !           402:           0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
        !           403:   /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
        !           404:           0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
        !           405:           0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
        !           406:   /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
        !           407:           0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
        !           408:           0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
        !           409:   /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
        !           410:           0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
        !           411:           0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
        !           412:   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           413:           000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
        !           414:           0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
        !           415:   /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
        !           416:           0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
        !           417:           0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
        !           418:   /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
        !           419:           0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
        !           420:           0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
        !           421:   /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
        !           422:           0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
        !           423:           0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
        !           424:   /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           425:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
        !           426:           0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
        !           427:   /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
        !           428:           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
        !           429:           000000,000000,000000,000000,000000,000000,000000},
        !           430:   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           431:           000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
        !           432:           000000,000000,000000,000000,000000,000000,000000},
        !           433:   /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
        !           434:           0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
        !           435:           000000,000000,000000,000000,000000,000000,000000},
        !           436:   /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
        !           437:           0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
        !           438:           0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
        !           439:   /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           440:           0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
        !           441:           0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
        !           442:   /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
        !           443:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
        !           444:           0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
        !           445:   /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
        !           446:           0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
        !           447:           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
        !           448:   /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           449:           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
        !           450:           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
        !           451:   /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
        !           452:           0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
        !           453:           0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
        !           454:   /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           455:           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
        !           456:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
        !           457:   /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           458:           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
        !           459:           0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
        !           460:   /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
        !           461:           0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
        !           462:           0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
        !           463:   /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           464:           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
        !           465:           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
        !           466:   /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
        !           467:           0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
        !           468:           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
        !           469:   /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
        !           470:           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
        !           471:           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
        !           472:   /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
        !           473:           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
        !           474:           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
        !           475:   /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
        !           476:           0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
        !           477:           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
        !           478:   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           479:           000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
        !           480:           0x1fff,000000,000000,000000,000000,000000,000000},
        !           481:   /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
        !           482:           0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
        !           483:           0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
        !           484:   /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
        !           485:           000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
        !           486:           0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
        !           487:   /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
        !           488:           0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
        !           489:           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
        !           490:   /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           491:           0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
        !           492:           0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
        !           493:   /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
        !           494:           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
        !           495:           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
        !           496:   /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           497:           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
        !           498:           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
        !           499:   /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
        !           500:           0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
        !           501:           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
        !           502:   /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
        !           503:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
        !           504:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
        !           505:   /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
        !           506:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
        !           507:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
        !           508:   /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
        !           509:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
        !           510:           0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
        !           511:   /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           512:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
        !           513:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
        !           514:   /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
        !           515:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
        !           516:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
        !           517:   /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           518:           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
        !           519:           0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
        !           520:   /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
        !           521:           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
        !           522:           0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
        !           523:   /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
        !           524:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
        !           525:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
        !           526:   /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           527:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
        !           528:           0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
        !           529:   /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           530:           0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
        !           531:           0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
        !           532:   /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           533:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           534:           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
        !           535:   /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
        !           536:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
        !           537:           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
        !           538:   /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
        !           539:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           540:           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
        !           541:   /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
        !           542:           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
        !           543:           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
        !           544:   /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           545:           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
        !           546:           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
        !           547:   /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
        !           548:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
        !           549:           0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
        !           550:   /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           551:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           552:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
        !           553:   /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
        !           554:           0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
        !           555:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
        !           556:   /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
        !           557:           0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
        !           558:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
        !           559:   /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           560:           0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
        !           561:           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
        !           562:   /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
        !           563:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
        !           564:           0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
        !           565:   /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
        !           566:           0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
        !           567:           0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
        !           568:   /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
        !           569:           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
        !           570:           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
        !           571:   /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
        !           572:           0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
        !           573:           0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
        !           574:   /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
        !           575:           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
        !           576:           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
        !           577:   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           578:           000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           579:           0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
        !           580:   /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
        !           581:           000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           582:           000000,000000,000000,000000,000000,000000,000000},
        !           583:   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           584:           000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
        !           585:           0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
        !           586:   /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
        !           587:           0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
        !           588:           0x03f8,000000,000000,000000,000000,000000,000000},
        !           589:   /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
        !           590:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
        !           591:           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
        !           592:   /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           593:           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
        !           594:           0x03f8,000000,000000,000000,000000,000000,000000},
        !           595:   /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
        !           596:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
        !           597:           0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
        !           598:   /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
        !           599:           0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
        !           600:           0x03f8,000000,000000,000000,000000,000000,000000},
        !           601:   /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
        !           602:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
        !           603:           0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
        !           604:   /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
        !           605:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
        !           606:           0x13f8,000000,000000,000000,000000,000000,000000},
        !           607:   /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           608:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
        !           609:           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
        !           610:   /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
        !           611:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
        !           612:           000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
        !           613:   /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
        !           614:           0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
        !           615:           000000,000000,000000,0x0700,0x0700,0x0700,000000},
        !           616:   /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
        !           617:           0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
        !           618:           0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
        !           619:   /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
        !           620:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
        !           621:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
        !           622:   /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
        !           623:           0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
        !           624:           0x0209,000000,000000,000000,000000,000000,000000},
        !           625:   /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
        !           626:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
        !           627:           0x03f9,000000,000000,000000,000000,000000,000000},
        !           628:   /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
        !           629:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
        !           630:           0x03f8,000000,000000,000000,000000,000000,000000},
        !           631:   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
        !           632:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
        !           633:           0x03f9,000000,000000,000000,000000,000000,000000},
        !           634:   /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
        !           635:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
        !           636:           0x13f8,000000,000000,000000,000000,000000,000000},
        !           637:   /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
        !           638:           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
        !           639:           0x03f9,000000,000000,000000,000000,000000,000000},
        !           640:   /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
        !           641:           0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
        !           642:           0x07f8,000000,000000,000000,000000,000000,000000},
        !           643:   /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
        !           644:           0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
        !           645:           0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
        !           646:   /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
        !           647:           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           648:           0x1001,000000,000000,000000,000000,000000,000000},
        !           649:   /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
        !           650:           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           651:           0x1001,000000,000000,000000,000000,000000,000000},
        !           652:   /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
        !           653:           0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           654:           0x1001,000000,000000,000000,000000,000000,000000},
        !           655:   /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
        !           656:           0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
        !           657:           0x1001,000000,000000,000000,000000,000000,000000},
        !           658:   /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
        !           659:           0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
        !           660:           0x1001,000000,000000,000000,000000,000000,000000},
        !           661:   /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
        !           662:           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
        !           663:           0x1fff,000000,000000,000000,000000,000000,000000},
        !           664:   /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
        !           665:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
        !           666:           0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
        !           667:   /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
        !           668:           0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
        !           669:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
        !           670:   /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
        !           671:           0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
        !           672:           0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
        !           673:   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           674:           000000,000000,000000,000000,000000,000000,000000,000000,000000,
        !           675:           0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
        !           676:   /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
        !           677:           0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
        !           678:           0x1249,000000,000000,0x1249,000000,000000,0x1249},
        !           679: };
        !           680:
        !           681:
        !           682: /*
        !           683:    ** The plotting area is defined as a huge bitmap.
        !           684:    ** The bitmap is stored in a dynamically allocated pixel array b_p
        !           685:    **
        !           686:    ** The bitmap is allocated (and initialized to zero) with
        !           687:    ** b_makebitmap(xsize, ysize, planes)
        !           688:    ** and freed with b_freebitmap()
        !           689:    ** xsize and ysize will be rounded up to a multiple of 8.
        !           690:    **
        !           691:    ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
        !           692:    **
        !           693:    ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
        !           694:    ** where the point (x,y) is the target to go from the current point
        !           695:    ** To set the color use b_setvalue(value) where value is the value
        !           696:    ** (0 or 1 or a color number) to be stored in every pixel.
        !           697:    ** To get dotted line styles, use b_setlinetype(linetype).
        !           698:    **
        !           699:    ** Internally all plotting goes through b_setpixel(x, y, value).
        !           700:  */
        !           701:
        !           702:
        !           703: /*
        !           704:  * set pixel (x, y, value) to value value (this can be 1/0 or a color number).
        !           705:  */
        !           706: void b_setpixel(x, y, value)
        !           707: unsigned int x, y, value;
        !           708: {
        !           709:     register unsigned int row;
        !           710:     register unsigned char mask;
        !           711:     unsigned int i;
        !           712:
        !           713:     if (b_rastermode) {
        !           714:        /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
        !           715:        row = x;                /* temp storage */
        !           716:        x = y;
        !           717:        y = b_ysize - 1 - row;
        !           718:     }
        !           719:     if (IN(x, b_xsize) && IN(y, b_ysize)) {
        !           720:        row = y / 8;
        !           721:        mask = 1 << (y % 8);
        !           722:
        !           723:        for (i = 0; i < b_planes; i++) {
        !           724:            if (value & 1)
        !           725:                *((*b_p)[row] + x) |= mask;
        !           726:            else
        !           727:                *((*b_p)[row] + x) &= ~mask;
        !           728:            row += b_psize;
        !           729:            value >>= 1;
        !           730:        }
        !           731:     }
        !           732: #ifdef BITMAPDEBUG
        !           733:     else {
        !           734:        if (b_rastermode)
        !           735:            fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
        !           736:                    b_ysize - 1 - y, x, value);
        !           737:        else
        !           738:            fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
        !           739:                    x, y, value);
        !           740:     }
        !           741: #endif
        !           742: }
        !           743:
        !           744:
        !           745: /* Currently unused */
        !           746: #if 0
        !           747: /*
        !           748:  * get pixel (x,y) value
        !           749:  */
        !           750: unsigned int
        !           751: b_getpixel(x, y)
        !           752: unsigned int x, y;
        !           753: {
        !           754:   register unsigned int row;
        !           755:   register unsigned char mask;
        !           756:   register unsigned char value;
        !           757:   int i;
        !           758:
        !           759:   if (b_rastermode) {
        !           760:        row = x;
        !           761:        x = y;
        !           762:        y = b_ysize-1-row;
        !           763:   }
        !           764:   if (IN(x, b_xsize) && IN(y, b_ysize))
        !           765:   {
        !           766:     row = y/8 + (b_planes-1)*b_psize;
        !           767:     mask = 1<<(y%8);
        !           768:
        !           769:        for (i=0; i<b_planes; i++) {
        !           770:                if ( *((*b_p)[row]+x) & mask )
        !           771:                        value |= 1;
        !           772:                row -= b_psize;
        !           773:                value <<= 1;
        !           774:        }
        !           775:     return(value);
        !           776:   }
        !           777:   else
        !           778:   {
        !           779: #ifdef BITMAPDEBUG
        !           780:     if (b_rastermode)
        !           781:       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
        !           782:                b_ysize-1-y, x);
        !           783:     else
        !           784:       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
        !           785: #endif
        !           786:     return(0);
        !           787:   }
        !           788: }
        !           789: #endif /* 0 */
        !           790:
        !           791:
        !           792: /*
        !           793:  * allocate the bitmap
        !           794:  */
        !           795: void b_makebitmap(x, y, planes)
        !           796: unsigned int x, y, planes;
        !           797: {
        !           798:     register unsigned j;
        !           799:     unsigned rows;
        !           800:
        !           801:     x = 8 * (unsigned int) (x / 8.0 + 0.9);    /* round up to multiple of 8 */
        !           802:     y = 8 * (unsigned int) (y / 8.0 + 0.9);    /* round up to multiple of 8 */
        !           803:     b_psize = y / 8;           /* size of each plane */
        !           804:     rows = b_psize * planes;   /* total number of rows of 8 pixels high */
        !           805:     b_xsize = x;
        !           806:     b_ysize = y;
        !           807:     b_currx = b_curry = 0;
        !           808:     b_planes = planes;
        !           809:     b_value = 1;
        !           810:     b_angle = 0;
        !           811:     b_rastermode = 0;
        !           812:     /* allocate row pointers */
        !           813:     b_p = (bitmap *) gp_alloc((unsigned long) rows * sizeof(pixels *), "bitmap row buffer");
        !           814:     memset(b_p, 0, rows * sizeof(pixels *));
        !           815:     for (j = 0; j < rows; j++) {
        !           816:        /* allocate bitmap buffers */
        !           817:        (*b_p)[j] = (pixels *) gp_alloc((unsigned long) x * sizeof(pixels), (char *) NULL);
        !           818:        if ((*b_p)[j] == (pixels *) NULL) {
        !           819:            b_freebitmap();     /* free what we have already allocated */
        !           820:            int_error("out of memory for bitmap buffer", NO_CARET);
        !           821:        }
        !           822:        memset((*b_p)[j], 0, x * sizeof(pixels));
        !           823:     }
        !           824: }
        !           825:
        !           826:
        !           827: /*
        !           828:  * free the allocated bitmap
        !           829:  */
        !           830: void b_freebitmap()
        !           831: {
        !           832:     unsigned int j, rows;
        !           833:
        !           834:     rows = b_psize * b_planes; /* total number of rows of 8 pixels high */
        !           835:     for (j = 0; j < rows; j++) {
        !           836:        (void) free((char *) (*b_p)[j]);
        !           837:     }
        !           838:     (void) free((char *) b_p);
        !           839:     b_p = (bitmap *) (NULL);
        !           840: }
        !           841:
        !           842:
        !           843: /*
        !           844:  * set pixel at (x,y) with color b_value and dotted mask b_linemask.
        !           845:  */
        !           846: void b_setmaskpixel(x, y, value)
        !           847: unsigned int x, y, value;
        !           848: {
        !           849:     /* dotted line generator */
        !           850:     if ((b_linemask >> b_maskcount) & (unsigned int) (1)) {
        !           851:        b_setpixel(x, y, value);
        !           852:     }
        !           853:     b_maskcount = (b_maskcount + 1) % 16;
        !           854:     b_lastx = x;               /* last pixel set with mask */
        !           855:     b_lasty = y;
        !           856: }
        !           857:
        !           858:
        !           859: /*
        !           860:  * draw a line from (x1,y1) to (x2,y2)
        !           861:  * with color b_value and dotted mask b_linemask.
        !           862:  */
        !           863: void b_line(x1, y1, x2, y2)
        !           864: unsigned int x1, y1, x2, y2;
        !           865: {
        !           866:     int runcount;
        !           867:     int dx, dy;
        !           868:     int xinc, yinc;
        !           869:     unsigned int xplot, yplot;
        !           870:
        !           871:     runcount = 0;
        !           872:     dx = abs((int) (x1) - (int) (x2));
        !           873:     if (x2 > x1)
        !           874:        xinc = 1;
        !           875:     else if (x2 == x1)
        !           876:        xinc = 0;
        !           877:     else
        !           878:        xinc = -1;
        !           879:     dy = abs((int) (y1) - (int) (y2));
        !           880:     if (y2 > y1)
        !           881:        yinc = 1;
        !           882:     else if (y2 == y1)
        !           883:        yinc = 0;
        !           884:     else
        !           885:        yinc = -1;
        !           886:     xplot = x1;
        !           887:     yplot = y1;
        !           888:     if (dx > dy) {
        !           889:        /* iterate x */
        !           890:        if ((b_linemask == 0xffff) ||
        !           891:            ((xplot != b_lastx) && (yplot != b_lasty)))
        !           892:            b_setmaskpixel(xplot, yplot, b_value);
        !           893:        while (xplot != x2) {
        !           894:            xplot += xinc;
        !           895:            runcount += dy;
        !           896:            if (runcount >= (dx - runcount)) {
        !           897:                yplot += yinc;
        !           898:                runcount -= dx;
        !           899:            }
        !           900:            b_setmaskpixel(xplot, yplot, b_value);
        !           901:        }
        !           902:     } else {
        !           903:        /* iterate y */
        !           904:        if ((b_linemask == 0xffff) ||
        !           905:            ((xplot != b_lastx) && (yplot != b_lasty)))
        !           906:            b_setmaskpixel(xplot, yplot, b_value);
        !           907:        while (yplot != y2) {
        !           908:            yplot += yinc;
        !           909:            runcount += dx;
        !           910:            if (runcount >= (dy - runcount)) {
        !           911:                xplot += xinc;
        !           912:                runcount -= dy;
        !           913:            }
        !           914:            b_setmaskpixel(xplot, yplot, b_value);
        !           915:        }
        !           916:     }
        !           917: }
        !           918:
        !           919:
        !           920: /*
        !           921:  * set character size
        !           922:  */
        !           923: void b_charsize(size)
        !           924: unsigned int size;
        !           925: {
        !           926:     int j;
        !           927:     switch (size) {
        !           928:     case FNT5X9:
        !           929:        b_hchar = FNT5X9_HCHAR;
        !           930:        b_hbits = FNT5X9_HBITS;
        !           931:        b_vchar = FNT5X9_VCHAR;
        !           932:        b_vbits = FNT5X9_VBITS;
        !           933:        for (j = 0; j < FNT_CHARS; j++)
        !           934:            b_font[j] = &fnt5x9[j][0];
        !           935:        break;
        !           936:     case FNT9X17:
        !           937:        b_hchar = FNT9X17_HCHAR;
        !           938:        b_hbits = FNT9X17_HBITS;
        !           939:        b_vchar = FNT9X17_VCHAR;
        !           940:        b_vbits = FNT9X17_VBITS;
        !           941:        for (j = 0; j < FNT_CHARS; j++)
        !           942:            b_font[j] = &fnt9x17[j][0];
        !           943:        break;
        !           944:     case FNT13X25:
        !           945:        b_hchar = FNT13X25_HCHAR;
        !           946:        b_hbits = FNT13X25_HBITS;
        !           947:        b_vchar = FNT13X25_VCHAR;
        !           948:        b_vbits = FNT13X25_VBITS;
        !           949:        for (j = 0; j < FNT_CHARS; j++)
        !           950:            b_font[j] = &fnt13x25[j][0];
        !           951:        break;
        !           952:     default:
        !           953:        int_error("Unknown character size", NO_CARET);
        !           954:     }
        !           955: }
        !           956:
        !           957:
        !           958: /*
        !           959:  * put characater c at (x,y) rotated by angle with color b_value.
        !           960:  */
        !           961: static void b_putc(x, y, c, c_angle)
        !           962: unsigned int x, y;
        !           963: int c;
        !           964: unsigned int c_angle;
        !           965: {
        !           966:     unsigned int i, j, k;
        !           967:     char_row fc;
        !           968:
        !           969:     j = c - ' ';
        !           970:
        !           971:     if (j >= FNT_CHARS)
        !           972:        return;                 /* unknown (top-bit-set ?) character */
        !           973:
        !           974:     for (i = 0; i < b_vbits; i++) {
        !           975:        fc = *(b_font[j] + i);
        !           976:        if (c == '_') {         /* treat underline specially */
        !           977:            if (fc) {           /* this this the underline row ? */
        !           978:                /* draw the under line for the full h_char width */
        !           979:                for (k = (b_hbits - b_hchar) / 2;
        !           980:                     k < (b_hbits + b_hchar) / 2; k++) {
        !           981:                    switch (c_angle) {
        !           982:                    case 0:
        !           983:                        b_setpixel(x + k + 1, y + i, b_value);
        !           984:                        break;
        !           985:                    case 1:
        !           986:                        b_setpixel(x - i, y + k + 1, b_value);
        !           987:                        break;
        !           988:                    }
        !           989:                }
        !           990:            }
        !           991:        } else {
        !           992:            /* draw character */
        !           993:            for (k = 0; k < b_hbits; k++) {
        !           994:                if ((fc >> k) & 1) {
        !           995:                    switch (c_angle) {
        !           996:                    case 0:
        !           997:                        b_setpixel(x + k + 1, y + i, b_value);
        !           998:                        break;
        !           999:                    case 1:
        !          1000:                        b_setpixel(x - i, y + k + 1, b_value);
        !          1001:                        break;
        !          1002:                    }
        !          1003:                }
        !          1004:            }
        !          1005:        }
        !          1006:     }
        !          1007: }
        !          1008:
        !          1009:
        !          1010: /*
        !          1011:    ** set b_linemask to b_pattern[linetype]
        !          1012:  */
        !          1013: void b_setlinetype(linetype)
        !          1014: int linetype;
        !          1015: {
        !          1016:     if (linetype >= 7)
        !          1017:        linetype %= 7;
        !          1018:     b_linemask = b_pattern[linetype + 2];
        !          1019:     b_maskcount = 0;
        !          1020: }
        !          1021:
        !          1022:
        !          1023: /*
        !          1024:  * set b_value to value
        !          1025:  */
        !          1026: void b_setvalue(value)
        !          1027: unsigned int value;
        !          1028: {
        !          1029:     b_value = value;
        !          1030: }
        !          1031:
        !          1032:
        !          1033: /*
        !          1034:  * move to (x,y)
        !          1035:  */
        !          1036: void b_move(x, y)
        !          1037: unsigned int x, y;
        !          1038: {
        !          1039:     b_currx = x;
        !          1040:     b_curry = y;
        !          1041: }
        !          1042:
        !          1043:
        !          1044: /*
        !          1045:  * draw to (x,y) with color b_value
        !          1046:  */
        !          1047: void b_vector(x, y)
        !          1048: unsigned int x, y;
        !          1049: {
        !          1050:     b_line(b_currx, b_curry, x, y);
        !          1051:     b_currx = x;
        !          1052:     b_curry = y;
        !          1053: }
        !          1054:
        !          1055:
        !          1056: /*
        !          1057:  * put text str at (x,y) with color b_value and rotation b_angle
        !          1058:  */
        !          1059: void b_put_text(x, y, str)
        !          1060: unsigned int x, y;
        !          1061: char *str;
        !          1062: {
        !          1063:     if (b_angle == 1)
        !          1064:        x += b_vchar / 2;
        !          1065:     else
        !          1066:        y -= b_vchar / 2;
        !          1067:     switch (b_angle) {
        !          1068:     case 0:
        !          1069:        for (; *str; ++str, x += b_hchar)
        !          1070:            b_putc(x, y, *str, b_angle);
        !          1071:        break;
        !          1072:     case 1:
        !          1073:        for (; *str; ++str, y += b_hchar)
        !          1074:            b_putc(x, y, *str, b_angle);
        !          1075:        break;
        !          1076:     }
        !          1077: }
        !          1078:
        !          1079:
        !          1080: int b_text_angle(ang)
        !          1081: int ang;
        !          1082: {
        !          1083:     b_angle = (unsigned int) ang;
        !          1084:     return TRUE;
        !          1085: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>