When you have finished drawing the subpicture associated with a segment, you should delete the segment. The PM has two different functions that allow you to delete segments.
Function
Your application can only delete segments that have unique names because you use the segment identifiers to identify the segment or range of segments for deletion. Retained zero segments cannot be deleted. They disappear only when their associated presentation space is deleted or reset. The presentation space can be reset either by GpiResetPS with the GRES_SEGMENTS flag or the GRES_ALL flag set, or by GpiSetPS. Resetting the presentation space is described in Reusing the Presentation Space.
If GpiDeleteSegment occurs within a segment bracket and the segment identified is the currently open segment, the operating system deletes the segment and ignores the remainder of the functions up to, and including, GpiCloseSegment. If GpiDeleteSegment occurs within a segment bracket and the identifier for a segment other than the currently open segment, the operating system deletes the segment, then continues processing the remaining functions in the segment bracket. If GpiDeleteSegment occurs outside of a segment and references a segment in the segment chain, the operating system removes the segment from the chain and links the two adjacent segments, if such segments exist.
If the range of segments deleted by GpiDeleteSegments were in the segment chain, the operating system "repairs" the chain by linking the segments immediately preceding and following the deleted segments, if such segments exist.