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 2 - QuickDraw GX Memory Management / Additional Memory Management Topics

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.

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.

If you are going to have multiple graphics clients, you must explicitly create them using the GXNewGraphicsClient and GXEnterGraphics 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, GXGetGraphicsClients, and GXSetGraphicsClient functions allow you to work with the graphics clients that you create.

You can use the GXGetGraphicsClients function to return some or all of the graphics client references that have been allocated by QuickDraw GX. The GXGetGraphicsClients function is described on page 2-25.

You can use the GXSetGraphicsClient function to change the active graphics client for your application and the GXGetGraphicsClient function to return the active graphics client for your application. These functions may be used prior to calling GXEnterGraphics and GXExitGraphics to specify the active graphics client. The GXSetGraphicsClient function is described on page 2-26 and the GXGetGraphicsClients 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.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996