Skip to content

Latest commit

 

History

History
83 lines (66 loc) · 5.07 KB

inkmanager_processpointerupdate_416065930.md

File metadata and controls

83 lines (66 loc) · 5.07 KB
-api-id -api-type -api-device-family-note
M:Windows.UI.Input.Inking.InkManager.ProcessPointerUpdate(Windows.UI.Input.PointerPoint)
winrt method
xbox

Windows.UI.Input.Inking.InkManager.ProcessPointerUpdate

-description

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Processes position and state properties, such as pressure and tilt, for the specified pointer, from the last pointer event up to and including the current pointer event.Call this method after ProcessPointerDown and before ProcessPointerUp.

Important

This method is not supported in desktop apps.

-parameters

-param pointerPoint

The input pointer for which updates are to be processed.

-returns

When the current InkManipulationMode is Inking or Selecting, this method returns the Point (screen position in ink space) associated with the last ProcessPointerUpdate of pointerPoint.

-remarks

-examples

The following example demonstrates a handler for a PointerMoved event on an InkCanvas.

Here, the intermediate points (intermediatePoints) unprocessed since the last update are processed by the InkManager (inkManager) in the ProcessPointerUpdate call.

void InkingArea_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
    var pointerPoint = e.GetCurrentPoint(InkingArea);

    if (pointerId == (int)pointerPoint.PointerId)
    {
        switch (inkManager.Mode)
        {
            case Windows.UI.Input.Inking.InkManipulationMode.Erasing:
                // Check if something has been erased.
                // In erase mode, ProcessPointerUpdate returns an 
                // `invalidateRect` (if it is not degenerate something 
                // has been erased). In erase mode we don't bother processing 
                // intermediate points.
                var invalidateRect = 
                    (Windows.Foundation.Rect)inkManager.ProcessPointerUpdate(
                        e.GetCurrentPoint(InkingArea));
                if (invalidateRect.Height != 0 && invalidateRect.Width != 0)
                {
                    // We don't know what has been erased so we clear the render
                    // and add back all the ink saved in the ink manager.
                    renderer.Clear();
                    renderer.AddInk(inkManager.GetStrokes());
                }
                break;

            case Windows.UI.Input.Inking.InkManipulationMode.Inking:
            case Windows.UI.Input.Inking.InkManipulationMode.Selecting:
                // Process intermediate points.
                var intermediatePoints = e.GetIntermediatePoints(InkingArea);
                for (int i = intermediatePoints.Count - 1; i >= 0; i--)
                {
                    inkManager.ProcessPointerUpdate(intermediatePoints[i]);
                }

                // Live rendering.
                renderer.UpdateLiveRender(pointerPoint);
                break;
        }
    }
}

-see-also

Pen and stylus interactions, Get started: Support ink in your UWP app, Ink analysis sample (basic) (C#), Ink handwriting recognition sample (C#), Save and load ink strokes from an Ink Serialized Format (ISF) file, Save and load ink strokes from the clipboard, Ink toolbar location and orientation sample (basic), Ink toolbar location and orientation sample (dynamic), Coloring book sample, Family notes sample, Inking sample (JavaScript), Simple inking sample (C#/C++), Complex inking sample (C++), Ink analysis sample