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 2 - Basic QuickDraw / Basic QuickDraw Reference
Routines / Managing Bitmaps, Port Rectangles, and Clipping Regions


To change the clipping region of the current graphics port (basic or color) to a region you specify, use the SetClip procedure.

PROCEDURE SetClip (rgn:\xDDRgnHandle);
A handle to the region to be set as the current port's clipping region.
The SetClip procedure changes the clipping region of the current graphics port to the region specified in the rgn parameter. The SetClip procedure doesn't change the region handle, but instead affects the clipping region itself. Since SetClip copies the specified region into the current graphics port's clipping region, any subsequent changes you make to the region specified in the rgn parameter do not affect the clipping region of the graphics port.

The initial clipping region of a graphics port is an arbitrarily large rectangle. You can set the clipping region to any arbitrary region, to aid you in drawing inside the graphics port--for example, to avoid drawing over scroll bars when drawing into a window, you could define a clipping region that excludes the scroll bars.

You can use the GetClip and SetClip procedures to preserve the current clipping region: use GetClip to save the current port's clipping region, and use SetClip to restore it.

All other system software routines preserve the current clipping region.

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

Figure 2-4 on page 2-11 illustrates a clipping region that has been set to exclude the scroll bars of a window.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996