Divide Method
Divide Method |
Returns a IInkDivisionResult object that contains the results of the layout analysis of strokes in the InkDivider object.
Declaration
[C++]
HRESULT Divide(
[out,retval] IInkDivisionResult** InkDivisionResult
);
[Microsoft® Visual Basic® 6.0]
Public Function Divide() As InkDivisionResult
Parameters
InkDivisionResult
[out,retval] Returns a IInkDivisionResult object that contains structural information about the strokes in the InkDivider object.
Return Value
HRESULT value | Description |
---|---|
S_OK | Success. |
E_POINTER | A parameter contains an invalid pointer. |
E_UNEXPECTED | Unexpected parameter or property type. |
E_FAIL | An unspecified error occurred. |
E_OUTOFMEMORY | Unable to allocate memory to complete the operation. |
E_INK_EXCEPTION | An exception occurred inside the method. |
Remarks
This method returns a new IInkDivisionResult object each time this method is called.
Example
[Visual Basic 6.0]
This Visual Basic 6.0 example creates an InkDivider, theDivider, and assigns to it a InkStrokes collection, theStrokes, and a InkRecognizerContext object, theRecognizerContext. The Divide method is called to get a snapshot of the analysis results, theResult. The ResultByType method is called with an InkDivisionType enumeration value of IDT_Line to retrieve all of the line units within theResult. If the collection of lines is not empty, then for each line, theLine, in the collection, the DivisionType, Strokes, RecognitionString, and RotationTransform properties are retrieved.
' Create the InkDivider and assign a strokes collection to it.
Dim theDivider As InkDivider
Set theDivider = New InkDivider
Set theDivider.ReconizerContext = theRecognizerContext
Set theDivider.Strokes = theStrokes
' Retrieve the analysis results, and get the first line.
Dim theResult As IInkDivisionResult
Set theResult = theDivider.Divide()
Dim theDivisionUnits As IInkDivisionUnits
Set theDivisionUnits = theResult.ResultByType(InkDivisionType.IDT_Line)
Dim theLine As IInkDivisionUnit
If Not (theDivisionUnits Is Nothing) Then
For Each theLine In theDivisionUnits
' For each line element in the collection
' retrieve the division type, the strokes,
' the recognition string, and the rotation transform.
Dim theDivisionType As InkDivisionType
theDivisionType = theLine.DivisionType
Dim elementStrokes As InkStrokes
Set elementStrokes = theLine.Strokes
Dim theRecognitionString As String
theRecognitionString = theLine.RecognizedString
Dim theInkTransform As InkTransform
theInkTransform = theLine.RotationTransform
Next
End If