Important: The information in this document is obsolete and should not be used for new development.
Working With Multiple Graphics Clients
The exceptional QuickDraw GX application may need multiple graphics clients to provide special features. For example, an application may want to create multiple graphics clients to provide a QuickDraw GX environment with
Another example is a QuickDraw GX application that needs to display a dialog box to convey status information while continuing to perform other tasks. By using separate graphics clients for the dialog box and the other task-oriented part of the application, you can guarantee that QuickDraw GX will not affect the memory being used for the dialog box.
- segmented memory to allow some sets of objects to have more memory than others
- different error states so that one state would have an error condition and the other would have a normal condition.
Two disadvantages of having multiple graphics clients are that
Without object sharing, if an object is to be used by more than one graphics client, the object must be duplicated and this requires additional memory overhead. Fragmented memory results from QuickDraw GX objects being initially allocated to a large block of memory and subsequent addition of multiple discontiguous memory blocks.
- objects cannot be shared between graphics clients
- memory may become fragmented as the memory size grows
If you are going to have multiple graphics clients, you must explicitly create them using the
GXNewGraphicsClient
andGXEnterGraphics
functions. This assures that a reference is returned for each new graphics client. If you allow QuickDraw GX to implicitly create a graphics client, QuickDraw GX has no way of returning a reference.The
GXGetGraphicsClient
,GXGetGraphicsClient
s, andGXSetGraphicsClient
functions allow you to work with the graphics clients that you create.You can use the
GXGetGraphicsClient
s function to return some or all of the graphics client references that have been allocated by QuickDraw GX. TheGXGetGraphicsClient
s function is described on page 2-25.You can use the
GXSetGraphicsClient
function to change the active graphics client for your application and theGXGetGraphicsClient
function to return the active graphics client for your application. These functions may be used prior to callingGXEnterGraphics
andGXExitGraphics
to specify the active graphics client. TheGXSetGraphicsClient
function is described on page 2-26 and theGXGetGraphicsClient
s function is described on page 2-25.Creating graphics clients and graphics client heaps explicitly is described in the section "Explicit Creation" beginning on page 2-6.