wesnoth/data/tools/mk-edges.pl
Eric S. Raymond 69f3aa45e8 Move WML-hacking tools from top-level utils directory to data/tools.
This is a clutter-reduction step, separating the packaging and code-integrity 
checks from the stuff for maintaining mainline campaigns.

I've also added documentation comments to some scripts.
2007-04-06 00:02:43 +00:00

28 lines
650 B
Perl

print "usage: $0 <input> <stem>" and exit 0 if $#ARGV != 1;
my ($input,$stem) = @ARGV;
sub process {
my $in=shift || die;
my $edge=shift || die;
my $out=shift || die;
system <<EOF;
pngtopnm -alpha $edge >/tmp/edge-alpha.pgm;
pngtopnm $edge >/tmp/edge.ppm;
ppmtopgm /tmp/edge.ppm >/tmp/edge.pgm;
pngtopnm $in >/tmp/bg.ppm;
pnmcomp -alpha=/tmp/edge.pgm /tmp/bg.ppm /tmp/edge.ppm | pnmtopng -alpha /tmp/edge-alpha.pgm >$out;
EOF
}
foreach (glob "${stem}-*.png") {
my $edge=$1 if /$stem-(.*).png/;
if($edge=~/^[news-]*$/) {
process("${input}.png","${stem}-${edge}.png","${input}-${edge}.png");
}
}