Share via


InkAnalyzerBase.AddStroke Method (Int32, array<Int32[], array<Guid[], Int32)

Adds stroke data for a single stroke to the ink analyzer and assigns a specific culture identifier to the stroke.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Syntax

'Declaration
Public Function AddStroke ( _
    strokeId As Integer, _
    strokePacketData As Integer(), _
    strokePacketDescription As Guid(), _
    languageId As Integer _
) As ContextNodeBase
'Usage
Dim instance As InkAnalyzerBase 
Dim strokeId As Integer 
Dim strokePacketData As Integer()
Dim strokePacketDescription As Guid()
Dim languageId As Integer 
Dim returnValue As ContextNodeBase 

returnValue = instance.AddStroke(strokeId, _
    strokePacketData, strokePacketDescription, _
    languageId)
public ContextNodeBase AddStroke(
    int strokeId,
    int[] strokePacketData,
    Guid[] strokePacketDescription,
    int languageId
)
public:
ContextNodeBase^ AddStroke(
    int strokeId, 
    array<int>^ strokePacketData, 
    array<Guid>^ strokePacketDescription, 
    int languageId
)
public function AddStroke(
    strokeId : int, 
    strokePacketData : int[], 
    strokePacketDescription : Guid[], 
    languageId : int
) : ContextNodeBase

Parameters

  • strokePacketData
    Type: array<System.Int32[]

    An array containing the packet data for the stroke.

  • strokePacketDescription
    Type: array<System.Guid[]

    An array containing the packet property identifiers.

  • languageId
    Type: System.Int32

    The culture identifier to assign to the stroke.

Return Value

Type: System.Windows.Ink.AnalysisCore.ContextNodeBase
The context node to which the ink analyzer added the stroke.

Remarks

The InkAnalyzerBase adds the stroke to a ContextNodeBase that has a Type property value of UnclassifiedInk.

The ink analyzer assigns the specified culture identifier to the stroke. It then adds the stroke to the first unclassified ink node under the ink analyzer's root node that contains strokes with the same culture identifier. If the ink analyzer cannot find a node with the same culture identifier, it creates a new ContextNodeBase under its root node and adds the stroke to the new unclassified ink node.

strokePacketData contains packet data for all of the points in the stroke. strokePacketDescription contains the globally unique identifiers (GUIDs) that describe the types of packet data included for each point in the stroke. For a complete list of available packet properties, see the PacketProperty class.

This method expands the DirtyRegion to the union of the region's current value and the bounding box of the added stroke.

If the InkAnalyzerBase already contains a stroke with the same identifier, the InkAnalyzerBase throws an exception.

Examples

This example defines a method that converts a Stroke to packet data, adds the stroke to an InkAnalyzerBase, and assigns a specific locale identifier to the stroke. The method returns the ContextNodeBase to which the ink analyzer added the stroke.

''' <summary> 
''' Adds a stroke to an InkAnalyzerBase and assigns a specific 
''' culture identifier to the stroke. 
''' </summary> 
''' <param name="baseInkAnalyzer"> 
''' The analyzer that receives the stroke.</param> 
''' <param name="theStroke">The stroke to add.</param> 
''' <param name="languageIdentifier">The culture identifier to assign to 
''' the stroke.</param> 
''' <returns>The node to which the analyzer added the stroke.</returns> 
''' <remarks> 
''' This method converts stroke data to packet data for example only. 
''' The InkAnalyzerBase is used when your application is handling packet 
''' data. If your application uses stroke data from an Ink object, then 
''' you would use InkAnalyzer. 
''' </remarks> 
Public Overloads Shared Function MyAddStroke( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStroke As Microsoft.Ink.Stroke, _
ByVal languageIdentifier As Integer) _
As System.Windows.Ink.AnalysisCore.ContextNodeBase
    If baseInkAnalyzer Is Nothing Then 
        Throw New ArgumentNullException("baseInkAnalyzer")
    End If 

    If theStroke Is Nothing Then 
        Throw New ArgumentNullException("theStroke")
    End If 

    ' Add a single stroke to the InkAnalyzerBase and specify the 
    ' stroke's language. 
    Dim result As System.Windows.Ink.AnalysisCore.ContextNodeBase = _
        baseInkAnalyzer.AddStroke(theStroke.Id, _
            theStroke.GetPacketData(), theStroke.PacketDescription, _
            languageIdentifier)

    Return result
End Function 'AddStroke
/// <summary> 
/// Adds a stroke to an InkAnalyzerBase and assigns a specific 
/// culture identifier to the stroke. 
/// </summary> 
/// <param name="baseInkAnalyzer">
/// The analyzer that receives the stroke.</param> 
/// <param name="theStroke">The stroke to add.</param>
/// <param name="languageIdentifier">The culture identifier to assign to
/// the stroke.</param> 
/// <returns>The node to which the analyzer added the stroke.</returns> 
/// <remarks> 
/// This method converts stroke data to packet data for example only. 
/// The InkAnalyzerBase is used when your application is handling packet 
/// data. If your application uses stroke data from an Ink object, then 
/// you would use InkAnalyzer. 
/// </remarks> 
public static System.Windows.Ink.AnalysisCore.ContextNodeBase MyAddStroke(
System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
    Microsoft.Ink.Stroke theStroke,
    int languageIdentifier)
{
    if (null == baseInkAnalyzer)
    {
        throw new ArgumentNullException("baseInkAnalyzer");
    }

    if (null == theStroke)
    {
        throw new ArgumentNullException("theStroke");
    }

    // Add a single stroke to the InkAnalyzerBase and specify the 
    // stroke's language.
    System.Windows.Ink.AnalysisCore.ContextNodeBase result = baseInkAnalyzer.AddStroke(
        theStroke.Id, theStroke.GetPacketData(),
        theStroke.PacketDescription, languageIdentifier);

    return result;
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzerBase Class

InkAnalyzerBase Members

AddStroke Overload

System.Windows.Ink.AnalysisCore Namespace

InkAnalyzerBase.AddStrokes

InkAnalyzerBase.RemoveStroke

InkAnalyzerBase.RemoveStrokes