Important: The information in this document is obsolete and should not be used for new development.
Flattening Shapes With GraphicsBugGraphicsBug is not just a QuickDraw GX debugging tool. It also allows you to evaluate the data at specific memory locations. You can use GraphicsBug to look at the data describing a QuickDraw GX shape both before and after you invoke the
GXFlattenShapefunction. This allows you to compare the original data and the stream format after the
GXFlattenShapefunction has been called.
For more information concerning GraphicsBug, see the chapter "QuickDraw GX Debugging " in this book.
You can use GraphicsBug to analyze a data stream by using the following procedure:
- Create a QuickDraw GX shape.
- Use the GraphicsBug heap dump
HDcommand to determine the memory location of the QuickDraw GX shape to be flattened.
- Copy the memory location of the shape to the clipboard.
FLand paste the memory address. The command line should look like this:
fl <memory address> For example: fl 41d788
To create a flattened file, you can use the command
- The command
GXFlattenShapefunction to the shape located at the specified memory address. This results in a flattened shape. An annotated version of the QuickDraw GX data stream appears in the GraphicsBug window. GraphicsBug does not alter the graphics memory in any way.
fl <memory address> "filename"To view the contents of a file, such as a print file generated by printing a document, you can use the command
uf "filename"To view the stream associated with a particular page of a document, you can use the command
uf <page number> "filename"Here are some guidelines for using GraphicsBug to analyze data streams:
Listing 7-2 shows an example of the information provided by GraphicsBug for a flattened line.
- The data in parentheses in the GraphicsBug window are the compressed byte codes that were generated when the original shape was flattened. The data not in parenthesis is GraphicsBug's brief annotation of the data stream. The annotation usually describes the shape data in its original format. The data in parentheses always relates to the immediately previous data that is not in parentheses.
- Sometimes GraphicsBug will not give the name of the font. This is because GraphicsBug reads only the information contained in memory. GraphicsBug cannot make a call to get the information. If GraphicsBug is used to flatten shapes that were generated by a client call, the required data will always already be in memory and will therefore be available. In this case, the GraphicsBug annotation will always provide the name of the font.
- If part of an object is compressed and another part of the object is not compressed, GraphicsBug reports that there is "no compression."
- Bracketed numbers are references. When
gxSetReferenceopcodes are encountered, they can't generate pointers to other objects. They have to generate references. The first object is given reference 1. Subsequent objects are given references 2, 3, and so on.
Listing 7-2 A GraphicsBug annotation of the data stream of a flattened shape
fl 0c79090 owners 1) newObject; size: #2 (03) headerType; byte compression (80) version == 1.0; flags == fontListFlatten | fontGlyphsFlatten (01 03) newObject; size: #6 (07)  fontNameType; no compression (2f) (04 02 01 01 00 00)Listing 7-2 shows only the beginning of a data stream. For more examples of GraphicsBug annotation of flattened shape data streams, see the next section.