Warning, /Utilities/ReleaseScripts/ignominy/map2html is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env perl
0002 use warnings;
0003 use strict;
0004
0005 my $usage = "$0 NAME SCALE Y-CROP X-CROP FILE";
0006 die "$usage\n" if @ARGV != 5;
0007 my ($name, $scale, $ycrop, $xcrop, $file) = @ARGV;
0008 # $scale *= .75;
0009
0010 open(IN, "< $file") || die "$file: cannot read\n";
0011
0012 print "<MAP NAME='$name'>\n";
0013 while (<IN>) {
0014 chomp;
0015 s/^#.*//;
0016 s/base referer//;
0017 next if /^\s*$/;
0018
0019 if (/^(rect)\s+(\S+)\s+(\d+),(\d+)\s+(\d+),(\d+)\s*$/) {
0020 my @bbox = ($3, $4, $5, $6);
0021 $bbox[0] = int($3 * $scale - $xcrop);
0022 $bbox[1] = int($6 * $scale - $ycrop);
0023 $bbox[2] = int($5 * $scale - $xcrop + .5);
0024 $bbox[3] = int($4 * $scale - $ycrop + .5);
0025 print "<AREA HREF='$2' SHAPE='$1' COORDS='" . join(",", @bbox) . "'>\n";
0026 } else {
0027 print STDERR "$file:$.: unrecognised line `$_'\n";
0028 }
0029 }
0030 print "</MAP>\n";
0031
0032 close(IN);