To create a chained segment, you must:
The following figure is an example of a segment containing a box primitive and calling another segment using GpiCallSegmentMatrix.
#define INCL_GPISEGMENTS#define INCL_GPITRANSFORMS
#include <os2.h>
void fncSEGS01(void){
POINTL ptl;
HPS hps;
LONG idSegment = 1;
LONG idNonChained = 2;
MATRIXLF matlfTransform = { MAKEFIXED(2,0), MAKEFIXED(0,0), 0,
MAKEFIXED(0,0), MAKEFIXED(1,0), 0,
0, 0, 1 };
/************************************************************************/
/* Turns chaining on. Adds the new segment to the segment chain. */
/* Segment idNonChained is called, whether chained or not. */
/************************************************************************/
if (ATTR_OFF == GpiQueryInitialSegmentAttrs(hps, ATTR_CHAINED)
GpiSetInitialSegmentAttrs(hps, ATTR_CHAINED, ATTR_ON);
GpiOpenSegment(hps, idSegment);
ptl.x = 150; ptl.y = 150;
GpiMove(hps, &ptl);
ptl.x = 225; ptl.y = 225;
GpiBox(hps, DRO_FILL, &ptl, 0L, 0L);
GpiCallSegmentMatrix(hps, idNonChained, 9L, &matlfTransform,
TRANSFORM_REPLACE);
GpiCloseSegment(hps);
} /* fncSEGS01 */