Your application signals the start of a graphics segment using GpiOpenSegment, which is valid only in a normal presentation space. The following figure is an example of two segments in a presentation space.
Presentation Space ┌─────────────────────────────────────┐ │ │ │ Graphics Segment 1 │ │ ┌────────────┐ │ │ │ │ │ GpiOpenSegment (hps,1L); │ │ │ │ GpiSet... (hps,...); ──┼───┼────── │ │ GpiLine (hps,...); ──┼───┼── │ │ GpiCloseSegment (hps); │ │ │ Graphics Segment 2│ │ │ │ ┌────────────┐ │ │ │ │ │ │ │ │ └────────────┘ │ │ │ │ │ │ │ GpiOpenSegment (hps,2L); │ │ │ │ GpiSet... (hps,...); ──┼───────────────────┼───── │ │ GpiLine (hps,...); ──┼───────────────────┼── │ │ GpiCloseSegment (hps); │ │ │ │ │ └────────────┘ │ │ │ │ │ └─────────────────────────────────────┘
Graphics Segments in a Presentation Space
GpiOpenSegment accepts, as input, the presentation space handle and a long integer value, which names each segment.
OS/2 applications identify segments with long integer values. If you want to refer to the segment individually in later graphics operations (for example, to edit the segment) the identifier you supply must be greater than 0 and unique within the presentation space.
If you do not want to refer to the segment individually after it is created, you can give the segment an identifier of 0. You might do this when you are creating nonretained segments, for example. Any number of segments can have the 0 identifier. They are referred to throughout this book as zero segments.
To determine which names already have been used in a presentation space, use GpiQuerySegmentNames. This function returns an array of segment names for all retained segments, excluding zero segments, within a specified name range.
Segments do not have to be named in consecutive order (although it is recommended for organizational purposes) because the segment order can be changed using GpiSetSegmentPriority.