The following figure shows an example of how to use area functions to draw a single closed figure that is filled with a vertical pattern using the alternate mode. The closed figure in this example is a 5-pointed star.

#define INCL_GPI
#include <os2.h>
void fncAREA02(void){
   POINTL aptl[5];               /* Structure for current position */
   HPS hps;

    /* Initialize the array of points for the 5-pointed star.       */
    aptl[0].x = 400; aptl[0].y = 195;
    aptl[1].x = 40;  aptl[1].y = 320;
    aptl[2].x = 260; aptl[2].y = 10;
    aptl[3].x = 260; aptl[3].y = 390;
    aptl[4].x = 37;  aptl[4].y = 82;

    GpiSetPattern(hps, PATSYM_VERT);/* Set pattern outside bracket */

    /* Draw the star. */
    GpiBeginArea(hps, BA_ALTERNATE);
    GpiMove(hps, &aptl[4]);         /* First and last point of star */
    GpiPolyLine(hps, 5L, aptl);
    GpiEndArea(hps);
} /* fncAREA02 */


[Back] [Next]