Important: The information in this document is obsolete and should not be used for new development.
CharacteristicsThe QuickDraw GX data stream format is used whenever a QuickDraw GX shape is stored to disk or printed. Likewise, the data stream must be interpreted whenever the flattened shape is to be used. The QuickDraw GX stream format is
- Extensible. The data stream includes type constants called opcodes that specify the meaning of the data that follows in the data stream and record size values that indicate the number of bytes in the record that follow. The opcode and size are always in the same format. If a reader of a QuickDraw GX data stream doesn't understand the information contained in the stream, the reader can choose to skip to the next opcode. Some opcode constants are reserved for future expansion.
- Byte oriented. QuickDraw GX uses a byte-oriented stream format so that it is simple for different processors to interpret the flattened shape information. Multiple byte-oriented data streams, using words (2 bytes) or long words (4 bytes), are larger and therefore are not as efficient for storing, retrieving, and printing shapes.
- Efficient. The QuickDraw GX data stream format contains a highly structured optimized set of data that minimize the amount of irrelevant information. For example, if your application creates a shape and then moves the shape to another position, the flattened shape stream format describes only the final position of the shape and does not include a description of the intermediate move.
- Compressed. The
GXFlattenShapefunction always applies a compression algorithm to the flattened shape. The degree of compression that is achieved depends upon the shape and the objects that make up the shape. If applying the compression algorithm results in a data stream that is larger than the original, the original data is adopted as the default. When you call the
GXFlattenShapefunction, you are thereby always assured of a data stream format that is equal to or smaller than the original data format. Data in a QuickDraw GX stream format consists of single bits, multiple bits, a byte, multiple bytes, a word, multiple words, a long word, or multiple long words. The QuickDraw GX compression algorithm attempts to minimize the number of bits that are required to represent the data required to describe each object and its properties. For example, the long fixed-point number 125.0, 0x007D0000, requiring 4 bytes may be compressed to the byte 125, 0x7D, requiring only 1 byte. This substitution makes the data stream 3 bytes smaller, while maintaining the integrity of the data value. When the shape is unflattened, the byte must be converted back to its original long value. The QuickDraw GX stream format also compresses the data stream bytes that contain opcodes. These opcode bytes consist of a 2-bit field and a 6-bit field that are packed into1 byte.
- Shape oriented. Each QuickDraw GX shape is described by a style object, ink object, transform object, and shape object. When a QuickDraw GX shape is flattened, a new data format is created that contains all of the essential information required to define the original shape. All of the objects and properties that are required to describe all of the QuickDraw GX shapes are included in the data stream.