A drawing and computer-aided-design (CAD) application may require the ability to clip to curved edges. If so, it must use a clip path to define a curved clipping area in world coordinates. Because clip paths (especially ones that clip to curved edges) require considerable memory and processing time, use them only when necessary. Whenever possible, your application must use a clip region, graphics field, or viewing limit.

To create a clip path, do the following:

The following figure uses this procedure to create an elliptical clip path.

#define INCL_GPIPATHS#include <os2.h>
void fncCLIP01(void){
    HPS    hps;                      /* Presentation-space handle */
    POINTL ptl1;                     /* Point structure           */
    FIXED  fxArc;                    /* Multiplier for arc        */
    LONG idPath;                     /* Path identifier           */
        .
        .           /* Load ptl1 with coordinates of clip path.   */
        .
    idPath = 1;
    GpiBeginPath(hps, idPath);       /* Begins path               */
    GpiMove(hps, &ptl1);             /* Sets current position     */
    fxArc  = MAKEFIXED(50, 0);       /* Sets arc multiplier       */
    GpiFullArc(hps, DRO_OUTLINE, fxArc);  /* Defines ellipse      */
    GpiEndPath(hps);                 /* Ends path                 */
    GpiSetClipPath(hps, idPath, SCP_ALTERNATE | SCP_AND);
} /* fncCLIP01 */


[Back] [Next]