|
#!/usr/bin/perl -w
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
# 02139, USA.
#
# Ingo Blechschmidt
# Arberstraße 5
# 86179 Augsburg
# E-Mail: iblech@web.de, http://www.way.to/uselinux/
# Tel.: +49 / 821 882955
#
#
@start = ();
@ende = ();
@stepx = ();
@stepy = ();
$maxx = 10;
$maxy = 20;
$i = 0;
$j = 0;
$k = 0;
@matrix = ();
$spot = '';
$spot = $ARGV[0] ? $ARGV[0] : 'l';
@start = qw(nil ff 80 33); # Initialisierung
@ende = qw(nil ff 89 44);
@start = (0, "$ARGV[1]", "$ARGV[2]", "$ARGV[3]")
if (defined $ARGV[1]);
@ende = (0, "$ARGV[4]", "$ARGV[5]", "$ARGV[6]")
if (defined $ARGV[4]);
$maxx = $ARGV[7] if (defined $ARGV[7]);
$maxy = $ARGV[8] if (defined $ARGV[8]);
for ($i = 1; $i <= 3; $i++) {
$start[$i] = hex($start[$i]);
$ende[$i] = hex($ende[$i]);
}
for ($i = 1; $i <= 3; $i++) {
$stepx[$i] = abs(($start[$i] - $ende[$i]) / $maxx);
$stepy[$i] = abs(($start[$i] - $ende[$i]) / $maxy);
}
for($i = 1; $i <= $maxx; $i++) { # Berechnung
for($j = 1; $j <= $maxy; $j++) {
for($k = 1; $k <= 3; $k++) {
$matrix[$maxx - $i + 1][$j][$k] = $ende[$k] +
($stepx[$k] * ($i - 1) +
$stepy[$k] * ($j - 1)) / 4
if ($spot eq 'r');
$matrix[$maxx - $i + 1][$maxy - $j + 1][$k] = $ende[$k] +
($stepx[$k] * ($i - 1) +
$stepy[$k] * ($j - 1)) / 4
if ($spot eq 'l');
}
}
}
print
'<table border="0" cellpadding="0" cellspacing="0" summary="">' .
"\n";
for ($i = 1; $i <= $maxx; $i++) { # Umrechnung in hex
print "<tr>";
for ($j = 1; $j <= $maxy; $j++) { # und Ausgabe
print '<td bgcolor="#';
for ($k = 1; $k <= 3; $k++) {
$matrix[$i][$j][$k] = 255 if ($matrix[$i][$j][$k] > 255);
print ((0 .. 9, 'a' .. 'f')[int($matrix[$i][$j][$k] / 16)],
(0 .. 9, 'a' .. 'f')[$matrix[$i][$j][$k] % 16]);
# print " ";
}
print '"> </td>';
}
print "</tr>\n";
}
print "</table>";
1;
| |