-grab() {
- uname=`uname`
- if [ $uname = IRIX ]; then
- #
- # SGI's "vidtomem" returns an SGI RGB image of the default video input,
- # and has stupid non-overridable ouput-file-naming conventions. So, let
- # it write its file; and then convert it to a pgm.
- #
-
- vidtomem -f $tmp
- sgitopnm $tmp_rgb > $tmp_ppm1
-
- # Cut off the close-captioning blips in the NTSC overscan region. YMMV.
- # | pnmcut 12 7 695 477
-
- elif [ $uname = Linux ]; then
-
- # Marcus Herbert says the following works with his Connectix Qcam.
- # Don't have qcam? Well, do something else then... and send me a patch.
-
- qcam > $tmp_ppm1
-
- # Friedrich Delgado Friedrichs says the following works if you have
- # XawTV installed:
- #
- # streamer -o $tmp_ppm1
- #
-
- else
- echo "$0: don't know how to grab video on this OS." >&2
- clean2
- exit 1
- fi
-}
+# 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 = (
+ "xscreensaver-getimage -root -file",
+# "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",
+
+ "ppmtopgm < FILE1 | pgmedge > FILE2 ; " .
+ " pnmarith -difference FILE1 FILE2 > FILE3 ; " .
+ " cp FILE3 FILE1 ; " .
+ " ppmtopgm < FILE1 | pgmedge > FILE2 ; " .
+ " pnmarith -difference FILE1 FILE2 > FILE3 ; " .
+ " ppmnorm < FILE1",
+
+ "pnmflip -lr < FILE1 > FILE2 ; " .
+ " pnmarith -multiply FILE1 FILE2 | ppmrelief | ppmnorm | pnminvert",
+
+ "pnmflip -lr FILE1 > FILE2 ; " .
+ " pnmarith -subtract FILE1 FILE2 | ppmrelief | ppmtopgm | pgmedge",