This project demonstrates a simple way to integrate MyScript Interactive Ink SDK into your UWP app.
This project consists of 3 groups:
- The application project
Starter
; - The shared libraries
Modules
, including:- Library
Common
; - Library
UI
;
- Library
- The shared sources, including:
- The shared assembly info
Properties
; - The shared localization
Strings
; - The shared
Certificate
from MyScript Developer, which is required to integrate Interactive Ink SDK.
- The shared assembly info
To obtain your own developer certificate, please follow the official instructions.
Corresponding to the project structure, classes/types are grouped into the following namespaces:
Starter
->MyScript.InteractiveInk.*
;Common
->MyScript.InteractiveInk.Common.*
;UI
->MyScript.InteractiveInk.UI.*
The entry point is App
, which creates and holds a Engine
instance with MyCertificate
.
Then the App
launches MainPage
, which creates and holds a corresponding MainViewModel
to hold an Editor
instance.
The Editor
is supposed to be attached to the UI control InteractiveInkCanvas
, which handles the most of rendering commands and exposes interactivity from Interactive Ink SDK to the application layer.
The main implementation lies in InteractiveInkCanvas
, to apply this controls in application, you have to:
First, create an Editor
(see MainViewModel
):
// Code behind.
public Editor Editor { get; set; }
// Assumes that the DPI is the default value 96.
var dpi = 96;
var renderer = engine.CreateRenderer(dpi, dpi, RenderTarget);
Editor = engine.CreateEditor(renderer);
Then attach the Editor
to InteractiveInkCanvas
(see MainPage
):
<!-- Xaml -->
<Page xmlns:iink="using:MyScript.InteractiveInk.UI.Xaml.Controls">
<iink:InteractiveInkCanvas
x:Name="RenderTarget"
Editor="{x:Bind Editor, Mode=OneWay}" />
</Page>
Basically, Interactive Ink SDK follows the most common inking mechanism: input the user pointer events into the Editor
, then the Editor
outputs the rendering commands, which are supposed to be implemented by developers on their platforms.
Therefore, the following are the points that you have to implement to integrate Interactive Ink SDK into your app:
- Input pointer events
- Output rendering commands
- Implement
IRenderTarget
; - Implement shape drawing commands
ICanvas
&IPath
;
- Implement
See more information about MyScript Interactive Ink SDK.
This project is only a representative of personal views, instead of any official positions!