+
+ if (length($simdata) == $simn)
+ {
+ my $gd = GD::Image->new($width, $height, 1);
+
+ for (my $x = 0; $x < $width; $x++)
+ {
+ for (my $y = 0; $y < $height; $y++)
+ {
+ my $colors = substr($simdata, ($x + $y * $width) * 3, 3);
+ my @rgb = unpack("CCC", $colors);
+ my $index = $gd->colorAllocate(@rgb);
+ $gd->setPixel($x, $y, $index);
+ }
+ } ## end for (my $x = 0; $x < $width; $...
+
+ my $png = $gd->png;
+ open my $display_fh, '|-', qw(display -resize), sprintf("%dx%d", $width*10, $height*10), '-' or die;
+ binmode $display_fh;
+ print {$display_fh} $png;
+ close $display_fh;
+ } ## end if (length($simdata) == $simn)