Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 7 - QuickDraw GX Stream Format / About QuickDraw GX Stream Format


Data

The sequence of the optional object-specific data that follows a data type opcode byte is predetermined and consists of type constants and data. Some data sequences are preceded by an omit byte. An omit byte is included in the data stream format to describe the presence or absence, meaning, order, and compression of data that corresponds to the fields of a type or the properties of an object. If an omit byte is not present for an object, then, with the exception of bitmaps and transforms, the compression type opcode in the data type opcode byte defines the data compression.

Omit Byte Masks and Omit Byte Shifts

The omit byte provides an efficient method of assigning different data compressions to type constants and object properties that immediately follow the omit byte. Figure 7-7 shows the relationship of the bits in an omit byte and the four constants or properties that follow.

Figure 7-7 Omit byte relationship with the data that follows

The compression type constants used in the omit byte are defined in the gxTwoBitCompressionValues enumeration listed in Table 7-2. Long, word, or byte data compression is applied if the enumeration constants are 0x00, 0x40, 0x80, respectively. If the constant is 0xC0, the compression is "omit compression," then the stream format does not include the field or property. For example, if the omit byte in Figure 7-7 contained 0x0C for bits 3 and 2, Data 3 constant or property would not appear in the stream and Data 4 would follow Data 2.

Some omit byte enumerations provide multiple bytes of mask constants and shift constants to accommodate the description of all of the properties of an object or all of the fields of a structure. For example, the description of a layout shape requires three omit bytes to specify the compression of all of the properties. The data corresponding to each omit byte mask follows the mask. For multiple masks, the sequence is omit mask1, data, omit mask2, data, omit mask3, data, and so on.

You can use an omit byte mask and its corresponding omit byte shift to interpret the meaning of each of the bits in the omit byte. Each entry in an omit mask enumeration has a name and a value. The name describes the property. The hexadecimal value of the mask is given in the enumeration. The binary equivalent is the mask.

Table 7-10 shows a typical omit byte mask enumeration and its corresponding omit byte shift enumeration values. The example shows the gxOmitTextMask enumeration binary mask values and the bit shift from the corresponding gxOmitTextShift enumeration.
Constants from the gxOmitTextMask and the gxOmitTextShift enumerations
gxOmitTextMask enumerationEnumeration
value
Binary mask
value
Bit shift
constant
gxOmitTextCharacterMask0xC0110000006
gxOmitTextPositionXMask0x30001100004
gxOmitTextPositionYMask0x0C000011002
gxOmitTextDataMask0x02000000101

Figure 7-8 shows how you can use an omit mask and corresponding omit shift to analyze an omit byte in the data stream.

Figure 7-8 Select the bits from the omit byte

First, the bits in the omit byte are masked with the gxOmit_Mask enumeration with a value of 0xC0 and a binary value 11000000. This mask selects the first two high-order bits of the omit byte. In order to interpret the two bits selected, shift the bits to the right by the number of bits indicated by the gxOmit_Shift enumeration value. Once the bits are selected and shifted, determine the compression of the data that follows by comparing these bits with the gxTwoBitCompressionValues enumeration, as shown in Figure 7-9. The values of the gxTwoBitCompressionValues enumeration are given in Table 7-2.

Figure 7-9 Compare the bits selected and shifted with the compression enumeration

Here is an example of how this works with an omit byte describing the shape object for a text shape. First you need to correlate the names of the constants in the omit mask enumeration with the structures, enumerations, or properties of the object that they describe. For more information on correlating omit bytes, see the appropriate object-specific heading in the section"Data" beginning on page 7-22.

Table 7-11 shows the correlation between the gxOmitTextMask names and the parameters of the GXNewTextFunction.
Correlation between gxOmitTextMask and the GXNewText function
Constants in the gxOmitTextMask enumerationText shape property
gxOmitTextCharacterMaskcharCount
gxOmitTextPositionXMaskposition .x
gxOmitTextPositionYMaskposition .y
gxOmitTextDataMasktext

A summary of these constants is provided in Table 7-10. The gxOmitTextMask enumeration constants correlate with the properties of the text shape. The text shape is described in the text shape chapter of Inside Macintosh: QuickDraw GX Typography.

The order of the gxOmitTextMask enumeration tells us that the data to follow will be in the sequence charCount, position .x, position .y, and text.

For instance, suppose the omit byte is 0xA4 or binary 10100100.

The binary mask value for the gxOmitTextCharacterMask, 11000000, selects the high order 2 bits, 10. The gxTwoBitCompressionValues enumeration with value 2 is gxByteCompression. The data for charCount is therefore byte compressed.

The binary mask value for the gxOmitPositionXMask, 00110000, selects the next 2 bits, 10. The gxTwoBitCompressionValues enumeration with value 2 is again gxByteCompression. The data for position.x is therefore byte compressed.

The binary mask value for the gxOmitPositionYMask, 00001100, selects the next 2 bits, 01. The gxTwoBitCompressionValues enumeration with value 1 is gxWordCompression. The data for position.y is therefore word compressed.

The binary mask value for the gxOmitTextDataMask, 10, selects the next bit, 0. The gxTwoBitCompressionValues enumeration with value 0 is gxNoCompression. The text data is therefore not compressed.

The above example is from the analysis of a data stream of a flattened text shape. For additional information about this example see the section "Analyzing a Flattened Text Shape" beginning on page 7-72.

One or more omit mask bytes are included in the data stream whenever specific enumeration or structure data is required to describe a specific object.

Omit mask and omit shift enumerations can be used to analyze QuickDraw GX omit bytes and compare the masked bits to other values.

An omit byte is first masked to obtain the bits desired. The bits are then shifted using the omit shift enumeration that corresponds to the omit byte. The resulting bits can then be compared to other data in your application to obtain information about the data stream.

Listing 7-1 shows how to determine if the x-coordinate of the position field in a flattened shape data stream is compressed.

Listing 7-1 Determining if position(x) is byte compressed

unsigned char a = ReadByte();
if ((a & (gxOmitTextPositionXMask >> gxOmitTextPositionXShift)) ==
    gxByteCompression
{
/* perform an action */
}
The function reads the byte, masks it with gxOmitTextPositionXMask to obtain the desired two bits, and then shifts it by the amount given by the gxOmitTextPositionShift. The resulting 2 bits can now be compared to the 2 bits of gxByteCompression.

Header Data

The header marks the beginning of a new flattened shape in the data stream. The gxHeaderTypeOpcode constant indicates that the version of QuickDraw GX that generated the data stream follows. As new versions become available, older software may not be able to interpret the newer portions of a data stream. The interpreter can then look at the version number and skip over versions that it doesn't understand. For example, if an interpreter that understands only QuickDraw GX version 1.0 encounters version 2.0 or if the interpreter finds a version 1.0 opcode, but doesn't recognize the data, an error is posted.

The byte after the version byte contains the gxFontListFlatten and gxFontGlyphsFlatten flags. These flags are functional only if the shape contains text.

The gxFontListFlatten flag instructs the GXFlattenShape function to attach a tag object to the flattened shape containing a list of the fonts referenced in the shape. A list of all of the fonts used in the data stream are included at the end of the data stream.

The gxFontGlyphsFlatten flag instructs the GXFlattenShape function to attach a tag to the flattened shape containing a list of the specific glyphs used from each font referenced by the shape. A list of all of the glyph codes used by all of the fonts referenced in a data stream is then included at the end of that data stream.

For more information about the font and glyph list flags, see the chapter "Shape Objects" in Inside Macintosh: QuickDraw GX Objects.

The font list and glyph list are combined to form a tag that is of type gxFlatFontListItem and designated 'flst'. During printing, only the fonts and glyphs used in the stream are loaded to the printing device.

The gxFlatFontList structure includes the gxFlatFontListItem structure. The gxFlatFontListItem contains two arrays. The first is the array of font names. The second is the array of glyphs that are used. The array of glyphs is obtained by setting a bit in an array for each glyph that is used. If you ask only for the font names, the glyph array will be omitted. The glyphs array cannot be selected without the font array selected. In other words, you may specify either a list of fonts or specify a list of fonts and glyphs to be listed at the end of the data stream.

The fonts and glyphs included in the flattened list, 'flst', are used in the print file for the QuickDraw GX portable digital document. For more information on the QuickDraw GX portable digital document see the section "Portable Digital Documents" beginning on page 7-53.

For more information on the QuickDraw GX print file, see the section "About Print Files and Portable Digital Documents" beginning on page 7-51. For more information about how to use the print file data, see the section "Obtaining Data From a Print File" beginning on page 7-89.

For more information on the gxFlatFontName, gxFlatFontListItemTag, and gxFlatFontList structures see the chapter "Fonts" in Inside Macintosh: QuickDraw GX Typography.

New Shape Object Data

A new shape object always follows the style, ink, transform, and any other objects that have been built for the shape object in the data stream. New shape data follows an operation opcode gxNewObjectOpcode constant and a data type opcode containing one of the constants in the gxGraphicsNewOpcode enumeration. Values 1 (gxEmptyType) through 13 (gxPictureType) are the constants from the gxShapeTypes enumeration.

This opcode creates a new shape object with all of the properties of the previous shape object in the data stream. If the current shape object is the first shape object in the stream, then it is created with default properties.

The values of the constants for all of the shape objects are summarized in Table 7-3. Shape types are described in the chapter "Shape Objects" in Inside Macintosh: QuickDraw GX Objects.

Empty Shape Data

The data type opcode with a value 1 is the gxEmptyType constant. Empty shapes store no information in their geometries. For the current shape object, the gxEmptyType means that the current shape is an empty shape. No data follows.

The gxEmptyTypes constant is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Point Shape Data

The data type opcode with a value 2 is the gxPointType constant. The data for the fields of a gxPoint structure follows. The data sequence is x (Fixed), y (Fixed).

Compression data: gxNoCompression - read 2 longs per point; gxWordCompression - read 2 shorts per point or treat each short as a signed integer (120 = 120.0 and -171 = -171.0); gxByteCompression - read 2 bytes per point and treat each byte as a signed integer (7 = 7.0 and -13 = -13.0).

The gxPoint structure is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Line Shape Data

The data type opcode with a value 3 is the gxLineType constant. The data for the fields of the gxLine structure follows. The data sequence is first.x,first.y last.x,last.y.

Compression data: gxNoCompression - read 2 longs per point; gxWordCompression - read 2 shorts per point or treat each short as a signed integer (120 = 120.0 and -171 = -171.0); gxByteCompression - read 2 bytes per point and treat each byte as a signed integer (7 = 7.0 and -13 = -13.0).

The gxLine structure is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Curve Shape Data

The data type opcode with a value 4 is the gxCurveType constant. The data for the fields of the gxCurve structure follows. The fields in the structure correspond to the parameters in the GXNewCurve function. The data sequence is x (first point), y (first point), x (control point), y (control point), x (last point), and y (last point).

Compression data: gxNoCompression - read 2 longs per point; gxWordCompression - read 2 shorts per point or treat each short as a signed integer (120 = 120.0 and -171 = -171.0); gxByteCompression - read 2 bytes per point and treat each byte as a signed integer (7 = 7.0 and -13 = -13.0).

The gxCurve structure is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Rectangle Shape Data

The data type opcode with a value 5 is the gxRectangleType constant. The data for the fields of the gxRectangle structure follows. The data sequence is left, top, right, bottom. Typically, the first corner is left-top and the second corner is right-bottom; but this order is not required. They need only be opposite corners of a rectangle.

Compression data: gxNoCompression - read 2 longs per point; gxWordCompression - read 2 shorts per point or treat each short as a signed integer (120 = 120.0 and -171 = -171.0); gxByteCompression - read 2 bytes per point and treat each byte as a signed integer (7 = 7.0 and -13 = -13.0).

The gxRectangle structure is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Polygon Shape Data

The data type opcode with a value 6 is the gxPolygonType constant. The data for the fields of the gxPolygons structure follows. The gxPolygons structure includes the gxPolygon structure.

The data sequence is contours, vectors, omit byte, x (first point), y (first point), x (second point), y (second point), x (third point), y (third point), and so on. The numbers are compressed as fixed-point numbers.

The point array for polygons and paths stream is stored as relative positions, not absolute positions ( as is the case for the point arrays in polygon and path shapes.)

The omit byte is interpreted by the gxOmitPathMask and gxOmitPathShift enumerations.

The first two entries of the omit byte describe the compression for the first two points of the polygon shape, which are absolute. The numbers are compressed as fixed-point numbers: gxNoCompression means 1 long for each fixed number; gxWordCompression means 1 short for each fixed number treated as an integer
(17 = 17.0); gxByteCompression means 1 byte per fixed number. Thus a byte compressed value can represent an integer fixed point number from -128.0 to 127.0; a word compression value can represent any integer fixed-point number.

The second two entries in the omit byte describe the compression for the second through the last points in the contour. The coordinates of these points are relative to the first absolute points and appear in the stream as differences. The relative values are stored as differences. Thus each x value in the stream is subtracted from the prior value to reconstruct the original value. Conversely, each value in the shape is subtracted from the prior value to compute the delta to be written to the stream. The x and y coordinate values are considered separately. Each may be independently byte, word, or long compressed, using the same fixed-point compression as the absolute values. Each subsequent contour has its own omit byte to describe the absolute initial point values and the subsequent relative point values.

The compression bits in the data type opcode byte control the compression of the contour counts and all vector counts. Compression data: gxNoCompression - read 1 long for contour and each vector count; gxWordCompression - read 1 word for contour count and each vector count; gxByteCompression - read 1 byte for contour count and each vector count.

The gxPolygons structure is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Path Shape Data

The data type opcode with a value 7 is the gxPathType constant. The data for the fields of the gxPaths structure follows. The gxPaths structure includes the gxPath structure.

The data sequence is contours (number of contours), vectors (number of points in the contour), control bytes, omit byte, x (absolute coordinate of first point), y (absolute coordinate of first point), x (relative coordinate of second point), y (relative coordinate of second point), x (relative coordinate of third point), y (relative coordinate of third point), and so on.

A control byte contains control bits for each point off or on the path. Each point is assigned a bit. Bits with value 1 are off the path; bits with value 0 are on the path. If the number of points exceeds 8, multiple control bytes are used. If the number of points is not an even multiple of 8, the final unused bits are ignored.

The omit byte is interpreted by the gxOmitPathMask and gxOmitPathShift enumerations.

The first two entries of the omit byte describe the compression for the first two points of the path shape, which are absolute coordinates. The numbers are compressed as fixed-point numbers: gxNoCompression means 1 long for each fixed number; gxWordCompression means 1 short for each fixed number treated as an integer
(17 = 17.0); gxByteCompression means 1 byte per fixed number. Thus a byte compressed value can represent an integer fixed point number from -128.0 to 127.0; a word compression value can represent any integer fixed-point number.

The second two entries in the omit byte describe the compression for the second through the last relative points in the contour. The coordinates of these points are relative to the first absolute points and appear in the stream as differences. Thus each x value in the stream is subtracted from the prior value to reconstruct the original value. Conversely, each value in the shape is subtracted from the prior value to compute the delta to be written to the stream. The x and y coordinate values are considered separately. Each may be independently byte, word, or long compressed, using the same fixed-point compression as the absolute values. Each subsequent contour has its own omit byte to describe the absolute initial point values and the subsequent relative point values.

The compression bits in the data type opcode byte control the compression of the contour counts and all vector counts. Compression data: gxNoCompression - read 1 long for contour and each vector count; gxWordCompression - read 1 word for contour count and each vector count; gxByteCompression - read 1 byte for contour count and each vector count.

The gxPaths structure is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Bitmap Shape Data

The data type opcode with a value 8 is the gxBitmapType constant. The data for the fields of the gxBitmap and gxPoint structures follow. The gxBitmap structure includes the gxColorSpace enumeration and the references to the gxColorSet and gxColorProfile structures.

The data sequence is omit byte 1, image reference, width, height, rowBytes, omit byte 2, pixelSize, space (color space), set (color set), profile (color profile), omit byte 3, x (position), y (position).

Omit byte 1 is interpreted by the gxOmitBitmapMask1 and gxOmitBitmapShift1 enumerations. Omit byte 2 is interpreted by the gxOmitBitmapMask2 and gxOmitBitmapShift2 enumerations. Omit byte 3 is interpreted by the gxOmitBitmapMask3 and gxOmitBitmapShift3 enumerations.

Data compression: The value may be a byte, word, or long. The value references a previous bit image: a value of 1 references the first bit image, a value of 2 references the second bit image, etc. A value of 0 indicates that the bitmap references a bit image through a file alias. The bitmap shape must reference a tag containing the file alias and offset as described in the chapter "Tag Objects" in Inside Macintosh: QuickDraw GX Objects. All bitmap values are compressed as integers (see polygon coutour compression above) except for the x and y coordinate positions. These are compressed as Fixed (see polygon first absolute position). Unlike prior shape types in this section, bitmaps and shape types described below can also have fields with the gxOmitCompression bits set. In this case, the value 0 or nil is used wherever the omit compression bits are set.

The gxBitmap structure is described in the chapter "Bitmap Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Text Shape Data

The data type opcode with a value 9 is the gxTextType constant. The data that follows corresponds to the parameters of the GXNewText function.

The data sequence is omit byte, byte length (of text), x (position), y (position), charCount (number of characters), data (character text).

The data is the character stream or glyph indexes for the text. For nonRoman scripts, the actual byte length may be more than the number of characters.

The omit byte is interpreted by the gxOmitTextDataMask and gxOmitTextDataShift enumerations.

Data compression: The byte length is compressed as a long. The x and y coordinates are compressed as a fixed number. The data stream may contain bytes or shorts. If the stream contains shorts and all values are less than 255, then the stream may be compressed. It is an error to specify a character count of zero (omit compression) and to set the text data omit bit.

The GXNewText function is described in the chapter "Text Shapes" in Inside Macintosh: QuickDraw GX Typography.

Glyph Shape Data

The data type opcode with a value 10 is the gxGlyphType constant. The data correspond to the parameters in the GXNewGlyphs function and include the gxPoint and gxStyle structures.

The data sequence is omit byte 1, charCount (number of characters), byte length (of text), runNumber (number of runs), data (glyph character), omit byte 2, positions, advance, tangents, styleRuns, glyphStyles.

Omit byte 1 is interpreted by the gxOmitGlyphDataMask1 and gxOmitGlyphDataShift1 enumerations. Omit byte 2 is interpreted by the gxOmitGlyphDataMask2 and gxOmitGlyphDataShift2 enumerations.

Data compression: charCount, byte length, and runNumber are compressed as longs. If charCount is 0, the data, positions, advance, and tangents are not read. If the gxOmitGlyphOnePosition bit is set in the first byte, then the glyph shape contains 1 absolute position or as many positions as there are in the stream. In either case, all are compressed as fixed point values, as bytes, words, or longs. Unlike polygon positions, the x and y values do not have separate compression bits, nor are the positions stored in the relative manner of polygons or paths.

The advances in the glyph shape are read after the positions, if the gxOmitGlyphAdvance bits are not gxOmitCompression constant. The character count determines the number of bytes read, as is the case with the control bits in a path shape.

If the gxOmitGlyphTangent bits in the second omit byte are not equal to the gxOmitCompression constant, the tangents parameter follows. The tangent values are stored and compressed identically to the positions. If the number of runs (runNumber) is greater than zero, then 1 bit in the second omit byte interprets the runs as shorts or shorts compressed to bytes (like the text character compression). If runNumber is greater than 0, then the style array is compressed into an array of bytes, words, or longs. The values are references to previous styles in the stream: a value of 1 references the 1st style in the stream, and so on.

The GXNewGlyphs function is described in the chapter "Glyph Shapes" in Inside Macintosh: QuickDraw GX Typography.

Layout Shape Data

The data type opcode with a value 11 is the gxGlyphType constant. The data correspond to the parameters in the GXNewLayout function.

Layouts are compressed in a way that is similar to glyphs. Like all types that are greater than or equal to bitmap type, all fields default to zero and omit compression is allowed. If the length is greater than 0, the data is read as shorts compressed as bytes or as an uncompressed stream (like text and glyphs). If the style run number is greater than 0, the style run array and style array are present identically to the glyph format. If the omitLayoutHasBaseline bit is set in omit byte 3, uncompressed data is read the size of the gxLineBaselineRecord. If the level run number is greater than zero, the 4th omit byte (read regardless) specifies the compression of the levelRunLength and level arrays as an optionally compressed array of shorts.

The data sequence is omit byte 1, length, x (position), y (position), data, omit byte 2, width, flush, set, just, options, omit byte 3, style, run number, level run number, hasBaseline, style runs, styles, omit byte 4, level runs, levels.

Omit byte 1 is interpreted by the gxOmitLayoutMask1 and gxOmitLayoutShift1 enumerations. Omit byte 2 is interpreted by the gxOmitLayoutMask2 and gxOmitLayoutShift2 enumerations. Omit byte 3 is interpreted by the gxOmitLayoutMask3 and gxOmitLayoutShift3 enumerations. Omit byte 4 is interpreted by the gxOmitLayoutMask4 and gxOmitLayoutShift4 enumerations.

The GXNewLayout function is described in the chapter "Layout Shapes" in Inside Macintosh: QuickDraw GX Typography.

Full Shape Data

The data type opcode with a value 12 is the gxFullType constant. Full shapes store no information in their geometries. For the current shape object, the gxFullType constant is a parameter in the GXNewShape function. No data follows.

The gxFullType constant is described in the chapter "Geometric Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Picture Shape Data

The data type opcode with a value 13 is the gxPictureType constant. The data corresponds to the parameters in the GXNewPicture function. The data sequence is omit byte 1, the number of items (compressed as long as specified by the data type opcode), followed by an array of shapes and optional arrays of styles, inks, and transforms. The shape array must exist and may not contain nil (zero) references. The styles, inks and transform array references may be omitted entirely.

The gxPicture structure is described in the chapter "Picture Shapes" in Inside Macintosh: QuickDraw GX Graphics.

Modified Shape Object Data

Once a shape object is defined, it can be modified. Modified shape data follow a gxSetDataOpcode operation opcode and a data type opcode containing one of the constants from the gxShapeDataOpcode enumeration. Table 7-4 summarizes the values of the constants for all of the modified shape objects.

Attributes Data

An attribute is added to the current shape object if the data type opcode has value 0. This is the gxShapeAttributesOpcode constant.

The data for the fields of the gxShapeAttributes structure follow and are compressed as long. That data may be 1, 2, or 4 bytes depending on the compression bits.

The gxShapeAttributes enumeration is described in the chapter "Shape Objects" in Inside Macintosh: QuickDraw GX Objects.

Tag Data

A tag is added to the current shape if the data type opcode has value 1. This is the gxShapeTagOpcode constant. The data for the parameters of the GXSetShapeTags function follows.

The size of the opcode specifies the number of tags; the compression specifies whether the data is in bytes, words, or longs. For instance, if the size is 4 and the compression is gxShortCompression (2 bytes), then the stream contains 4/2 == 2 tags. The equivalent operation would be GXSetShapeTags (shape, nil, 1, 0, 2, tag array).

The GXSetShapeTags function is described in the chapter "Shape Objects" of Inside Macintosh: QuickDraw GX Objects.

Fill Data

A shape fill, compressed as long, is added to the current shape if the data type opcode has value 2. This is the gxShapeFillOpcode. A constant from the gxShapeFill enumeration follows.

The gxShapeFills enumeration is described in the chapter "Shape Objects" in Inside Macintosh: QuickDraw GX Objects.

New Style Object Data

Data for a new style object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 28. This is the gxStyleTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

This opcode creates a new style object with all of the properties of the previous style object in the data stream. If the current style object is the first style object in the stream, then it is created with default properties. No data follows for the new style object.

The style object is described in the chapter "Style Objects" in Inside Macintosh: QuickDraw GX Objects.

Modified Style Object Data

Once a style object is defined, it can be modified by the addition of style data. Modified style data follows a gxSetDataOpcode operation opcode and a data type opcode containing one of the constants from the gxStyleDataOpcode enumeration. Table 7-5 summarizes the values of the constants for all of the modified style objects. For all style data, the opcodes described in the following subsections change the default style.

Attributes Data

An attribute is added to the current style object if the data type opcode has value 0. This is the gxStyleAttributesOpcode constant.

The data, compressed as long, for the fields of the gxStyleAttribute structure follow and may be byte, short, or long.

The gxStyleAttributes enumeration is described in the chapter "Geometric Styles" in Inside Macintosh: QuickDraw GX Graphics.

Tag Data

A tag is added to the current style if the data type opcode has value 1. This is the gxStyleTagOpcode constant. The data for the parameters of the GXSetStyleTags function follows.

The size of the opcode specifies the number of tags; the compression specifies whether the data is in bytes, words, or longs. For instance, if the size is 4 and the compression is gxShortCompression (2 bytes), then the stream contains 4/2 == 2 tags. The equivalent operation would be GXSetShapeTags (shape, nil, 1, 0, 2, tag array);

The GXSetStyleTags function is described in the chapter "Style Objects" in Inside Macintosh: QuickDraw GX Objects.

Curve Error Data

A curve error, compressed as fixed-point, is added to the current style if the data type opcode has value 2. This is the gxStyleCurveErrorOpcode constant. The data for the error (Fixed) parameter of the GXSetStyleCurveError function follows.

For fixed point compression gxNoCompression means 1 long for each fixed number; gxWordCompression means 1 short for each fixed number treated as an integer
(17 = 17.0); gxByteCompression means 1 byte per fixed number. Thus a byte compressed value can represent an integer fixed point number from -128.0 to 127.0; a word compression value can represent any integer fixed-point number.

The GXSetStyleCurveError function is described in the chapter "Geometric Styles" in Inside Macintosh: QuickDraw GX Graphics.

Pen Data

A pen, compressed as fixed point, is added to the current style object if the data type opcode has value 3. This is the gxStylePenOpcode constant. The data for the pen (Fixed) parameter of the GXSetStylePen function follows.

For fixed-point compression gxNoCompression means 1 long for each fixed number; gxWordCompression means 1 short for each fixed number treated as an integer
(17 = 17.0); gxByteCompression means 1 byte per fixed number. Thus a byte compressed value can represent an integer fixed point number from -128.0 to 127.0; a word compression value can represent any integer fixed-point number.

The GXSetStylePen function is described in the chapter "Geometric Styles" in Inside Macintosh: QuickDraw GX Objects.

Join Data

A join is added to the current style object if the data type opcode has value 4. This is the gxStyleJoinOpcode. The data for the fields of the gxJoinRecord structure follows. The gxJoinRecord structure includes the gxShape and gxJoinAttribute structures.

The data sequence is omit byte, attributes (modifier flags) compressed as long, join (corner shape) compressed as long (reference), miter (size limit) compressed as fixed point.

The omit byte is interpreted by the gxOmitJoinMask and gxOmitJoinShift enumerations.

The gxJoinAttribute structure is described in the chapter "Geometric Styles" in Inside Macintosh: QuickDraw GX Graphics.

Dash Data

A dash is added to the current style object if the data type opcode has value 5. This is the gxStyleDashOpcode constant. The data for the fields of the gxDashRecord structure follows. The gxShape and gxDashAttribute enumerations are included in the gxDashRecord structure.

The data sequence is omit byte 1, attributes (modifier flags) compressed as long, dash (shape used for dash) compressed as long (reference), advance (distance between dashes) compressed as long, phase (start offset) compressed as fract, omit byte 2, and scale (height of dash) compressed as fixed.

In fract compression a long means a full fract; a word means that 16 bits are read followed by 16 bits of zeros; a byte means that 8 bits are read followed by 24 bits of zeros. Thus numbers like 1.0, -1.0, or fract 0.5 fit into a compressed byte.

Omit byte 1 is interpreted by the gxOmitDashMask1 and gxOmitDashShift1 enumerations. Omit byte 2 is interpreted by the gxOmitDashMask2 and gxOmitDashShift2 enumerations.

The gxDashRecord structure is described in the chapter "Geometric Styles" of Inside Macintosh: QuickDraw GX Graphics.

Caps Data

A cap is added to the current style object if the data type opcode has value 6. This is the gxStyleCapsOpcode. The data for the fields of the gxCapRecord structure follows. The gxShape and gxCapAttribute enumerations are included in the gxCapRecord structure.

The data sequence is omit byte, attributes (modifier flags) compressed as long, startCap (shape used at start of contours) compressed as long (reference), endCap (shape used at end of contours) compressed as long (reference).

The omit byte is interpreted by the gxOmitCapMask and gxOmitCapShift enumerations.

The gxCapRecord structure is described in the chapter "Geometric Styles" in Inside Macintosh: QuickDraw GX Graphics.

Pattern Data

A pattern is added to the current style object if the data type opcode has value 7. This is the gxStylePatternOpcode constant. The data for the fields of the gxPatternRecord structure follows. The gxShape, gxPatternAttribute, and gxPoint enumerations are included in the gxPatternRecord structure.

The data sequence is omit byte 1, attributes (modifier flags) compressed as long, pattern (shape to use as pattern) compressed as long (reference), x (x-coordinate of vector u for pattern grid) compressed as fixed, y (y-coordinate of vector u for pattern grid) compressed as fixed, omit byte 2, x (x coordinate of vector v for pattern grid) compressed as fixed, and y (y-coordinate of vector v for pattern grid) compressed as fixed. Note that for all of these, omit (zero) values are permitted.

Omit byte 1 is interpreted by the gxOmitPatternMask1 and gxOmitPatternShift1 enumerations. Omit byte 2 is interpreted by the gxOmitPatternMask2 and gxOmitPatternShift2 enumerations.

The gxPatternRecord structure is described in the chapter "Geometric Styles" in Inside Macintosh: QuickDraw GX Graphics.

Text Attributes Data

A text attribute compressed as long is added to the current style object if the data type opcode has value 8. This is the gxStyleTextAttributesOpcode constant. The data may be byte, word, or long.

The gxTextAttribute enumeration is described in the chapter "Typographic Styles" in Inside Macintosh: QuickDraw GX Typography.

Text Size Data

The text size, compressed as long, for the current style object is specified if the data type opcode has value 9. This is the gxStyleTextSizeOpcode constant. The data for the size (fixed point size of text) parameter of the GXSetStyleTextSize function follows.

The GXSetStyleTextSize function is described in the chapter "Typographic Styles" in Inside Macintosh: QuickDraw GX Typography.

Font Data

A font is added to the current style object if the data type opcode has value 10. This is the gxStyleFontOpcode constant. The attribute data for the GXSetStyleFont function follows. It is compressed as long (reference ); the reference is to a font name defined earlier in the stream

The GXSetStyleFont function is described in the chapter "Typographic Styles" in Inside Macintosh: QuickDraw GX Typography.

Text Face Data

A text face is added to the current style object if the data type opcode has value 11. This is the gxStyleTextFaceOpcode constant. The data for the fields of the gxTextFace structure follows.

The data sequence is omit byte, faceLayers compressed as long, mapping size and advanceMapping.

The advanceMapping in text face and transform mapping is reordered so that common mappings can be stored in fewer bytes. The omit byte and number of layers is followed by an optional byte (whose compression is described by omitFaceMapping).

The value of the byte may be one of the following:
Byte Value
2Mapping contains identity plus elements h and k.
4Same as byte 2, plus elements a and d.
6Same as byte 4, plus elements b and c.
9Same as byte 6 plus elements u, v, and w.

The meaning of the elements mentioned in the previous table are shown in Figure 7-10.

Figure 7-10 Mapping matrix elements

The byte value is multiplied by the compression level to specify the length of the mapping data that follows. Byte compression multiplies by 1; word compression multiplies by 2; long compression multiplies by 4. The values in the left and middle columns are compressed as fixed values. The values in the right column are compressed as fract values. All elements whether the stream contains 2, 4, 6, or 9 numbers, have the same level of compression.

If the faceLayers value is greater than 0, then following the mapping data is an omit byte as described by gxOmitFaceLayer Mask 1. The omit byte is followed by the outlineFill compressed as a long, the flags comrpessed as a long, the outlineStyle and reference compressed as a long, and the outlineTransform, also comrpessed as a long. The second omit byte describes the bold x and bold y, compressed as fixed values. This sequence is repeated for the second and all remaining layers.

The omit byte is interpreted by the gxOmitFaceMask and gxOmitFaceShift enumerations.

The gxTextFace structure is described in the chapter "Typographic Styles" in Inside Macintosh: QuickDraw GX Typography.

Platform Data

The platform, script, and language is defined for the current object if the data type opcode has value 12. This is the gxStylePlatformOpcode constant. Data from the gxFontPlatform, gxFontScript, and gxFontLanguage enumerations follow.

The platform, script, and language are combined into a long and then that value is compressed as a long that is equal to

(platform << 16) | (script << 8) | language
The gxFontPlatform, gxFontScript, and gxFontLanguage enumerations are described in the chapter "Font Objects" in Inside Macintosh: QuickDraw GX Typography.

Font Variations Data

Font variations are added to the current style object if the data type opcode has value 13. The data is uncompressed. This is the gxStyleFontVariationsOpcode constant. The data for the fields of the gxFontVariation structure follows. The gxFontVariationTag structure is included in the gxFontVariations structure.

The data sequence is an array [name (variation tag), value (Fixed)].The opcode size specifies the number of variations in the stream.

The gxFontVariation structure is described in the chapter "Fonts" in Inside Macintosh: QuickDraw GX Typography.

Run Controls Data

Run controls are added to the current style object if the data type opcode has value 14. The data is uncompressed. This is the gxStyleRunControlsOpcode constant. The data for the fields of the gxRunControls structure follows. The opcode size specifies the size in bytes of the run control stream.

The gxRunControls structure is described in the chapter "Layout Line Controls" in Inside Macintosh: QuickDraw GX Typography.

Run Priority Justification Override Data

A run priority justification override is added to the current style object if
the data type opcode has value 15. The data is uncompressed. This is the gxStyleRunPriorityJustOverrideOpcode constant. The data for the fields
of the gxPriorityJustificationOverride structure follows. The opcode size specifies the size in bytes of the run control stream.

The data sequence is an array of delta. The opcode specifies the byte size.

The gxPriorityJustificationOverride structure is described in the chapter "Layout Line Controls" in Inside Macintosh: QuickDraw GX Typography.

Run Glyph Justification Overrides Data

A run glyph justification override is added to the current style object if the
data type opcode has value 16. The data is uncompressed. This is the gxStyleRunGlyphJustOverrideOpcode constant. The data for the fields
of the gxGlyphJustificationOverride structure follows. The gxGlyphJustificationOverride structure includes the gxGlyphcode
and gxWidthDeltaRecord enumerations. The opcode specifies the byte size.

The data sequence is count, glyphJustificationOverrides.

The gxGlyphJustificationOverride structure is described in the chapter "Layout Line Controls" in Inside Macintosh: QuickDraw GX Typography.

Run Glyph Substitutions Data

A run glyph substitution is added to the current style object if the data type
opcode has value 17. The data is uncompressed. This is the gxStyleRunGlyphSubstitutionsOpcode constant. The data for the fields
of the gxGlyphSubstitution structure follows.

The data sequence is count, glyphsubstitutions[].

The GXSetStyleRunGlyphSubstitutions structure is described in the chapter "Layout Line Controls" in Inside Macintosh: QuickDraw GX Typography.

Run Features Data

A run feature is added to the current style object if the data type opcode has value 18. The data is uncompressed. This is the gxStyleRunFeaturesOpcode constant. The data for the fields of the gxRunFeature structure follows.

The data sequence is count, runFeatures[].

The gxRunFeature structure is described in the chapter "Layout Line Controls" in Inside Macintosh: QuickDraw GX Typography.

Run Kerning Adjustments Data

Run kerning adjustment is added to the current style object if the data type opcode has value 19. The data is uncompressed. This is the gxStyleRunKerningAdjustmentsOpcode constant. The data for the fields of the gxKerningAdjustment structure follows.

The data sequence is count, kerningAdjustments[].

The gxKerningAdjustment structure is described in the chapter "Layout Line Controls" in Inside Macintosh: QuickDraw GX Typography.

Style Justification Data

Style justification is added to the current style object if the data type opcode has
value 20. The data is compressed as fract. This is the gxStyleJustificationOpcode constant. The data for the justify parameter of the GXSetStyleJustification function follows.

In fract compression a long means a full fract; a word means that 16 bits are read followed by 16 bits of zeros; a byte means that 8 bits are read followed by 24 bits of zeros. Thus numbers like 1.0, -1.0, or fract 0.5 fit into a compressed byte.

The GXSetStyleJustification function is described in the chapter "Typographic Styles" in Inside Macintosh: QuickDraw GX Typography.

New Ink Object Data

Data for a new ink object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 29. This is the gxInkTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

This opcode creates a new ink object with all of the properties of the previous ink object in the data stream. If the current ink object is the first ink object in the stream, then it is created with default properties. No data follows for the new ink object.

The ink object is described in the chapter "Ink Objects" in Inside Macintosh: QuickDraw GX Objects.

Modified Ink Object Data

Once an ink object is defined, it can be modified by the addition of ink data. Modified style data follows a gxSetDataOpcode operation opcode and a data type opcode containing one of the constants from the gxInkDataOpcode enumeration. Table 7-6 summarizes the values of the constants for all of the modified ink objects.

Attributes Data

An attribute, compressed as long, is added to the current ink object if the data type opcode has value 0. This is the gxInkAttributesOpcode constant.

The data for the fields of the gxInkAttributes structure follow. The next two bytes contain the ink attribute flags.

The gxInkAttributes enumeration is described in the chapter "Ink Objects" in Inside Macintosh: QuickDraw GX Objects.

Tag Data

A tag is added to the current ink object if the data type opcode has value 1. This is the gxInkTagOpcode constant. The data for the parameters of the GXSetInkTags function follows.

The size of the opcode specifies the number of tags; the compression specifies whether the data is in bytes, words, or longs. For instance, if the size is 4 and the compression is gxShortCompression (2 bytes), then the stream contains 4/2 == 2 tags. The equivalent operation would be GXSetShapeTags (shape, nil, 1, 0, 2, tag array).

The sequence is tagType, index, oldCount, newCount, items.

The GXSetInkTags function is described in the chapter "Ink Objects" in Inside Macintosh: QuickDraw GX Objects.

Color Data

A color is added to the current ink object if the data type opcode has value 2. This is the gxInkColorOpcode constant. The data for the fields of the gxInkAttributes structure follow. The data for the fields of the gxColor structure follows.

The data sequence is omit byte, space (long), profile (long). The value of the omit byte may be omit compression.

The omit byte is interpreted by the gxOmitColorsMask and gxOmitColorsShift enumerations.

If space is indexed space, gxOmitColoursIndex is used to determine index compression (compressed as long), which is read first, followed by color set (compressed as long), with the compression determined by gxOmitColorsIndexSet.

If space is not indexed space, the color space determines the number of elements read from the stream as shown in Table 7-12.
Table 7-12 Color space and words read
16-bit1
32-bit2
gray, index1
gray alpha2
RGB, HSV, HLS, YXY, XYZ, LUV, LAB, YIQ3
RGBA, CYMK4

The bits in the omit byte determine whether a word is read from the stream for each word in the component or whether the byte is repeated twice for each word. For example, if the byte contains 0x3A, the word contains 0X3A3A. The gxOmitColorsComponentsMask sets 1 bit for up to 4 components.

The gxColor enumeration is described in the chapter "Ink Objects" in Inside Macintosh: QuickDraw GX Objects.

Transfer Mode Data

A transfer mode is added to the current ink object if the data type opcode has value 3. This is the gxInkTransferModeOpcode constant. The data for the fields of the gxTransferMode structure follow.

The data sequence is omit byte 1, space, compressed as long, set, compresssed as long,profile, compressed as long; omits are allowed. Omit byte 2 follows and then sourceMatrix, deviceMatrix, resultMatrix, flags, and component; omits are allowed.

The sourceMatrix, deviceMatrix, and resultMatrix are compressed as arrays of Fixed values. The color space determines the number of transfer components that follow, as shown in Table 7-12.

Each transfer component is preceded by an omit byte (gxomitTransferComponentMask1) that describes the first 4 fields of the structure. Omit byte one is followed by gxOmitTransferComponentModeMask, compressed as byte, gxOmitTransferComponentFlagsMask, compressed as byte, gxOmitTransferComponentSourceMinimumShift, compressed as color, gxOmitTransferComponentSourceMaximumMask, compressed as color, and gxOmitTransferComponentDeviceMinimumMask, compressed as color. Omit byte 2 follows which describes gxOmitTransferComponentDeviceMaximumMask, gxOmitTransferComponentClampMinimumMask,gxOmitTransferComponentClampMaximumMask,and gxOmitTransferComponentOperandMask;all these are compressed as color. The color compression specifies that the field may be omitted (inherits value from default), or is represented by a repeated byte (for example, 0X7A ==0X7A7A), or is represented as a word.

Note that the mode and flags in the first omit byte have a single bit

The gxTransferMode structure is described in the chapter "Ink Objects" in Inside Macintosh: QuickDraw GX Objects.

New Object Transform Data

Data for a new transform object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x2A. This is the gxTransformTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

This opcode creates a new transform object with all of the properties of the previous transform object in the data stream. If the current transform object is the first transform object in the stream, then it is created with default properties. No data follows for the new transform object.

The transform object is described in the chapter "Transform Objects" in Inside Macintosh: QuickDraw GX Objects. For additional information about transform mapping, see "Mapping Data" on page 7-46.

Modified Transform Object Data

Once a transform object is defined in the data stream, it can then be modified. Modified transform object data follows a gxSetDataOpcode operation opcode and a data type opcode containing one of the constants from the gxTransformDataOpcode enumeration. Table 7-9 summarizes the values of the constants for all of the modified transform objects.

Reserved Opcode for Modified Transform Data

The data type opcode with value 0 is reserved for future expansion.

Tag Data

A tag is added to the current transform object if the data type opcode has value 1. This is the gxTransformTagOpcode constant. The data for the parameters of the GXSetTransformTags function follows.

The data stream sequence is tagType, index, oldCount, newCount, items[].

The GXSetTransformTags function is described in the chapter "Transform Objects" of Inside Macintosh: QuickDraw GX Objects.

Clip Data

A clip, compressed as long (reference) is added to the current transform object if the data type opcode has value 2. This is the gxTransformClipOpcode constant. The data for the clip parameter of the GXSetTransformClip function follows.

The GXSetTransformClip function is described in the chapter "Transform Objects" in Inside Macintosh: QuickDraw GX Objects.

Mapping Data

A mapping is added to the current transform object if the data type opcode has value 3. This is the gxTransformMappingOpcode constant. The data for the map parameter of the GXSetTransformMapping function follows.

A transform mapping is initiated by the sequential appearance of the gxSetDataOpcode, and gxTransformDataOpcode constants in the data stream.

The bytes following the appearance in the data stream of the gxTransformMapping constant from the gxTransformDataOpcode enumeration have a special format. The interpretation of the bytes that follow require the determination of a size constant. The size to be used for a specific transform depends upon the compression and the size of the transform data specified by the byte containing the previous gxGraphicsOperationOpcode constant. The size is the number of bytes, words, or longs, depending upon the type of compression.

If the size obtained from the gxGraphicsOperationOpcode byte indicated that there are 24 bytes of transform data and the byte containing the gxTransformMappingOpcode constant indicated that there was no compression, then the size of each transform attribute would be 4 bytes (longs) and the size constant for our transformation bytes format would be size 24/4 = 6. The interpretation of the mapping that occurs for each mapping size is summarized in the section "Text Face Data" on page 7-39.

The GXSetTransformMapping function is described in the chapter "Transform Objects" in Inside Macintosh: QuickDraw GX Objects.

Part Mask Data

A part mask, compressed as a long, is added to the current transform object if the data type opcode has value 4. This is the gxTransformPartMaskOpcode constant. The data for the mask parameter of the GXSetTransformHitTest function follows.

The GXSetTransformHitTest function is described in the chapter "Transform Objects" in Inside Macintosh: QuickDraw GX Objects.

Tolerance Data

Tolerance, compressed as long, is added to the current transform object if the data type opcode has value 5. This is the gxTransformToleranceOpcode constant. The data for the tolerance parameter of the GXSetTransformHitTest function follows.

The GXSetTransformHitTest function is described in the chapter "Transform Objects" in Inside Macintosh: QuickDraw GX Objects.

New Color Profile Object Data

Data for a new color profile object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x2B. This is the gxColorProfileTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

This opcode creates a new color profile object with all of the properties of the previous color profile object in the data stream. If the current color profile object is the first color profile object in the stream, then it is created with default properties. The data that follows is uncompressed; the opcode size specifies the size of the stream.

The color profile object is described in the chapter "Color Objects" in Inside Macintosh: QuickDraw GX Objects.

Modified Color Profile Object Data

Once a color profile object is defined in the data stream, it can be modified. Modified color set object data follows a gxSetDataOpcode operation opcode and a data type opcode containing one of the constants from the gxColorProfileDataOpcode enumeration. Table 7-8 summarizes the values of the constants for all of the modified color profile objects.

Reserved Opcode for Modified Color Profile Data

The data type opcode with value 0 is reserved for future expansion.

Color Profile Tag Data

A tag for the current color profile object is added if the data type opcode has value 1. This is the gxColorProfileTagOpcode constant. The data for the parameters of the GXSetColorProfileTags function follows.

The size of the opcode specifies the number of tags; the compression specifies whether the data is in bytes, words, or longs. For instance, if the size is 4 and the compression is gxShortCompression (2 bytes), then the stream contains 4/2 == 2 tags. The equivalent operation would be GXSetShapeTags (shape, nil, 1, 0, 2, tag array).

The GXSetColorProfileTags function is described in the chapter "Color Objects" in Inside Macintosh: QuickDraw GX Objects.

New Color Set Object Data

Data for a new color set object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x2C. This is the gxColorSetTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

This opcode creates a new color set object with all of the properties of the previous color set object in the data stream. If the current color set object is the first color set object in the stream, then it is created with default properties.

The color set object is described in the chapter "Color Objects" in Inside Macintosh: QuickDraw GX Objects.

Modified Color Set Object Data

Once a color set object is defined in the data stream, it can be modified. Modified color set object data follows an operation opcode gxSetDataOpcode constant from the gxGraphicsOperationOpcode enumeration and a data type opcode containing one of the constants from the gxColorSetDataOpcode enumeration. Table 7-7 summarizes the values of the constants for modified color set objects.

The first byte or two is space, space and specifies the number of components. The remaining stream is colors. The compression for the color set can be byte or word. To determine the number of colors in the stream use the following formula:

(size - colorSpaceByte * compression) / componentsInColorSpace * 
                                             compression
For instance, if the space is gxRGBSpace, the compression is gxByteCompression, and the size is 7, the number of colors would be (7 - 1 * 1)/3*1, which evaluates to 2. If the stream continued with 0, 0, 0, 0XFF, 0XFF, 0XFF, then the color set would contain black (0X0000, 0X0000,0X0000) and white 0XFFFF, 0XFFFF, 0XFFFF). As the example shows, the color set entries are compressed as colors. See section "Transfer Mode Data" on page 7-44 for information on color compression.

Reserved Opcode for Modified Color Set Data

The data type opcode with value 0 is reserved for future expansion.

Color Set Tag Data

A tag is added to the current color set object if the data type opcode has value 1. This is the gxColorSetTagOpcode constant. The data for the parameters of the GXSetColorSetTags function follows.

The size of the opcode specifies the number of tags; the compression specifies whether the data is in bytes, words, or longs. For instance, if the size is 4 and the compression is gxShortCompression (2 bytes), then the stream contains 4/2 == 2 tags. The equivalent operation would be GXSetShapeTags (shape, nil, 1, 0, 2, tag array).

The GXSetColorSetTags function is described in the chapter "Color Objects" of Inside Macintosh: QuickDraw GX Objects.

New Tag Object Data

Data for a new tag object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x2D. This is the gxTagTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

This opcode creates a new tag object with all of the properties of the previous tag object in the data stream. If the current tag object is the first tag object in the stream, then it is created with default properties. For tag data is uncompressed. The first parameter is tag type (long), followed by data computed from opcode length - sizeof (long).

The GXNewtag function is described in the chapter "Tag Objects" in Inside Macintosh: QuickDraw GX Objects.

New Bit Image Object Data

Data for a bit image object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x2E. This is the gxBitImageTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

The data sequence is omit byte (gxOmitBitImage), followed by the fields described by omit byte: rowBytes, compressed as long, height, compressed as long, and data compressed in the custom format described ahead. The bit image is compressed only if it makes the data stream smaller.

The GXNewBitmap function is described in the chapter "Bitmap Shapes" in Inside Macintosh: QuickDraw GX Graphics.

The bit image compression byte appears only in data streams containing a bitmap shape. This byte describes how each section of a bit image is compressed. The bit image compression byte follows the bytes containing the bit image attributes described by the gxOmitBitImageMask constant.

Bit images are described in the "Bitmap Shapes" chapter of Inside Macintosh: QuickDraw GX Graphics.

The bit image compression byte has the format xx yyyyyy.

The xx bits describe which of the bit image compression type opcodes is used for the next part of the bit image. The bit image compression opcode values are either 0, 1, 2,
or 3.

The yyyyyy bits describe the number of times, z, that the action defined by the bit image compression opcode is replicated. The number of replications, z, can vary range from 0 to 63. Table 7-13 summarizes the four compression opcodes.
Table 7-13 Bit image compression opcodes
Bit image
compression
opcode
Bit image compression description
0Add the z bytes of bit image that follow to the current row. Z Bytes of data follow.
1Repeat 1 byte z times and add the bits to the current row. One byte of data follows.
2Copy z bytes of the previous row and add the bits to the current row. No data follows.
3Copy the previous row of bits z times and add the bits to the next z rows. No data follows.

The analysis of a bit image compression byte in a stream format is described in the section "Analyzing a Flattened Bitmap Shape" beginning on page 7-81.

New Font Name Data

Data for a font name follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x2F. This is the gxFontNameTypeOpcode constant from the gxGraphicsNewOpcode enumeration.

The fields in the gxFlatFontName structure follow. This structure includes the gxFontName, gxFontPlatform, gxFontScript, gxFontLanguage, and gxFontName structures, the byte length of the name and the name itself.

The stream exactly mirrors the sequence and size of the fields in the gxFlatFontName structure.

New Trailer Object Data

Data for a trailer object follows a gxNewObjectOpcode operation opcode and a data type opcode with a value 0x3F. This is the gxTrailerTypeOpcode constant from the gxGraphicsNewOpcode enumeration. This is the termination (last) object in the stream. No data follows.

The last two bytes of a stream are always 0x01 and 0x3F. The next to the last byte in a data stream contains a gxNewObjectOpcode constant with a record size of 1 byte. The last byte in a data stream contains a gxTrailerTypeOpcode constant with a gxTwoBitCompression value of 0, indicating the gxNoCompression constant.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996