(FILECREATED "29-May-86 23:42:08" {ERIS}<LISPUSERS>KOTO>IDLESWAP.;4 2353   

      changes to:  (FNS IDLE-SWAP)
                   (VARS IDLESWAPCOMS)

      previous date: "29-May-86 23:10:51" {ERIS}<LISPUSERS>KOTO>IDLESWAP.;2)


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT IDLESWAPCOMS)

(RPAQQ IDLESWAPCOMS [(INITVARS (IDLE-SWAP-SIZE 64))
                     (FNS IDLE-SWAP)
                     (ADDVARS (IDLE.FUNCTIONS ("Swap" (QUOTE IDLE-SWAP])

(RPAQ? IDLE-SWAP-SIZE 64)
(DEFINEQ

(IDLE-SWAP
  [LAMBDA (WINDOW)                                           (* hdj "29-May-86 23:41")
    (DECLARE (GLOBALVARS IDLE-SWAP-SIZE))
    (BITBLT (WINDOWPROP WINDOW (QUOTE IMAGECOVERED))
           NIL NIL WINDOW NIL NIL NIL NIL (QUOTE INVERT)
           (QUOTE REPLACE))
    (LET [(WIDTH (WINDOWPROP WINDOW (QUOTE WIDTH)))
          (HEIGHT (WINDOWPROP WINDOW (QUOTE HEIGHT]
         (do (BLOCK (RAND 0 5000))
             (LET [[RAND-X-1 (TIMES IDLE-SWAP-SIZE (RAND 0 (IQUOTIENT WIDTH IDLE-SWAP-SIZE]
                   [RAND-Y-1 (TIMES IDLE-SWAP-SIZE (RAND 0 (IQUOTIENT HEIGHT IDLE-SWAP-SIZE]
                   [RAND-X-2 (TIMES IDLE-SWAP-SIZE (RAND 0 (IQUOTIENT WIDTH IDLE-SWAP-SIZE]
                   (RAND-Y-2 (TIMES IDLE-SWAP-SIZE (RAND 0 (IQUOTIENT HEIGHT IDLE-SWAP-SIZE]
                  (if (AND (NEQ RAND-X-1 RAND-X-2)
                           (NEQ RAND-Y-1 RAND-Y-2))
                      then 
          
          (* * swap the two regions of the window using BITBLT only)

                           (BITBLT WINDOW RAND-X-1 RAND-Y-1 WINDOW RAND-X-2 RAND-Y-2 IDLE-SWAP-SIZE 
                                  IDLE-SWAP-SIZE (QUOTE INPUT)
                                  (QUOTE INVERT))
                           (BITBLT WINDOW RAND-X-2 RAND-Y-2 WINDOW RAND-X-1 RAND-Y-1 IDLE-SWAP-SIZE 
                                  IDLE-SWAP-SIZE (QUOTE INPUT)
                                  (QUOTE INVERT))
                           (BITBLT WINDOW RAND-X-1 RAND-Y-1 WINDOW RAND-X-2 RAND-Y-2 IDLE-SWAP-SIZE 
                                  IDLE-SWAP-SIZE (QUOTE INPUT)
                                  (QUOTE INVERT])
)

(ADDTOVAR IDLE.FUNCTIONS ("Swap" (QUOTE IDLE-SWAP)))
(PUTPROPS IDLESWAP COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (532 2216 (IDLE-SWAP 542 . 2214)))))
STOP