* configure (use_xface): ask * fm.h (_Buffer): add header_source * buffer.c (reshapeBuffer): fix reshape when reading stdin with image fix disappearing header when reading stdin * file.c (xface2xbm): check file existence * file.c (readHeader): save to tmp file X-Face when activeImage & displayImage * main.c (dispI): comment out checking content type * main.c (stopI): ditto * scripts/xface2xbm.in: update compface URL read from file $XF write to file $XBM From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
64 lines
939 B
Plaintext
64 lines
939 B
Plaintext
#!@PERL@
|
|
|
|
# compface/uncompface
|
|
# ftp://metalab.unc.edu/pub/Linux/apps/graphics/convert/
|
|
$UNCOMPFACE = "uncompface";
|
|
|
|
$XF = @ARGV ? shift @ARGV : '-';
|
|
$XBM = @ARGV ? shift @ARGV : '-';
|
|
|
|
open(XF, "<$XF");
|
|
$xf = "";
|
|
while(<XF>) {
|
|
# s/^X-Face://i if ($xf eq "");
|
|
$xf .= $_;
|
|
}
|
|
close(XF);
|
|
|
|
pipe(R, W2);
|
|
pipe(R2, W);
|
|
if (! fork()) {
|
|
close(R);
|
|
close(W);
|
|
open(STDIN, "<&R2");
|
|
open(STDOUT, ">&W2");
|
|
exec $UNCOMPFACE;
|
|
exit 1;
|
|
}
|
|
close(R2);
|
|
close(W2);
|
|
print W $xf;
|
|
close(W);
|
|
while(<R>) {
|
|
while(s/0x(..)(..)//) {
|
|
push(@bm, hex($1), hex($2));
|
|
}
|
|
}
|
|
close(R);
|
|
@bm || exit 1;
|
|
|
|
$W = 48;
|
|
$H = @bm * 8 / $W; # must be 48
|
|
open(XBM, ">$XBM");
|
|
print XBM <<EOF;
|
|
#define xf_width $W
|
|
#define xf_height $H
|
|
static char xf_bits[] = {
|
|
EOF
|
|
while (@bm) {
|
|
for (1..6) {
|
|
$x = shift @bm;
|
|
$y = 0;
|
|
for $i (1 .. 8) {
|
|
$y |= ($x & 1) << (8 - $i);
|
|
$x >>= 1;
|
|
}
|
|
printf XBM " 0x%02X,", $y;
|
|
}
|
|
print XBM "\n";
|
|
}
|
|
print XBM <<EOF;
|
|
};
|
|
EOF
|
|
close(XBM);
|