Important: The information in this document is obsolete and should not be used for new development.
LockPixelsTo prevent the base address for an offscreen pixel image from being moved while you draw into or copy from its pixel map, use the
FUNCTION LockPixels (pm: PixMapHandle): Boolean;
- A handle to an offscreen pixel map. To get a handle to an offscreen pixel map, use the
GetGWorldPixMapfunction, described on page 6-31.
LockPixelsfunction prevents the base address for an offscreen pixel image from being moved. You must call
LockPixelsbefore drawing to or copying from an offscreen graphics world.
baseAddrfield of the
PixMaprecord for an offscreen graphics world contains a handle instead of a pointer (which is what the
baseAddrfield for an onscreen pixel map contains). The
LockPixelsfunction dereferences the
PixMaphandle into a pointer. When you use the
UnlockPixelsprocedure, which is described next, the handle is recovered.
If the base address for an offscreen pixel image hasn't been purged by the Memory Manager or is not purgeable,
TRUEas its function result, and your application can draw into or copy from the offscreen pixel map. However, if the base address for an offscreen pixel image has been purged,
FALSEto indicate that you can perform no drawing to or copying from the pixel map. At that point, your application should either call the
UpdateGWorldfunction (described on page 6-23) to reallocate the offscreen pixel image and then reconstruct it, or draw directly in a window instead of preparing the image in an offscreen graphics world.
As soon as you are finished drawing into and copying from the offscreen pixel image, you should call the
LockPixelsfunction may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
ASSEMBLY-LANGUAGE INFORMATIONThe trap macro and routine selector for the
Trap macro Selector _QDExtensions $00040001
SEE ALSOListing 6-1 on page 6-5 and Listing 6-2 on page 6-10 illustrate the use of this function. See Inside Macintosh: Memory for more information about memory management.