#!/opt/bin/perl

use GD;

open (GIF,"$ARGV[0].gif") || die;
$im = newFromGif GD::Image(GIF);
close GIF;

($black,$beige) = 
    (
     	$im->colorAllocate(0, 0, 0),
		$im->colorAllocate(255,255,156)
     );
	
$white=$im->colorClosest(255,255,255);
$im->transparent($white);

open (DATA,"$ARGV[0].data");
while ($n=<DATA>)
{
	chop($n);
	($room,$x,$y,$size,$cps)=split(" ",$n);	
	if ($size eq "t")
	{
		$im->string(gdTinyFont,$x,$y,$room,$black);
	}
	else
	{
		$im->string(gdSmallFont,$x,$y,$room,$black);
	}
}

#	open (GIF,">/user/wagners5/web/t.gif") || die;

print $im->gif;

#	close GIF;


#print "Location: http://web.cps.msu.edu/~wagners5/me2.html\n\n";

#print "Content-type: text/html\n\n";
#print `printenv`;
