use strict; use warnings; use GD; open ( OH, ">c:/printout1.txt" ) or die ("could not open file. &!" ); open ( GET, "colorAllocate(255,255,255); $black = $im->colorAllocate(0,0,0); $red = $im->colorAllocate(255,0,0); $blue = $im->colorAllocate(0,0,255); $green = $im->colorAllocate(0,255,0); $purple = $im->colorAllocate(100,0,175); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture #$im->rectangle(0,0,99,99,$black); $im->fill(500,500,$purple); #$im->rectangle(0,0,100,100,$red); #$im->rectangle(100,100,200,200,$red); #$im->rectangle(200,200,300,300,$red); #$im->rectangle(300,300,400,400,$white); my $buffer = ; chomp($buffer); my @big = split /\s+/, $buffer; my $maxx = $big[0]; my $maxy = $big[1]; my $count = 0; my $count2 = 1; my @abet; $abet[0] = "A"; $abet[1] = "A"; $abet[2] = "B"; $abet[3] = "C"; $abet[4] = "D"; $abet[5] = "E"; A:while ($buf = ) { print OH "buf [$buf]\n"; if ($buf =~ /LITE2/) { AA:while ($buf = ) { $count = $count + 1; chomp($buf); print OH "IN LITE2 buf [$buf]\n"; @values = split /\s+/, $buf; if ($buf =~/FINALLY/) { goto B; } print OH "START\n"; print OH "values 0[$values[0]] 1[$values[1]] 2[$values[2]] 3[$values[3]]\n"; if ($values[4] == 0) { $count = 0; $count2 = $count2 + 1; next AA; } # end of if ($values[4] == 0) if ($values[4] == 1) { my $x0 = $values[2]*10; my $y0 = 1000 - ($values[3]*10) - $values[1]*10; my $x1 = ($values[2]*10) + ($values[0]*10); my $y1 = 1000 - ($values[3]*10); my $fx = $x0 + ( ($x1 - $x0) / 2); my $fy = $y0 + ( ($y1 - $y0) / 2); print OH "x0 [$x0] y0 [$y0] x1 [$x1] y1 [$y1]\n"; my $string = "$abet[$count2]-$count"; $im->rectangle($values[2]*10, 1000 - ($values[3]*10) - $values[1]*10 , ($values[2]*10)+($values[0]*10), 1000-($values[3]*10), $red ); $im->string(gdMediumBoldFont,$fx,$fy,$string,$white); } # end of if ($values[4] == 1) } # end of while ($buf = ) OUT: print OH "OUT\n"; } # end of if ($buf =~ /LITE2/) B:if ($buf =~ /FINALLY/) { while ($buf = ) { @lines = split /\s+/, $buf; $im->line($lines[0]*10, 1000-($lines[1]*10), $lines[2]*10, 1000-($lines[3]*10), $white); } # end of while ($buf = ) } # end of if ($buf =~ /FINALLY/) } # end of while ($buf = ) $im->line(0,1000-($maxy*10),$maxx*10,1000-($maxy*10),$white); $im->line($maxx*10,1000-($maxy*10),$maxx*10,1000,$white); # Put a black frame around the picture #$im->rectangle(0,0,99,99,$black); #$im->fill(50,50,$black); # Draw a blue oval #$im->arc(50,50,95,75,0,360,$green); # And fill it with red #$im->fill(50,50,$purple); # make sure we are writing to a binary stream binmode STDOUT; # Convert the image to PNG and print it on standard output print $im->png;