Creating and Deleting a Region

To create a region:

To delete a region, pass the handle returned by the GpiCreateRegion function to GpiDestroyRegion.

The following figure shows how to create and delete a region.

#include <os2.h>void fncREGN01(void){
    HPS  hps;                            /* Presentation-space handle    */
    HRGN hrgn;                           /* Region handle                */
    RECTL arcl[] = {
         25,  50,                        /* Rectangle 1                  */
         75, 100,
         50,  75,                        /* Rectangle 2                  */
        100, 150,
         75, 125,                        /* Rectangle 3                  */
        200, 175,
        150,  75,                        /* Rectangle 4                  */
        250, 150 };

    hrgn = GpiCreateRegion(hps,        /* Creates region                 */
        sizeof(arcl) / sizeof (RECTL), /* Number of rectangles in region */
        arcl);                         /* Array of rectangle structures  */
        .
        . /* Work with the region here.                                  */
        .
    GpiDestroyRegion(hps, hrgn);   /* Destroys region identified by hrgn */
} /* fncREGN01 */


[Back: Using Regions]
[Next: Combining Regions]