GpiDrawDynamics
This function redraws the dynamic segments in, or called from, the segment chain.
Syntax
GpiDrawDynamics(hps)
Parameters
- hps (HPS) - input
- Presentation-space handle.
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
Dynamic segments are those segments in the segment chain that have the ATTR_DYNAMIC segment attribute (see GpiSetInitialSegmentAttrs). It is preferable to position dynamic segments at the start of the segment chain. Dynamic segments can either be drawn with this function, or by setting the DCTL_DYNAMIC draw control (see GpiSetDrawControl), and issuing one of the other GpiDraw... calls. If there is no range set by a previous GpiRemoveDynamics, all dynamic segments are redrawn by GpiDrawDynamics. However, if GpiRemoveDynamics specified a range in the segment chain, the redraw is restricted to the dynamic segments that are in, or called from, the selected range. (See GpiRemoveDynamics). Note: The redraw is controlled by the calls set by previous calls to GpiSetDrawControl. The "stop draw" condition can be set (from another thread) while GpiDrawDynamics is in progress. This is useful in responding to a new position by setting this condition, and then clearing it and redrawing at the new position. If "Erase before draw" is set ON (see GpiSetDrawControl), the presentation space is erased before the redraw. It may be necessary to ensure that attributes, model transform, current position, and viewing limits are reset to their default values, before processing the segments. This can be done either by ensuring that the first dynamic segment to be drawn does not have the ATTR_FASTCHAIN attribute (see GpiSetInitialSegmentAttrs), or by issuing GpiResetPS before the GpiDrawDynamics. The latter method also resets the clip path to no clipping, which may also be necessary. If this function is followed by primitives or attributes, without first opening a segment, the processing is as described for GpiCloseSegment. In particular, note that during GpiDrawDynamics, the system forces the foreground mix to FM_XOR and the background mix to BM_LEAVEALONE. It may be necessary to set one or both of these before starting to draw.
Errors
Possible returns from WinGetLastError:
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_MICROPS_FUNCTION (0x20A1)
- An attempt was made to issue a function that is invalid in a micro presentation space.
- PMERR_INV_FOR_THIS_DC_TYPE (0x2074)
- An attempt has been made to issue GpiRemoveDynamics or GpiDrawDynamics to a presentation space associated with a metafile device context.
Example Code
#define INCL_GPISEGMENTS /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ BOOL rc; /* Success indicator. */ rc = GpiDrawDynamics(hps);
This example uses GpiDrawDynamics to redraw the two previously defined dynamic chained segments.
#define INCL_GPISEGMENTS /* Segment functions */ #include <os2.h> BOOL fSuccess; /* success indicator */ HPS hps; /* presentation-space handle */ /* The chaining attribute is switched on */ GpiSetInitialSegmentAttrs(hps, ATTR_CHAINED | ATTR_DYNAMIC, ATTR_ON); /* two dynamic chained segments are defined */ GpiOpenSegment(hps, 1L); . . GpiCloseSegment(hps); GpiOpenSegment(hps, 2L); . . GpiCloseSegment(hps); /* draw the dynamic segment chain */ fSuccess = GpiDrawDynamics(hps);