Drawing Filled Polygons

The following figure is an example of how to draw an empty triangle within a solid rectangle.

#define INCL_GPIPATHS
#include <os2.h>
void fncPATH02(void){
    HPS hps;
    POINTL aptl1[4] = {       /*  Array of points for triangle   */
        50,  50,
        100, 100,
        150, 50,
        50,  50  };

    POINTL aptl2[5] = {       /* Array of points for rectangle   */
 25,  25,
 25, 200,
200, 200,
200,  25,
 25,  25 };

    GpiBeginPath(hps, 1L);                 /* Begins path                  */
    GpiMove(hps, aptl1);                   /* Sets current position        */
    GpiPolyLine(hps, 4L, aptl1);           /* Plots points for triangle    */
    GpiMove(hps, aptl2);                   /* Sets current position        */
    GpiPolyLine(hps, 5L, aptl2);           /* Plots points for rectangle   */
    GpiEndPath(hps);                       /* Ends path                    */
    GpiFillPath(hps, 1L, FPATH_ALTERNATE); /* Draws triangle and rectangle */
} /* fncPATH02 */


[Back: Drawing a Geometric (Wide) Line]
[Next: Drawing Outline Text]