CloseRgn
CloseRgn Stop recording Region definition; obtain its data
#include <Quickdraw.h> Quickdraw
void CloseRgn(destRgn );
RgnHandle destRgn ; handle of a previously- created region
CloseRgn finishes the process begun through a previous call to OpenRgn. It
combines the lines and shapes accumulated while the region was open into a
Region definition and stores a pointer to that data into the specified RgnHandle.
The graphical pen is also made visible.
destRgn is a handle leading to a Region. It is not created by this function and
you normally obtain destRgn by a previous call to NewRgn. The
system crashes if you haven't created a destRgn beforehand.
Returns: none

Notes: The data resulting from this call is stored in a compact, internal format, of
which only the first ten bytes are documented. See Region for the structure
layout and a list of functions that use regions.
Regions must be no larger than 32K. Use GetHandleSize to obtain the
size of a region's definition data.
In the following example, a region is created (NewRgn), region recording
is turned on (OpenRgn), some drawing is performed (LineTo and
FrameOval), recording is turned off and the result saved (CloseRgn).
The region is filled with black (FillRgn), and the storage for the region is
de allocated (DisposeRgn).
Compare these figures with the comments in the example:
Figure A, illustrates the effect of an "unclosed" set of lines; the left side
of the bow tie is not enclosed, so it does not get filled (the dotted-lines are
not displayed). Figure B is the result after drawing a line to close the left
side. Figure C shows what happens when figures overlap. The effect is the
same as XorRgn. The additional area is added to the region and the overlap
is removed from the region.
Example
#include <Quickdraw.h>
RgnHandle bowTie;
FillBowTie()
{
bowTie = NewRgn(); /* get handle to empty region */
OpenRgn(); /* turn on the recorder */
MoveTo( 100,100 );
LineTo( 200,200 ); /* draw the bow tie */
LineTo( 200,100 );
LineTo( 100,200 ); /* Figure A, if closed and filled now */
LineTo( 100,100 ); /* Figure B, if closed and filled now */
SetRect( &r, 130, 130, 170,170 ); /* and the circle */
FrameOval( &r);
CloseRgn( bowTie ); /* save result */
FillRgn( bowTie, &black ); /* Figure C */
DisposeRgn( bowTie );
}