GRASP File Format Summary

Also Known As: Graphical System for Presentation, .GL, .CLP, .FNT, .PIC, .SET, TXT

Type Animation
Colors 256
Compression RLE
Maximum Image Size Variable
Multiple Images Per File Yes
Numerical Format Little-endian
Originator Microtex Industries
Platform MS-DOS
Supporting Applications GRASP
See Also Microsoft RIFF, FLI

GRASP is a simple animation format capable of displaying low- and medium-resolution images, text, and simple sounds.

At one time the most widely used animation format around, GRASP's fortunes have been declining, perhaps because of increased interest in digital video formats such as AVI and QuickTime.

Vendor specifications are available for this format.

GRASP (GRAphical System for Presentation) is an MS-DOS application used to create and play back simple animated sequences. Such animations are incorporated into other applications, such as graphical presentations, educational tutorials, and games.

File Organization
File Details
For Further Information

GRASP is a simple toolkit of utilities used to create and play back animations. The basic tool found in GRASP is the editor (GRASP.EXE under MS-DOS). The editor program organizes graphics and command information together into a GRASP animation. An animation may contain both text and images, which can be presented in a variety of ways. Simple sounds may be generated from the PC's speaker, and the animation may be controlled via user input. GRASP supports all standard EGA and VGA display modes.

Most GRASP animations that you will encounter are stored in a GRASP library file (with a .GL extension). A .GL file is actually a library of separate files that contain information required to display a GRASP animation. These files are normally stored as separate disk files when used by GRASP. But when an animation must be transported to another environment or incorporated into another application, the GRASP Library Manager (GLIB.COM under MS-DOS) combines all the necessary files into a single .GL library file.

A GRASP library may contain four different types of information files; the formats of these files are discussed later in this article. When these files are stored separately on disk, their types can be identified by their file extensions:

.TXT Command file
.PIC Picture file
.CLP Clip file (picture file without a color map)
.FNT Font character information (also *.SET)
.SET Font character information

A GRASP animation is played back using the GRASP run-time display program (GRASPRT.EXE under MS-DOS). All applications playing back .GL animation files will call this program to display the animation. The GRASPRT program is capable of reading the animation from a single .GL file or from each information file stored separately on disk.

A .GL file is created as follows:

  1. Using a paint or imaging program, create or capture the individual frames you want animated. The images must be saved to disk using the PCPAINT/Pictor file format.

  2. Use the GRASP editor program to create a sequence of commands that will be used to display the animation.

  3. Combine all the resulting data files into a single .GL file using the GRASP Library Manager. The resulting .GL file may be played back using the GRASP run-time display engine.

File Organization

All GRASP library files begin with a header. The header is a directory of the separate files stored in the .GL file. The header varies in size depending on the number of files stored. The format of the header is shown below:

typedef struct _GLHeader
  WORD DirectorySize;          /* Size of header in bytes */
  struct _FileEntry
	DWORD FileOffset;          /* Offset of file in the .GL file */
	CHAR  FileName[13];        /* Name of the file */
  } FileDirectory[DirectorySize];

DirectorySize is the size of the .GL header in bytes.

The FileDirectory contains one FileEntry structure for each file stored in the .GL.

FileOffset contains the offset location of the file within the .GL file. If a FileOffset value is 00h, then the end of the file directory has been reached.

FileName contains the original disk filename of the file. Each file in a .GL library file is stored as a 4-byte value indicating the size of the file, followed by the file data itself. A structure representing this arrangement appears as follows:

typedef struct _FileData
  DWORD FileLength;            /* Size of the file data in bytes */
  BYTE  FileData[FileLength];  /* File data */

File Details

This section describes the types of files contained in a GRASP library.

Command File

A command (.TXT) file is simply a script of GRASP commands read by the .GL playback program and used to display the animation. A command file is an ordinary ASCII text file and usually begins with a few comment lines identifying the name of the file and author, title of the animation, date of creation, and so on. There is one command file per .GL file.

A number of commands allow GRASP animations to have many special operations and effects. Some of the commands are:

  • Load image files and fonts

  • Execute MS-DOS programs

  • Receive input from the user

  • Draw geometric shapes

  • Change video modes

  • Change color maps

  • Create sound

  • Display text

  • Perform fades

Each command is a keyword followed by zero or more arguments delimited by commas. All commands are case-insensitive except for literal strings which must appear in double quotes. All comments begin with a semicolon and are ignored during playback.

Consider the following example. A .GL file which contains a simple, five-frame animation that displays in an infinite loop might contain the following command file:

video L                 ; Set video mode to 320x200x256 VGA
pload PALETTE,1         ; Load palette.pic into picture buffer 1
palette 1               ; Set the palette
pfree 1                 ; Free picture buffer 1
cload CLP0,1            ; Load clp0.pic into buffer 1
cload CLP1,2            ; Load clp1.pic into buffer 2
cload CLP2,3            ; Load clp2.pic into buffer 3
cload CLP3,4            ; Load clp3.pic into buffer 4
cload CLP4,5            ; Load clp4.pic into buffer 5
forever:                ; Label
putup 80,50,1,10        ; Display buffer 1
putup 80,50,2,10        ; Display buffer 2
putup 80,50,3,10        ; Display buffer 3
putup 80,50,4,10        ; Display buffer 4
putup 80,50,5,10        ; Display buffer 5
putup 80,50,5,10        ; Display buffer 5
putup 80,50,4,10        ; Display buffer 4
putup 80,50,3,10        ; Display buffer 3
putup 80,50,2,10        ; Display buffer 2
goto forever            ; GOTO 'forever' label (and repeat
						; display of buffers)

Image Files

Each frame in a GRASP animation is stored using the Pictor PC Paint file format. Files with the .PIC extension contain a color map, whereas files with the .CLP extension do not. It is common for a GRASP animation to include a single .PIC file that contains only a color map and to store all of its animation frames as mapless .CLP files.

For more information about the Pictor PC Paint file format, refer to the article about it later in this book.

Font File

Text is displayed in a GRASP animation by first loading a font and then displaying it using the text command. Fonts are stored with the extension .FNT or .SET. A font file may contain data for up to 256 font characters. The header for the font file is shown below:

typedef struct _FontHeader
  WORD FileLength;             /* Size of font file in bytes */
  BYTE NumberOfCharacters;     /* Number of characters in file */
  BYTE FirstCharacterValue;    /* ASCII value of first character */
  BYTE CharacterWidth;         /* Width of character in pixels */
  BYTE CharacterHeight;        /* Height of character in pixels */
  BYTE CharacterSize;          /* Size of character in bytes */

FileLength is the size of the font file in bytes, including header.

NumberOfCharacters is the number of font character defined in this file. This number may be 0 through 255, with 0 representing 256 characters stored.

FirstCharacterValue is the ASCII value of the first font character appearing in the data (font characters are arranged in ASCII value order). Most fonts start with the space character (ASCII value 20h).

CharacterWidth and CharacterHeight represent the size of the font in pixels.

CharacterSize is the number of bytes required to store each font character. This value is usually calculated from the pixel size of the font (CharacterWidthxCharacterHeight / 8).

The font data immediately follows the header. Each character is stored by row, and each row is padded out to the nearest byte boundary. An 8x16 font contains sixteen rows by eight columns of 1-bit pixels. A 0 bit indicates black and a 1 bit indicates color.

An 8x16 font requires 16 bytes of data per character to store. A full 256-character font is then 4096 bytes in size. The maximum size of a font file is 64K.

For Further Information

For further information about GRASP, see the article included on the CD-ROM.

GRASP was originally created by Microtext Incorporated of Irvine, CA. It was bought in 1988 by Paul Mace software, where it is maintained today. Information on GRASP and GRASP Multimedia may be obtained directly from Paul Mace Software:

Paul Mace Software, Inc.
Attn: Steven Belsky
400 Williamson Way
Ashland, Oregon 97520
Voice: 503-488-2322
FAX: 503-488-1549
BBS: 503-482-7435

This page is taken from the Encyclopedia of Graphics File Formats and is licensed by O'Reilly under the Creative Common/Attribution license.

More Resources