gpi12.hlp (Table of Contents; Topic list)
GpiCreateRegion (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPIREGIONS
 
HRGN GpiCreateRegion(hps, crcl, prcl)
HPS hps;        /* presentation-space handle           */
LONG crcl;      /* number of rectangles                */
PRECTL prcl;    /* address of structure for rectangles */
 
The GpiCreateRegion function creates a region for the device associated with
the specified presentation space. The region is the union of the rectangles
specified by the prcl parameter.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies the presentation space.
 
crcl       Specifies the number of rectangles specified in the prcl
           parameter. If the crcl parameter is equal to zero, an empty
           region is created, and prcl is ignored.
 
prcl       Points to an array of RECTL structures.
 
Return Value
 
The return value is a handle to the region if the function is successful or
zero if an error occurred. It is an error if this function is issued when
there is no device context associated with the presentation space.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_COORDINATE
     PMERR_INV_HPS
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_INV_RECT
     PMERR_PS_BUSY
 
Example
 
This example uses the GpiCreateRegion function to create a region consisting
of the union of three rectangles:
 
HRGN hrgn;                                      /* handle for region */
RECTL arcl[3] = { 100, 100, 200, 200,           /* 1st rectangle     */
                  150, 150, 250, 250,           /* 2nd rectangle     */
                  200, 200, 300, 300 };         /* 3rd rectangle     */
 
hrgn = GpiCreateRegion(hps,                    /* presentation space */
                       3L,                     /* three rectangles   */
                       arcl);      /* address of array of rectangles */
 
See Also
 
GpiCombineRegion, GpiDestroyRegion, RECTL