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 1 - QuickDraw GX and the Macintosh Environment / QuickDraw GX and the Macintosh Environment Reference
Application-Defined Functions / Handling Translated QuickDraw Data


MyShapeSpooler

You can create a shape-spooling function that handles QuickDraw drawing commands that have been translated into QuickDraw GX shapes. The shape-spooling function must have a prototype of this form:

OSErr MyShapeSpooler(gxShape toSpool, void *refCon);
toSpool
A reference to the shape just translated by the translator.
refCon
A pointer to a reference constant, passed to your spool function by the translator, that you can use for any purpose.
function result
An result code of type OSErr. You should pass 0 if no error occurs.
DESCRIPTION
When you install the QuickDraw-to-QuickDraw GX translator with the GXInstallQDTranslator function, the translator intercepts all subsequent QuickDraw drawing commands, converts them to QuickDraw GX shapes, and passes those shapes to this shape-spooling function. Your shape-spooling function can draw each shape, add it to a picture, or perform any other action you wish.

You install this function by providing a pointer to it when you call the GXInstallQDTranslator function. When you call GXInstallQDTranslator, you also provide the refCon value that will be passed to this filter function. The refCon value can be used for any purpose; for example, it might contain a view port reference for drawing, a pointer to a buffer for collecting spooled data, or anything else useful to the shape-spooling function.

After your application has finished intercepting and converting QuickDraw calls and passing them to this shape-spooling function, your application must remove the translator by calling the GXRemoveQDTranslator function.

If your shape-spooling function encounters an error during processing, it should return a nonzero value (usually the error code). If the shape-spooling function returns a nonzero value, the translator ceases translating QuickDraw commands. If an error occurs, your application must still call the GXRemoveQDTranslator function to remove the translator.

SEE ALSO
The GXInstallQDTranslator function is described on page 1-36. The GXRemoveQDTranslator function is described on page 1-39.

For a general description of the QuickDraw-to-QuickDraw GX translator, see the section "Using the QuickDraw-to-QuickDraw GX Translator" beginning on page 1-10.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996