Migrate from 1.5
This page lists the key points to pay attention to when migrating existing code from MyScript iink SDK 1.5 to the new MyScript iink SDK 2.0.
You are recommended to use the latest recognition resource packs to benefit from the latest improvements made to MyScript technology.
API updates
This section describes the API updates that might impact your application code when upgrading to MyScript iink SDK 2.0.
Editor and IEditorListener changes
The editor now handles selection and block objects in a quite similar way.
- For this reason, we have chosen to replace its
removeBlock
method by theerase​
method which takes as argument either a content selection or a non-root content block. So, if you were using theremoveBlock
, you should replace it in your code by theerase​
method. - To support both selections and blocks in
IEditorListener
events, thecontentSelection
method signature has also changed: it does not contain the list of selected blocks Ids anymore. So, oncontentSelection
notification, the changed selection should now be retrieved by callinggetSelection
on the editor.
Styling methods refactoring
With the introduction of the ToolController
, the styling methods are no more linked to the pen but can apply to any tool. For this reason, the Editor
pen style methods/properties have been removed from the 2.0 API. They have been replaced by the ToolController
tool style methods:
- If you were using the
setPenStyleClasses
andgetPenStyleClasses
, you should now use thesetToolStyleClasses
andgetToolStyleClasses
of theToolController
with the corresponding tool type (most probablyPointerTool.PEN
). - If you were using the
setPenStyle
andgetPenStyle
, you should now use thesetToolStyle
andgetToolStyle
of theToolController
with the corresponding tool type. - In addition, the
listStyleClasses
has been removed from theEditor
without any alternate, as it was difficult to understand and thus barely used.
➤ For further details on how to use those new methods, please refer to the styling page.
Former IImageDrawer refactoring
We have added a new createCanvas
method to what used to be the IImageDrawer
and removed the IImageDrawer
inheritance from IRendererTarget
.
This enables to simplify the image generation for export.
We’ve also decided to rename the former IImageDrawer
into IImagePainter
which, we think, better reflects its role.
You can refer to the ImagePainter
of the new UI reference implementation for an example of IImagePainter
implementation.
ICanvas updates to support a drop shadow on lasso selection
The ICanvas
interface has a new setDropShadow
method that is used to have a visual feedback on lasso selection, so when updating to MyScript iink 2.0, you should add this method to your ICanvas
implementation.
Deprecated rendering layers removal
As the BACKGROUND
and TEMPORARY
rendering layers were deprecated in the 1.4 version, we have removed all their references from the SDK:
- The enum
LayerType
inIRendererTarget
now only contains 2 types that areCAPTURE
andMODEL
. - We have removed the
drawBackground
anddrawTemporaryItems
methods from theRenderer
.
On iOS, IINKIFontMetricsProvider and IInkParameterSet API update and Swift methods renaming
- The
IINKIFontMetricsProvider
has been refactored for an ease of use in Swift: thegetGlyphMetrics
method now returns an array ofIINKGlyphMetrics
instead of an array of NSValue. If you had implemented your own font metrics provider (either in Objective-C or Swift), you should update your code to take into account this modification. - Missing error handling has been added to
IInkParameterSet
getStringForKey
method. - In order to propose iOS APIs that are more Swift friendly, we have renamed some Swift methods.
So, if you are a Swift developer upgrading to 2.0, you will have to make some method name adjustments for the following classes and protocols:
IINKContentPackage
,IINKContentPart
,IINKEditor
,IINKEngine
,IINKIRenderTarget
,IINKRenderer
, andIINKParameterSet
. To get the full list of methods, please refer to the methods that come with the NS_SWIFT_NAME macro in the corresponding header files.
Interfaces refactoring on Java/Android and C#/Windows
The ICanvas2
, IFontMetricsProvider2
and IRenderTarget2
interfaces have been merged into their corresponding super interfaces.
Other changes on Java/Android
- MyScript iink SDK 2.0 requires Java 8 (or higher) compatibility mode, so when migrating depending on your application settings, you might have to add the following compile options in your build.gradle:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
- The two deprecated
export
methods that were using a java.io.File argument have been suppressed. You should use the correspondingexport
methods with a FilePath output instead. - The
TextSpan
class has been refactored, so you should update the way you get its members. - The
com.myscript.util.IAutoCloseable
interface has been suppressed. Classes that were implementing this interface now implement thejava.lang.AutoCloseable
. Please refer to the Object lifecycle section for implementation guidelines.
UI Reference implementations update and refactoring
Our UI reference implementations have been updated to integrate the APIs changes listed in the previous section and the new tools. In addition, on Android it has been refactored to improve the classes responsibility split. So if you have been using our reference implementation, make sure to update your application accordingly.
Other changes
Diagram styling change
Due to the introduction of the highlighter, we have removed the .diagram-selection
style class that used to set the style applied to the overlay diagram blocks selections.
So, there is no more blue coloring on selected diagram blocks and it is no more possible to modify this styling option.
Raw Content gesture configuration update
The gesture.raw-content.enable-scratch
property has been suppressed as it is now possible to activate more gestures on Raw Content.
So, if you were using it, you should now use the raw-content.pen.gestures
property instead. Check the configuration page to get the full list of gestures options and how to set them.
Intel® 32-bit architectures
The 32-bit binaries are no longer provided for Intel architecture (i386) on Windows platforms.