Timing Information

For uncompressed data, a stroke's interval implies the number of points in the stroke. An application can obtain this number directly from a STROKEINFO structure. The following is of academic interest only, illustrating how time intervals correspond to the point data within a stroke.

First, an application gets the device sampling rate with a call to GetPenDataInfo. The sampling rate is the number of points the pen device driver sends to Windows during each second of pen activity.

HPENDATA hpndt;

PENINFO peninfo;

int nSamplingRate;

.

.

.

if (GetPenDataInfo( hpndt, NULL, (LPPENINFO) &peninfo, 0 ))

nSamplingRate = peninfo.nSamplingRate;

Alternatively, an application can query the pen device driver directly for the sampling rate, as described in "Recognition Functions" in Chapter 8, "Writing a Recognizer."

The number of points in a stroke can now be determined from the start and stop times in the stroke's INTERVAL structure:

INTERVAL interval;

int nSamplingRate, nPoints, nms;

.

.

.

// Compute number of milliseconds in interval

nms = ((interval.atEnd.sec - interval.atBegin.sec) * 1000) +

(interval.atEnd.ms - interval.atBegin.ms);

// Compute number of points that occurred during interval

nPoints = (nms * nSamplingRate) / 1000;

After recognition, an application can determine the time intervals at which recognized symbols were written. Calling CreateInksetHRCRESULT creates the inkset for the required intervals:

HINKSET hinkset; // Allocate the inkset

HRCRESULT hresult; // Symbols for guesses go here

.

.

.

// Get symbols that make up the recognizer's best guess

GetResultsHRC( hrc, GRH_ALL, (LPHRCRESULT) &hresult, 1 );

// Get the inkset for symbols 2 through 11 of the guess

hinkset = CreateInksetHRCRESULT( hresult, 2, 10 );

The above code fragment creates an inkset containing a maximum of 10 intervals corresponding to the second through eleventh symbols of the recognizer's best guess. The section "Unboxed Recognition" in the next chapter describes the GetResultsHRC function in detail. For a description of the internal workings of CreateInksetHRCRESULT, see "The Recognition Functions" in Chapter 8, "Writing a Recognizer."

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