InkStroke class

Applies to Windows only

A single ink stroke, including the Bézier curve parameters used for final rendering of the stroke.

Syntax


public sealed class InkStroke

Attributes

[DualApiPartition()]
[MarshalingBehavior(None)]
[Version(0x06020000)]

Members

The InkStroke class has these types of members:

Methods

The InkStroke class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Clone Copies the InkStroke to another InkManager (or InkStrokeContainer).
GetRenderingSegments Gets the rendering segments of the stroke.

 

Properties

The InkStroke class has these properties.

PropertyAccess typeDescription

BoundingRect

Read-onlyGets the bounding box for the InkStroke.

DrawingAttributes

Read/writeGets or sets the properties associated with an InkStroke.

Recognized

Read-onlyGets whether the stroke is recognized.

Selected

Read/writeGets whether the stroke is selected.

 

Remarks

JavaScript (usage)

var inkStrokes = Windows.UI.Input.Inking.InkManager.getStrokes;

var inkStroke = inkStrokes[...];

var inkStrokes = Windows.UI.Input.Inking.inkRecognitionResult.getStrokes;

var inkStroke = inkStrokes[...];

var inkStrokes = Windows.UI.Input.Inking.inkStrokeContainer.getStrokes;

var inkStroke = inkStrokes[...];

 

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Examples

Here we iterate through each stroke in an InkManager and process them for final rendering using Bézier curves.


        // Iterate through each stroke.
        inkManager.getStrokes().forEach(
            function (stroke)
            {
                inkContext.beginPath();
                if (stroke.selected) {
                    inkContext.lineWidth = stroke.drawingAttributes.size.width * 2;
                    inkContext.strokeStyle = "green";
                } else {
                    inkContext.lineWidth = stroke.drawingAttributes.size.width;
                    inkContext.strokeStyle = "black";
                }

                // Enumerate through each line segment of the stroke.
                var first = true;

                stroke.getRenderingSegments().forEach(
                    function (segment)
                    {
                        // Move to the starting screen location of the stroke.
                        if (first)
                        {
                            inkContext.moveTo(segment.position.x, segment.position.y);
                            first = false;
                        }
                        // Calculate the bezier curve for the segment.
                        else
                        {
                            inkContext.bezierCurveTo(segment.bezierControlPoint1.x,
                                                     segment.bezierControlPoint1.y,
                                                     segment.bezierControlPoint2.x,
                                                     segment.bezierControlPoint2.y,
                                                     segment.position.x, segment.position.y);
                        }
                    }
                );
                
                // Draw the stroke.
                inkContext.stroke();
                inkContext.closePath();
            }


Requirements

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

None supported

Namespace

Windows.UI.Input.Inking
Windows::UI::Input::Inking [C++]

Metadata

Windows.winmd

See also

Windows.UI.Input.Inking Classes
Responding to pen and stylus input
Ink App sample

 

 

Show:
© 2014 Microsoft