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: Imaging With QuickDraw /
Chapter 3 - QuickDraw Drawing / QuickDraw Drawing Reference
Routines / Getting Pattern Resources


To get a pattern ('PAT ') resource stored in a resource file, you can use the GetPattern function.

FUNCTION GetPattern (patID: Integer): PatHandle;
The resource ID for a resource of type 'PAT '.
The GetPattern function returns a handle to the pattern having the resource ID that you specify in the patID parameter. The GetPattern function calls the following Resource Manager function with these parameters:

GetResource('PAT ', patID);
If a pattern resource with the ID that you request does not exist, the GetPattern function returns NIL.

The data structure of type PatHandle is defined as follows:

TYPE  PatPrt      = ^Pattern;
      PatHandle   = ^PatPtr;
      Pattern = PACKED ARRAY[0..7] OF 0..255;
When you are finished using the pattern, dispose of its handle with the Memory Manager function DisposeHandle.

The GetPattern function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

The pattern resource is described on page 3-136; the Pattern record is described on page 3-36. See the chapter "Resource Manager" in Inside Macintosh: More Macintosh Toolbox for more information about resources, the Resource Manager, and the GetResource function. See Inside Macintosh: Memory for information about the DisposeHandle procedure.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996