DrawPenDataEx
- 0
An enhanced version of
DrawPenData. Besides displaying the pen data in an
HPENDATA object as a trail of visible ink,
DrawPenDataEx can govern the speed at which the data is rendered, a process called
animation.
int DrawPenDataEx( HDC hdc, LPRECT lprectVP, HPENDATA hpndt, UINT iStrkFirst, UINT iStrkLast, UINT iPntFirst, UINT iPntLast, ANIMATEPROC lpfnAnimateCB, LPANIMATEINFO lpai, UINT fuFlags )
Parameters
hdc
Handle to a device context.
lprectVP
Viewport rectangle, usually the bounding rectangle of the pen data, in client
coordinates. The ink is scaled to fit the specified rectangle. If this
parameter is NULL, the bounding rectangle of the ink in
hpndt is used, in whatever coordinate system it happens to be in.
hpndt
Handle to a pen data object.
iStrkFirst
Index of the first stroke to display.
iStrkLast
Index of the last stroke to display.
iPntFirst
Index of the first point in the first stroke to display.
iPntLast
Index of the last point in the last stroke to display.
lpfnAnimateCB
Pointer to a callback function instance, or NULL. The callback function is
called periodically during drawing, and animation is controlled by values in the
structure addressed by the next parameter,
lpai, which should not be NULL. If
lpfnAnimateCB and the speed in the
lpai structure parameters are NULL, the specified pen data is drawn without regard
to timing information, and no callback functions are generated. See
AnimateProc for a description of the callback function.
lpai
Address of an
ANIMATEINFO structure that specifies animation parameters to control how the pen data is
drawn. If this parameter is NULL, the function draws the specified pen data
without regard to timing information, and no callback functions are generated;
otherwise, the caller must initialize the
cbSize member to sizeof( ANIMATEINFO ).
fuFlags
This flag can be 0 or one of the following values:
DPD_HDCPEN
Use the GDI pen already selected into the specified device context. If this
flag is set, any pen formatting stored in
hpndt is ignored and all strokes are drawn with a single width and color. The
DrawPenData function uses this flag.
DPD_DRAWSEL
Paint selected strokes in the specified range. A solid pen is used, with a
width slightly larger than the stroke width. This flag can be used only for
drawing and is ignored for animation. It is incompatible with DPD_HDCPEN.
Return Value
Returns PDR_OK if successful. Attempting to draw an empty
HPENDATA (containing no strokes) also returns PDR_OK. Otherwise, returns one of the
following:
Constant
| Description
|
PDR_ABORT
| Drawing aborted because pen data became invalid after a callback or yield.
|
PDR_CANCEL
| Callback cancel or impasse. An impasse occurs when the user attempts to
animate with 0 percent speed (that is, pause), but the callback interval is on a
per-stroke basis.
|
PDR_COMPRESSED
| Pen data is compressed.
|
PDR_ERROR
| Bad animation structure, invalid sampling rate (0 or less) in pen data header,
illegal flags, or other error.
|
PDR_MEMERR
| Memory error.
|
PDR_PNDTERR
| Invalid pen data. This value is also returned if the pen data is destroyed or
corrupted during drawing or animation. This error can occur if an application
is drawing a large pen data object and then destroys the data before drawing is
complete.
|
PDR_PNTINDEXERR
| Invalid point index.
|
PDR_STRKINDEXERR
| Invalid stroke index.
|
PDR_VERSIONERR
| Could not convert old pendata.
|
Comments
DrawPenDataEx is a general-purpose drawing function for rendering pen data objects. The
calling application can use the timing information in the strokes to animate the
pen data and specify which subset of the pen data should be drawn.
Partial pen data objects can be drawn by specifying first and last strokes and
points with
iStrkFirst,
iStrkLast,
iPntFirst, and
iPntLast. Set beginning values to 0 and ending values to IX_END to display the entire
pen data object. The function fails if any of these values lie outside the
ranges available in the pen data. The stroke values must be between 0 and the total
number of strokes in the pen data, and the point indices must be between 0 and
the number of points in their stroke.
DrawPenDataEx can display only a set of sequential strokes with a single call. To draw
nonsequential strokes
say, the second, fifth, and eighth strokes of the pen data
requires multiple calls to
DrawPenDataEx.
Ink displayed by
DrawPenDataEx differs slightly from the original rendering, as described in the
DrawPenData topic. However,
DrawPenDataEx can automatically display the ink with its original color and width, saving
the application the burden of resetting the current GDI pen characteristics. To
draw the ink according to the GDI settings, set
fuFlags to DPD_HDCPEN.
If
lpfnAnimateCB is not NULL, the specified callback function must return TRUE to continue
drawing, or FALSE to terminate drawing.
An application can modify the pen data while it is being rendered, for
example, during an animation callback, task switching, or internal yield. However,
doing so can make internal pointers or data invalid and result in unpredictable
behavior. For this reason, editing the pen data during rendering is not
recommended.
See Also
AnimateProc,
DrawPenData,
RedisplayPenData,
DrawPenDataFmt,
ANIMATEINFO
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database