#!/usr/bin/perl
use Graphics::Libplot ':ALL';
# type of plotting device
$device = 'X';
if (@ARGV) {
$device = $ARGV[0];
# die "Uknown device: $ARGV[0]" unless $ARGV[0] =~ /^X$/;
}
pl_parampl ("VANISH_ON_DELETE", "yes");
pl_parampl ("USE_DOUBLE_BUFFERING", "yes");
if (($handle = pl_newpl ($device, stdin, stdout, stderr)) < 0)
{
die "Couldn't create Plotter";
}
pl_selectpl($handle); # /* select the Plotter for use */
if (pl_openpl() < 0) # /* open Plotter */
{
die "Couldn't open Plotter";
}
pl_space(0, 0, 299, 149); # /* specify user coordinate system */
pl_parampl ("BITMAPSIZE", "300x150");
# Note a bug in XFree86 requires that the bitmap spec comes after newpl().
pl_linewidth (8); # /* width of lines in user coordinates */
pl_filltype (1); # /* objects will be filled */
pl_bgcolorname ("saddle brown"); # /* background color for the window */
for ($j = 0; $j < 300; $j++)
{
pl_erase (); # /* erase window */
pl_pencolorname ("red"); # /* choose red pen, with cyan filling */
pl_fillcolorname ("cyan");
pl_ellipse ($i, 75, 35, 50, $i); # /* draw an ellipse */
pl_colorname ("black"); # /* choose black pen, with black filling */
pl_circle ($i, 75, 12); # /* draw a circle [the pupil] */
$i = ($i + 2) % 300; # /* shift rightwards */
}
if (pl_closepl () < 0) # /* close Plotter */
{
die "Couldn't close Plotter";
}
pl_selectpl (0); # /* select default Plotter */
if (pl_deletepl ($handle) < 0) # /* delete Plotter we used */
{
die "Couldn't delete Plotter";
}
1; #OK