diff options
| author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-04-09 14:45:58 +0000 | 
|---|---|---|
| committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-04-09 14:45:58 +0000 | 
| commit | c2c01b60dd063ed4728986d513b51138ccf9de4a (patch) | |
| tree | 0880f7c647f9747e3ec733dffa4231c91dc91196 /scripts | |
| parent | NEWS: mark_all_pages (diff) | |
| download | w3m-c2c01b60dd063ed4728986d513b51138ccf9de4a.tar.gz w3m-c2c01b60dd063ed4728986d513b51138ccf9de4a.zip | |
[w3m-dev 03167] xface2xbm -> xface2xpm (current imlib can't handle XBM)
* configure: s/XFACE2XBM/XFACE2XPM/
* config.h.dist: ditto
* file.c (xface2xpm): renamed from xface2xbm
		modified for xpm
	(readHeader): s/xface2xbm/xface2xpm/
* scripts/Makefile (LIB_TARGETS): s/xface2xbm/xface2xpm/
* scripts/xface2xpm.in: added
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile | 2 | ||||
| -rw-r--r-- | scripts/xface2xpm.in | 94 | 
2 files changed, 95 insertions, 1 deletions
| diff --git a/scripts/Makefile b/scripts/Makefile index af1cd79..5099918 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -6,7 +6,7 @@ LIB_DIR		= $(prefix)/lib/w3m  HELP_DIR	= $(prefix)/lib/w3m  RC_DIR		= ~/.w3m -LIB_TARGETS	= dirlist.cgi w3mhelp.cgi w3mmail.cgi xface2xbm +LIB_TARGETS	= dirlist.cgi w3mhelp.cgi w3mmail.cgi xface2xpm  HELP_LIBS	= w3mhelp-funcname.pl w3mhelp-funcdesc.pl  MKDIR		= mkdir -p diff --git a/scripts/xface2xpm.in b/scripts/xface2xpm.in new file mode 100644 index 0000000..30253cb --- /dev/null +++ b/scripts/xface2xpm.in @@ -0,0 +1,94 @@ +#!@PERL@ + +$USAGE = "xface2xpm [-t] [-fg <color>] [-bg <color>] [<file>]"; + +# compface/uncompface +#   ftp://metalab.unc.edu/pub/Linux/apps/graphics/convert/ +$UNCOMPFACE = "uncompface"; + +$T = "c"; +$BG = "white"; +$FG = "black"; +while (@ARGV) { +	$_ = shift @ARGV; +	if (/^-h/) { +		&usage(0); +	} elsif (/^-t/) { +		$T = "s"; +		$BG = "none"; +	} elsif (/^-bg/) { +		@ARGV || &usage(1); +		$BG = shift @ARGV; +	} elsif (/^-fg/) { +		@ARGV || &usage(1); +		$FG = shift @ARGV; +	} elsif (/^-./) { +		&usage(1); +	} else { +		unshift(@ARGV, $_); +		last; +	} +} + +$xf = ""; +while(<>) { +#	s/^X-Face://i if ($xf eq ""); +	$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 +print <<EOF; +/* XPM */ +static char *xf[] = { +/* columns rows colors chars-per-pixel */ +"$W $H 2 1", +"  $T $BG", +". c $FG", +/* pixels */ +EOF +while (@bm) { +	print "\""; +	for (1..6) { +		$x = shift @bm; +		for $i (1 .. 8) { +			print ((($x >> (8-$i)) & 1) ? "." : " "); +		} +	} +	print (@bm ? "\",\n" : "\"\n"); +} +print <<EOF; +}; +EOF + +sub usage { +	local($err) = @_; +	if ($err) { +		print STDERR "$USAGE\n"; +	} else { +		print "$USAGE\n"; +	} +	exit $err; +} | 
