-# The video grabbing part is SGI-specific -- if you want to use this on
-# another system, add a new clause to the grab() procedure.
-
-
-# Process command-line args...
-
-onroot=false
-verbose=false
-delay=3
-use_stdin=false
-
-pid=""
-tmp=/tmp/vd$$
-tmp_rgb=$tmp-00000.rgb
-tmp_ppm0=$tmp-0.ppm
-tmp_ppm1=$tmp-1.ppm
-tmp_ppm2=$tmp-2.ppm
-tmp_ppm3=$tmp-3.ppm
-tmp_ppm4=$tmp-4.ppm
-
-
-getargs() {
-
- while [ $# != 0 ]; do
- case "$1" in
- -root )
- onroot=true
- ;;
- -verbose )
- verbose=true
- ;;
- -stdin )
- use_stdin=true
- ;;
- * )
- echo "usage: $0 [ -root | -verbose | -stdin ]" >&2
- exit 1
- ;;
- esac
- shift
- done
-
- xvargs="-quick24"
-
- if [ "$onroot" = true ]; then
- xvargs="$xvargs -root -rmode 5 -noresetroot -rfg black -rbg black -viewonly"
- else
- xvargs="$xvargs -geom +0+0"
- fi
-
- screen_width=`xdpyinfo | sed -n 's/.* dimensions: *\([0-9]*\).*/\1/p'`
-}
+# Created: 14-Apr-01.
+
+require 5;
+use diagnostics;
+use strict;
+
+my $progname = $0; $progname =~ s@.*/@@g;
+my $version = q{ $Revision: 1.20 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/;
+
+my $verbose = 0;
+my $use_stdin = 0;
+my $use_stdout = 0;
+my $video_p = 0;
+my $file_p = 1;
+my $delay = 5;
+my $imagedir;
+
+my $screen_width = -1;
+
+
+
+# #### This list was lifted from driver/xscreensaver-getimage-file
+#
+# These are programs that can be used to put an image file on the root
+# window (including virtual root windows.) The first one of these programs
+# that exists on $PATH will be used (with the file name as the last arg.)
+#
+# If you add other programs to this list, please let me know!
+#
+my @displayer_programs = (
+ "xv -root -quit -viewonly -maxpect -noresetroot -quick24 -rmode 5" .
+ " -rfg black -rbg black",
+ "xli -quiet -fullscreen -onroot -center -border black",
+ "xloadimage -quiet -fullscreen -onroot -center -border black",
+ "chbg -once -xscreensaver -max_grow 4",
+
+# this lame program wasn't built with vroot.h:
+# "xsri -scale -keep-aspect -center-horizontal -center-vertical",
+);
+
+# apparently some versions of netpbm call it "pamoil" instead of "pgmoil"...
+#
+my $pgmoil = (which("pamoil") ? "pamoil" : "pgmoil");
+
+
+# List of interesting PPM filter pipelines.
+# In this list, the following magic words may be used:
+#
+# COLORS a randomly-selected pair of RGB foreground/background colors.
+# FILE1 the (already-existing) input PPM file (ok to overwrite it).
+# FILE2-FILE4 names of other tmp files you can use.
+#
+# These commands should read from FILE1, and write to stdout.
+# All tmp files will be deleted afterward.
+#
+my @filters = (
+ "ppmtopgm FILE1 | pgmedge | pgmtoppm COLORS | ppmnorm",
+ "ppmtopgm FILE1 | pgmenhance | pgmtoppm COLORS",
+ "ppmtopgm FILE1 | $pgmoil | pgmtoppm COLORS",
+ "ppmtopgm FILE1 | pgmbentley | pgmtoppm COLORS",
+
+ "ppmrelief FILE1 | ppmtopgm | pgmedge | ppmrelief | ppmtopgm |" .
+ " pgmedge | pnminvert | pgmtoppm COLORS",
+
+ "ppmspread 71 FILE1 > FILE2 ; " .
+ " pnmarith -add FILE1 FILE2 ; ",
+
+ "pnmflip -lr < FILE1 > FILE2 ; " .
+ " pnmarith -multiply FILE1 FILE2 > FILE3 ; " .
+ " pnmflip -tb FILE3 | ppmnorm > FILE2 ; " .
+ " pnmarith -multiply FILE1 FILE2",
+
+ "pnmflip -lr FILE1 > FILE2 ; " .
+ " pnmarith -difference FILE1 FILE2",
+
+ "pnmflip -tb FILE1 > FILE2 ; " .
+ " pnmarith -difference FILE1 FILE2",
+
+ "pnmflip -lr FILE1 | pnmflip -tb > FILE2 ; " .
+ " pnmarith -difference FILE1 FILE2",