Nonretained graphics segments and primitives outside of graphics segment are always drawn immediately to the current output device. Segments that have been retained in segment store, however, can be drawn any number of times to any number of device contexts. The PM has three different functions that allow you to draw segments:
Function
GpiDrawSegment draws a single, named segment, which can be chained or unchained. You supply the segment name as input to this function. GpiDrawSegment can draw a dynamic segment in some circumstances. These are described in Drawing Dynamic Segments.
GpiDrawFrom draws one or more root segments from the segment chain. You supply the names of two root segments as input. The drawing process starts at the first named segment and draws all chained and called segments, excluding dynamic segments, up to and including the second named segment.
The order in which you specify the segment names is to reflect their relative positions in the segment chain. If the second-named segment appears in the segment chain before the first-named segment, no error is raised, but drawing starts from the first named segment and continues to the end of the chain. This also happens if the second segment is an unchained segment rather than a root segment. If the drawing control, DCTL_DYNAMIC is set, any dynamic segments already drawn on the display are removed before GpiDrawFrom begins to draw nondynamic segments. Then they are redrawn after GpiDrawFrom ends.
GpiDrawChain draws all nondynamic chained segments in a named presentation space, as well as any unchained segments called by those chained segments. It does not draw dynamic segments. You supply only the presentation space handle as input to this function. If the drawing control, DCTL_DYNAMIC is set, any dynamic segments already drawn on the display are removed before GpiDrawFrom begins to draw nondynamic segments. Then they are redrawn after GpiDrawFrom completes.
You can call any of these functions while a segment is open. The open segment is not modified by these functions, although any of them can result in the current attribute values and current position being modified. For more information about the attribute-resetting process, see Graphics Attributes.
The current drawing mode determines whether the segments identified in the drawing functions are executed, stored in the segment, or both. The current drawing mode does not affect which segments are drawn, or the priority in which they are drawn for any of these three GPI drawing functions.
If an error occurs during the drawing process, you can determine where the error occurred using GpiErrorSegmentData. This function returns information about the last error that occurred during a segment-drawing operation. It returns a pointer to the segment identifier and a pointer to one of three constants that indicate when the error occurred.
Constant