Pic.Frames

OpenTuring

Pic.FramesPart of Pic module

Syntax   Pic.Frames (pathName : string) : int

Description   Pic.Frames is used to determine the number of frames found in a multiple frame GIF file.

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)

Execute  

Status   Exported qualified.

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

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

Pic.DrawFrames for information on how to sequentially display the images stored in array of pictures.

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