Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

InkStroke class

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

Syntax


/* For information about creating or accessing this object, see Remarks. */

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).
GetInkPoints Gets the collection of InkPoint objects used to construct the InkStroke.
GetRenderingSegments Gets the rendering segments of the stroke.

 

Properties

The InkStroke class has these properties.

PropertyAccess typeDescription

BoundingRect

Read-only

Gets the bounding box for the InkStroke.

DrawingAttributes

Read/write

Gets or sets the properties associated with an InkStroke.

PointTransform

Read/write

Gets or sets an affine transformation matrix to apply to the InkStroke object.

Recognized

Read-only

Gets whether the stroke is recognized.

Selected

Read/write

Gets 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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0 [for Xbox, see UWP features that aren't yet supported on Xbox]

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

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

See also

Object
Windows.UI.Input.Inking Classes
Pen and stylus interactions
Samples
Ink sample
Simple ink sample
Complex ink sample

 

 

Show: