1 |
#!/bin/sh |
2 |
# |
3 |
# @(#)ikon2xbm 1.4 91/05/06 |
4 |
# |
5 |
# Copyright (c) Steve Kinzler - March 1991. |
6 |
# |
7 |
# Permission is given to distribute these sources, as long as the |
8 |
# copyright messages are not removed, and no monies are exchanged. |
9 |
# |
10 |
# No responsibility is taken for any errors on inaccuracies inherent |
11 |
# either to the comments or the code of this program, but if reported |
12 |
# to me, then an attempt will be made to fix them. |
13 |
|
14 |
PATH=$PATH:/usr/bin/X11; export PATH |
15 |
|
16 |
# ikon2xbm - convert a square Blit ikon bitmap to an X11 bitmap |
17 |
# stdin/stdout filter |
18 |
# requires some bitmap filters from the pbmplus package |
19 |
# assumes 16 valid data bits per item, 1 depth bit, and width = height |
20 |
# kludge by kinzler@cs.indiana.edu |
21 |
|
22 |
tmp=/tmp/ikon2xbm$$ |
23 |
trap "rm -f $tmp; exit" 0 1 2 13 15 |
24 |
|
25 |
sed -e 's/\(0x....\),\(0x....\),\(0x....\),/\1\ |
26 |
\2\ |
27 |
\3/' > $tmp |
28 |
|
29 |
dim=`wc -l < $tmp | awk '{ print 4 * sqrt(144) }'` |
30 |
|
31 |
pr -l1 -t -8 -s, < $tmp | |
32 |
(cat << EOF |
33 |
/* Format_version=1, Width=$dim, Height=$dim, Depth=1, Valid_bits_per_item=16 |
34 |
*/ |
35 |
EOF |
36 |
sed -e 's/^/ /' -e 's/$/,/' -e '$s/,$//') | |
37 |
icontopbm | |
38 |
pbmtoxbm |