AISAnimation.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: May 4, 1985 9:42:42 am PDT
Crow, April 20, 1989 10:11:33 am PDT
DIRECTORY G3dRender, ImagerPixel, Rope;
AISAnimation: CEDAR DEFINITIONS
~ BEGIN
Basic Types
Context:    TYPE ~ G3dRender.Context;
PixelMap:   TYPE ~ ImagerPixel.PixelMap;
ROPE:    TYPE ~ Rope.ROPE;
FrameSequence: TYPE ~ RECORD[ currentFrame: NAT ← 0, length: NAT,
          frames: SEQUENCE maxLength: NAT OF PixelMap ];
Procedures for Animation - These build sequences of AIS files and play them back
PlayBackNumberedAISFiles: PROC[context: Context, fileRoot : ROPE,
         startNum, numFiles, framesPerSec, secondsPlayingTime : NAT];
Plays back a sequenced set of AIS files, cycling through the files ad nauseum
- startNum specifies the first image in the sequence to display
- numFiles specifies the number of different images to be displayed
- framesPerSec ranges from 1 up to 30 (performance is limited by bitblt speed)
- secondsPlayingTime limits the running time
StoreFiles: PROC[ context: Context, fileRoot: ROPE,
      number: NATLAST[NAT] ];
Stores image on display in named file(s), non-defaulted sequence number is added to file name
CacheAISFiles: PROC[context: Context, fileOfNames: ROPE,
       frames: REF FrameSequence ← NIL]
     RETURNS[REF FrameSequence];
Stores a cache of images, named in a file of ROPEs, in memory for playback. Returns a handle to the cache
CacheNumberedAISFiles: PROC[context: Context, fileRoot: ROPE,
           numFiles: NAT, start: NAT ← 0]
        RETURNS[REF FrameSequence];
Stores a cache of images, with sequentially numbered file names, in memory for flexible playback. Returns a handle to the cache. File names of the form: name0.ais, name1.ais, name64.ais, etc. Start indicates file name to begin sequence with.
PlayBackAISCache: PROC[context: Context, frames: REF FrameSequence,
        framesPerSec, secondsPlayingTime: NAT,
        bothWays: BOOLEANFALSE, startNum: NAT ← 0];
Plays back a cached set of images as above, will cycle through the sequence or run back and forth over the sequence if bothWays is set TRUE, the playback may be started in midsequence if startNum is nonzero
ShowNextAISCacheFrame: PROC[context: Context,
          frames: REF FrameSequence, framesPerSec: INTEGER ← 0];
Shows next frame in sequence, delaying enough time to ensure framesPerSec not exceeded, handy for interactive control of frame rate, negative framesPerSec shows previous frame
Support Procedures
GetLogFileName: PROC[fileRoot: ROPE] RETURNS[ROPE];
Strips any extension from fileRoot and tacks on "log"
PasteInSequenceNo: PROC[fileRoot: ROPE, number: NAT] RETURNS[ROPE];
Adds number to the file name, sticking it in just before the extension, for sequencing
ShowAISCacheFrame: PROC[context: Context, frames: REF FrameSequence];
Shows the specified frame from a frame sequence cached in VM
The following loadAIS files into a displayed context without resampling.
- If the stored image has more pixels than the display, part will be clipped.
- If the stored image has fewer pixels than the display, an unwritten border will be left around the displayed image.
- xOffset moves the displayed to the right if positive, otherwise left (units are pixels)
- yOffset moves the displayed up if positive, otherwise down
GetAIS: PROC[ context: Context, fileRoot: ROPE,
     xOffset, yOffset: INTEGER ← 0, center: BOOLEANTRUE ]
   RETURNS[ xSize, ySize: INTEGER];
Reads AIS file(s) to match context.display. Searches for appropriate file names,
eg. file-red.ais, file-grn.ais, file-alpha.ais, file-depth.ais, etc.
See AISAnimationImpl.standardNames.
     
PutAIS: PROC[ context: Context, fileRoot: ROPE,
     doEverything: BOOLEANFALSE ];
Writes current image in context.display out to ais file(s). IF doEverything THEN alpha and depth channels will be written out if they exist .
GetRGB: PROC[ context: Context, fileRoot: ROPE,
     xOffset, yOffset: INTEGER ← 0, center: BOOLEANTRUE ]
   RETURNS[ xSize, ySize: INTEGER];
Reads a file in Abekas RGB format, 486 x 720 x RGB bytes
PutRGB: PROC[ context: Context, fileRoot: ROPE ];
Writes a file in Abekas RGB format, 486 x 720 x RGB bytes
GetInterpress: PROC[ context: Context, fileRoot: ROPE,
       xOffset, yOffset: INTEGER ← 0, center: BOOLEANTRUE ]
     RETURNS[ xSize, ySize: INTEGER];
Read image directly from interpress file(s). Unimplemented.
PutInterpress: PROC[ context: Context, fileRoot: ROPE ];
Write directly to interpress file alpha and depth channels ignored. Unimpelmented
END.