Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bitmap chopping
- To: crossfire (at) ifi.uio.no
- Subject: Re: Bitmap chopping
- From: Frank Tore Johansen <frankj>
- Date: Sun, 22 Nov 1992 18:03:57 +0100
- In-Reply-To: <>; from "Andreas Bringedal" at Nov 22, 92 5:51 pm
> I think Frank have such a program...Am I wrong Frank ?!?
Kjetil () made one. It has proven very useful when
creating large monsters.
Of course, if you want to edit the archetype-file yourself, there are some
undocumented features you will have to figure out, like giving the
archetypes of the different parts different x & y coordinates.
---------------------->8---Cut_Here---8<--------------------------------------
#!/bin/sh -
usage() {
echo "Usage: $0 [-w <pixels>] [-h <pixels> ] [-] <bitmapfile> ..."
exit 1
}
w=24
h=24
workfile=/tmp/splitxbm.$$.xbm
while [ ! $# = 0 ]; do
case "$1" in
-w)
case "$2" in
[0-9]*)
w="$2"
shift
;;
*)
usage
esac
;;
-h)
case "$2" in
[0-9]*)
h="$2"
shift
;;
*)
usage
esac
;;
-)
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
for file in $*; do
xbmtopbm $file > $workfile
width=`sed -e 1d -e '2s/ .*//' -e '3,$d' $workfile`
height=`sed -e 1d -e '2s/[0-9]* //' -e '3,$d' $workfile`
echo Input bitmap $file is $width"x"$height
numeral=0
y=0
while [ $y -lt $height ]; do
x=0
while [ $x -lt $width ]; do
numeral=`expr $numeral + 1`
pnmcut $x $y $w $h $workfile | pbmtoxbm > $file.$numeral
x=`expr $x + $w`
done
y=`expr $y + $h`
done
echo Wrote $numeral $w"x"$h bitmaps.
done
rm -f $workfile