Partager via


RotationTransform

RotationTransform

Gets the transformation matrix that the IInkDivisionUnit object uses to rotate the strokes to horizontal.

Declaration

[C++]

[C++]
[propget] HRESULT get_RotationTransform([out,retval]IInkTransform **RotationTransform);

[Microsoft® Visual Basic® 6.0]

[Visual Basic]
Public Property Get RotationTransform() As InkTransform

Property Value

InkTransform The transformation matrix that the IInkDivisionUnit object uses to rotate the strokes to horizontal.

For a IInkDivisionUnit object which represents a paragraph or drawing, this property returns NULL (Nothing in Visual Basic 6.0).

This property is read-only.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contains an invalid pointer.
E_INK_EXCEPTION An exception occurs inside the method.

Remarks

Text recognizers perform best with horizontal handwriting. Apply this transformation to the Strokes property of the IInkDivisionUnit object before passing the strokes to a InkRecognizerContext object.

The point of rotation of the matrix is set to the lower-left corner of the line's bounding box for both segments and lines. The rotation angle for a recognition segment is the same as that of the line that contains the segment.

Note: For a IInkDivisionUnit object which represents a paragraph or drawing, this property returns NULL.

Use this property to level handwriting or to accurately draw lines or shapes around angled handwriting.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates an InkDivider theDivider and assigns to it an 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.

[Visual Basic]
' 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

Applies To