Graphics File Format
This section describes the WordPerfect Graphics (WPG) File Format, version 2.0. Major
enhancements to version 1.0 of the format include the following:
WPG files store graphics images for use by WordPerfect products. The images are created by
WordPerfect Presentations or by converting images from other formats. An exception to this is
EPS graphics files, where the initial data remains unchanged but is encased in a WPG record.
WordPerfect Graphics files do not need to have a specific file extension, although the extension
.WPG is recommended. When performing save and retrieve operations, Presentations appends
the .WPG extension to any filename without an extension.
WordPerfect Graphics files consist of a file prefix containing document summary information
and a file body containing image description information. Data within the file body is divided
into records. This section of the Software Developer's Kit describes these records and the format
and meaning of the data associated with them.
Size Definitions
Sizes are referred to as bytes, short integers (sometimes abbreviated as short), long integers
(sometimes abbreviated as long), and quadwords. Depending on the environment and operating
system, these terms can mean different things. Fields depicted in the Record Area portion of the
documentation have the field name encased in brackets. The brackets indicate the size of the
field. Use the table below to match the bracket types with the size and terms they represent.
Terms | Names | Brackets | Size |
Byte | character (char), byte | <> | 8 bits |
Short | short integer, word | [] | 16 bits |
Long | long integer, double word | {} | 32 bits |
Quadword | 64 bits |
Here are some examples of how these brackets are used in the record descriptions of the Record
Area information:
Field | Explanation |
<drawing flags> | 8-bit area composed of bit flags |
[Name Length] | 16-bit value representing the # of characters in "Name" |
{Address Pointer} | 32-bit value representing an address pointer |
Color | 64-bit value representing some color data |
Multiple fields are shown with a space followed by a lowercase x, then another space, and finally
the multiple of the field. Here are some examples:
<file name string> x 13
{WP word string} x 30
<text string> x ?
The first example represents a field with the size of 13 bytes. The second example represents a
field that is an array of 30 short integers. The third example represents a field that includes one
or more bytes.
As mentioned, WPG records support byte (8-bit), short integer (16-bit), long integer (32-bit), and
quadword (64-bit) data. The byte sequence of all data types that are larger than a byte follows
Intel convention with the least-significant byte first. The following three block diagrams show
this coding format for short integer, long integer, and quadword.
short integer | |||||||||||||||
low byte | high byte | ||||||||||||||
high nibble | low nibble | high nibble | low nibble | ||||||||||||
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
long integer | |||||||||||||||||||||||||||||||
low short | high short | ||||||||||||||||||||||||||||||
low byte | high byte | low byte | high byte | ||||||||||||||||||||||||||||
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
quadword | |||||||
low long | high long | ||||||
low short | high short | low short | high short | ||||
low byte | high byte | low byte | high byte | low byte | high byte | low byte | high byte |
Decimal numbers are followed by a number in parentheses that begins with 0x, such as (0xFF).
This represents the equivalent value in the hexadecimal number system. In most cases values are
unsigned. An example of an unsigned value is 255 (0xFF). An example of a signed value is -1 (0xFF).
WordPerfect Word Strings
Some fields in packets and in drawing records hold text that is marked as "WP word,"
"WordPerfect word" or "word" strings. The reference to "word" is to the Intel assembly language
term for an unsigned short integer. In this format each character of a string takes up one short
integer. The high byte is the number of the WordPerfect character set. The low byte contains an
offset value into the character set that represents the position of the actual character.
WordPerfect word strings require that all characters in the string have 16-bit values including any
null terminator. However, byte strings of 8-bit characters can have 16-bit characters embedded
within the string. This is accomplished with a function code that shows the beginning of a text
block using 16-bit characters, and the same function code is repeated to show the end of the
block. For the format of this code, see the Extended Character function 240 (0xF0) under
Fixed-Length Multi-Byte Functions, in the Document File Format section of this manual.