CloseRgn
CloseRgn
Stop recording Region definition; obtain its data RgnHandle destRgn ; handle of a previously- created region 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.
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.
size of a region's definition data.
In the following example, a region is created (NewRgn), region recording The region is filled with black (FillRgn), and the storage for the region is 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>
FillBowTie()
{
bowTie = NewRgn(); /* get handle to empty region */ OpenRgn(); /* turn on the recorder */ LineTo( 200,200 ); /* draw the bow tie */ 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 */ FillRgn( bowTie, &black ); /* Figure C */ }