/*
 * $VER: Wipe 1.00.00 (24.9.92)
 *
 * Arexx program for the ImageFX image processing system.
 * Written by Thomas Krehbiel
 *
 * Create a wipe effect, using a black-and-white animation to control
 * the blend between the swap and main buffer.
 *
 */

OPTIONS RESULTS

SIGNAL ON BREAK_C

/*
 * This requires a Main and Swap buffers.
 */
GetMain ; IF result = "" THEN EXIT
GetSwap ; IF result = "" THEN EXIT

/*
 * This uses whatever the current render module is.
 */

/*
 * Request the output animation name:
 */
RequestFile '"Enter Output Animation:"'
IF rc ~= 0 THEN EXIT
output = result

IF EXISTS(output) THEN DO
   RequestResponse 'Output animation exists.  Overwrite?'
   IF rc ~= 0 THEN EXIT
   ADDRESS COMMAND 'c:Delete >NIL:' output
   END

/*
 * Request the animation to control the wipe:
 */
RequestFile '"Enter Wipe Control Animation:"'
IF rc ~= 0 THEN EXIT 0
anim = result

/*
 * Turn on the alpha channel for compositing.
 */
LockRange 0 OFF

/*
 * Loop through the animation, wiping between the buffers.
 */
DO frame = 1

   Render Close

   LoadAlpha anim frame
   IF rc ~= 0 THEN LEAVE

   Merge 100 Alpha

   Render Go
   SaveRenderedAs 'ANIM' output Keep Append

   LockRange 0 ON

   Undo

   END

BREAK_C:

SaveRenderedAs 'ANIM' output Close
Render Close

EXIT
