diff options
Diffstat (limited to 'images.c')
-rw-r--r-- | images.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/images.c b/images.c new file mode 100644 index 0000000..888db6d --- /dev/null +++ b/images.c @@ -0,0 +1,60 @@ +/* Copyright 1998 DJ Delorie <dj@delorie.com> + Distributed under the terms of the GNU GPL + http://www.delorie.com/store/hcalc/ + Revisions copyright 2007, + Theodore Kilgore <kilgota@auburn.edu> + More revisions copyright 2023, B. Watson <urchlay@slackware.uk> +*/ +#include "hcalc.h" +#include <X11/xpm.h> + +#define xpm face0_data +#include "xpm/face.xpm" +#undef xpm +#define xpm face1_data +#include "xpm/face.250.xpm" +#undef xpm +#define xpm face2_data +#include "xpm/face.500.xpm" +#undef xpm + +#define xpm chars0_data +#include "xpm/chars.xpm" +#undef xpm +#define xpm chars1_data +#include "xpm/chars.250.xpm" +#undef xpm +#define xpm chars2_data +#include "xpm/chars.500.xpm" +#undef xpm + +static char **faces[3] = { face0_data, face1_data, face2_data }; +static char **charss[3] = { chars0_data, chars1_data, chars2_data }; +static int c_factors[3] = { 6, 12, 24 }; + +Pixmap face; +Pixmap chars; + +char charmap[] = " 0123456789ABCDEF-x,.ro+"; +int char_to_x[256]; + +void +load_pixmaps(void) +{ + int i, c; + + XpmAttributes attr; + attr.valuemask = 0; + XpmCreatePixmapFromData(display, window, faces[winsize], &face, 0, &attr); + XpmCreatePixmapFromData(display, window, charss[winsize], &chars, 0, &attr); + + for (i=0; i<256; i++) + { + char_to_x[i] = 0; + for (c=0; charmap[c]; c++) + if (charmap[c] == i) { + char_to_x[i] = c * c_factors[winsize]; + /* printf("char_to_x[%d] ('%c') = %d\n", i, i, c*C_FACTOR); */ + } + } +} |