SetClip
SetClip
Set clipping region of active GrafPort RgnHandle newClipRgn ; handle to desired clipping region drawing on the port will be clipped to this area.
newClipRgn is a handle to a Region, expressed in local coordinates.
Notes: The data describing newClipRgn is copied, so changing the original later
the master pointer is changed to point to the duplicated Region structure. Using the clipping region can simplify many operations. For instance, one
way to draw a half-circle is to set the clipping region to cover half the area
where the circle will be drawn, then draw a full circle. Another example:
set the clipping region to the shape of an oval, then as you draw lines
through the oval, only the pixels inside are affected:
To avoid subsequent redrawing errors, you may want to change the clip
region temporarily:
RgnHandle saveRgn, myRgn;
... draw zoom stuff ...
All drawing to a GrafPort is clipped to the intersection of the port's portBits.bounds, portRect, visRgn, and clipRgn. Initially, the clipRgn of a GrafPort covers a large rectangle: (-32768,-32768) (32767,32767), so it has no effect until you set it to a smaller value via this function.
The ClipRect function is a quick way to set the clipping region to a rectangular area.
you make the clip region smaller than its arbitrarily-large initial setting.