Pic.DrawFrames

OpenTuring

Pic.DrawFramesPart of Pic module

Syntax   Pic.DrawFrames (picIds : array 1 .. * of int, x, y, mode : int,
   numFrames, delayBetweenFrames : int, eraseAfter : boolean)

Description   Pic.DrawFrames is used to draw a set of pictures stored in an array of ints. The pictures are displayed one at a time, and there is a delay of delayBetweenFrames milliseconds between frames. The x, y, and mode parameters are the same as in Pic.Draw. The numFrames parameter specifies the number of frames to be drawn (the picIds array must be at least this big). The eraseAfter parameter specifies whether the last frame of the animation should be left on the Run window when the call finishes. If eraseAfter is set to true, then the background is restored after the last picture has been drawn and delayBetweenFrames milliseconds has passed.

Details   GIF files can contain multiple frames (pictures). Animated GIFs function by each frame in the GIF one after another with a delay between them.

Turing allows users to load multiple frame GIF images into a series of pictures into an array using the Pic.FileNewFrames procedure. The user can determine how many frames are found in the GIF file using Pic.Frames. The frames can be sequentially displayed using either Pic.DrawFrames or Pic.DrawFramesBack which display the images one at a time. (Pic.DrawFrames returns once all the images have been displayed, Pic.DrawFramesBack returns immediately allowing the program to continue execution while the frames are being displayed.

Pic.Frames is a function which returns the number of frames found in the GIF. If it is used on a GIF that does not contain multiple images, or on a non-GIF image file, it returns 1.

Example   The program loads a multiple frame GIF called "globe.gif" and displays it.
        % Determine the number of frames in "globe.gif"
        var numFrames := Pic.Frames ("globe.gif")
        % Load the picture
        var delayTime : int
        var pics : array 1 .. numFrames of int

	Pic.FileNewFrames ("globe.gif", pics, delayTime)
	Pic.DrawFrames (pics, 10, 10, picCopy, numFrames, 50, false)
	for i : 1 .. numFrames
Pic.Free (pics (i)) end for

Execute  

Status   Exported qualified.

This means that you can only call the function by calling Pic.DrawFrames, not by calling DrawFrames.

See also   Pic.Frames for information on how to determine the number of frames in a GIF image.

Pic.FileNewFrames for information on how to load a GIF image with multiple frames into an array of ints.

Pic.DrawFramesBack for information on how to sequentially display the images stored in array of pictures while continuing to execute the program.