|
HitTestPenData
2.0
Determines if a given point lies on or near the pen-down strokes contained in
an HPENDATA object.
int HitTestPenData( HPENDATA hpndt, LPPOINT lppt, UINT dThresh, UINT FAR* lpiStrk, UINT FAR* lpiPnt )
Parameters
hpndt
Handle to the HPENDATA object. HitTestPenData does not alter the data in the HPENDATA object.
lppt
Address of a POINT structure containing the point to test.
dThresh
Threshold around the point given in lppt. The point lies at the center of a square with sides of length dThresh. If HitTestPenData finds a point in the HPENDATA object that lies in the square, it indicates a "hit." dThresh must have the same scaling units as the points in the HPENDATA or the result will not be correct. If dThresh is 0, HitTestPenData assumes a default threshold value of 3.
lpiStrk
Stroke index from which to begin testing. After HitTestPenData returns from a successful test, the variable that lpiStrk points to contains the index of the hit stroke.
lpiPnt
Point index from which to begin testing. After HitTestPenData returns from a successful test, the variable that lpiPnt points to contains the index of the hit point in the stroke indicated by lpiStrk.
Return Value
Returns one of the following if successful:
Constant
| Description
| PDR_HIT
| The point hits (intersects) the pen data or falls within the provided
threshold around a particular point in the pen data as specified by the stroke and the
point indices. The stroke and point values are returned in lpiStrk and lpiPnt, respectively.
| PDR_NOHIT
| The point does not hit (intersect) the pen data nor does it fall within the
provided threshold around a particular point in the pen data as specified by the
stroke and the point indices.
|
Otherwise, the function returns one of the following negative values:
Constant
| Description
| PDR_COMPRESSED
| Pen data is compressed.
| PDR_ERROR
| Parameter or other unspecified error.
| PDR_MEMERR
| Memory error.
| PDR_PNDTERR
| Invalid pen data.
| PDR_PNTINDEXERR
| Invalid point index.
| PDR_STRKINDEXERR
| Invalid stroke index.
| PDR_VERSIONERR
| Could not convert old pen data.
|
Comments
HitTestPenData checks whether the point specified by lppt falls within the threshold specified by dThresh around a point in the pen data, depending on the zero-based starting stroke
and point indices specified by lpiStrk and lpiPnt. This function tests only down strokes in the pen data. If lpiStrk is greater than the number of strokes in the pen data, testing starts from
the first stroke.
Similarly, if lpiPnt is greater than the number of points in the stroke, testing starts from the
first point in that stroke. The first point in the first stroke (from the
specified indices) that meets the test condition is returned via lpiPnt and lpiStrk, respectively.
In any case, HitTestPenData accounts for the width of the ink trail. If the value given in dThresh is less than the ink width, HitTestPenData ignores the specified value of dThresh and instead uses the ink width as the threshold.
HitTestPenData does not consider pen-up strokes.
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
More Online Helps
Win32 Programmer's Reference (win32.hlp)
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|