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 / Filtering Drawing Calls to a View Port


MyViewPortFilter

You can create a filter function that handles intercepted QuickDraw GX drawing calls. The filter function must have a prototype of this form:

void MyViewPortFilter(gxShape toFilter, gxViewPort portOrder, 
                     long refCon);
toFilter
A reference to the shape to be filtered--that is, the shape that would have been drawn to the view port specified in the portOrder parameter.
portOrder
A reference to the view port in which this filter function has been installed.
refCon
A reference constant that your filter function can use in any manner.
DESCRIPTION
Once this filter function is installed, QuickDraw GX calls it any time a function is executed that draws a shape in the view port referenced by the portOrder parameter. Instead of drawing the shape, QuickDraw GX passes the shape to this function. Your filter function can perform actions other than drawing (such as spooling), or it can otherwise modify or process the shape.

Your application installs this filter function by providing a pointer to it when calling the GXSetViewPortFilter function. When your application calls the function GXSetViewPortFilter, it also provides the refCon value that will be passed to this filter function.

The value passed to you in the refCon parameter can be used for any purpose; for example, it might contain a reference to a different view port for drawing to, a pointer to a buffer for collecting spooled data, or anything else useful to the filter function. The portOrder parameter allows you to identify the view port being intercepted, in case the filter function is installed on more than one view port.

Your application can get a pointer to this installed filter function at any time by calling the GXGetViewPortFilter function. After you are finished intercepting drawing calls, your application can remove the filter function by calling the GXSetViewPortFilter function with a nil filter-function pointer.

SEE ALSO
The GXSetViewPortFilter function is described on page 1-31. The to GXGetViewPortFilter function is described on page 1-32.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996