iink SDK on Device

Answered

Can I implement the preview using this SDK?

Hi

I develop with iink SDK for Android.

 

Can I implement the preview using this SDK?

I could not find the preview function from the Get started example.

 

Are there any plans for the preview to be added to the Get started example in the future?

 

image




Best Answer
Dear Raj,

to implement, the preview, you should get the text result from the jiix file, as follows:
-first, ensure you have an iink Editor properly initialized, such as in the code samples
-Create a content package: ContentPackage pkg = engine.createPackage(« myfile.iink »)
-Create a text content part: ContentPart part = pkg.createPart(« Text »)
-Set this part to the editor: Editor.setPart(part)
-Feed the editor with your ink using editor.pointerEvents(eventArray, false), where eventArray is your ink converted into pointer events (pointerDown, pointerMove+, pointerUp) and false means the gestures where deactivated
-wait for the recognition to end: editor.waitForIdle()
-export in JIIX format: editor.export_(MimeType.JIIX)

=> You can then get words with corresponding input range. This way, to a give ink, you can match the corresponding words.

Best regards,

Olivier

Dear Numa,

the final release of the iink sdk is available on our support site.

You can start using it: https://developer.myscript.com/getting-started

Best regards,

Olivier
Answer
Dear Raj,

to implement, the preview, you should get the text result from the jiix file, as follows:
-first, ensure you have an iink Editor properly initialized, such as in the code samples
-Create a content package: ContentPackage pkg = engine.createPackage(« myfile.iink »)
-Create a text content part: ContentPart part = pkg.createPart(« Text »)
-Set this part to the editor: Editor.setPart(part)
-Feed the editor with your ink using editor.pointerEvents(eventArray, false), where eventArray is your ink converted into pointer events (pointerDown, pointerMove+, pointerUp) and false means the gestures where deactivated
-wait for the recognition to end: editor.waitForIdle()
-export in JIIX format: editor.export_(MimeType.JIIX)

=> You can then get words with corresponding input range. This way, to a give ink, you can match the corresponding words.

Best regards,

Olivier

Thank you so much !!! :)

Dear Rajn

you can refer to the InputController.java file (interactive-ink-examples-android\UIReferenceImplementation\src\main\java\com\myscript\iink\uireferenceimplementation\InputController.java) on Android;
To the InputView.mm file (interactive-ink-examples-ios\IInkUIReferenceImplementation\Classes\Views\) on iOS.

...
case MotionEvent.ACTION_MOVE:
        if (historySize > 0)
        {
          PointerEvent[] pointerEvents = new PointerEvent[historySize + 1];
          for (int i = 0; i < historySize; ++i)
            pointerEvents[i] = new PointerEvent(PointerEventType.MOVE, event.getHistoricalX(i), event.getHistoricalY(i), event.getHistoricalEventTime(i), event.getHistoricalPressure(i), iinkPointerType, pointerId);
          pointerEvents[historySize] = new PointerEvent(PointerEventType.MOVE, event.getX(pointerIndex), event.getY(pointerIndex), event.getEventTime(), event.getPressure(), iinkPointerType, pointerId);
          editor.pointerEvents(pointerEvents, true);
        }
        else
        {
          editor.pointerMove(event.getX(pointerIndex), event.getY(pointerIndex), event.getEventTime(), event.getPressure(), iinkPointerType, pointerId);
        }
        return true;

      case MotionEvent.ACTION_POINTER_UP:
      case MotionEvent.ACTION_UP:
        if (historySize > 0)
        {
          PointerEvent[] pointerEvents = new PointerEvent[historySize + 1];
          for (int i = 0; i < historySize; ++i)
            pointerEvents[i] = new PointerEvent(PointerEventType.MOVE, event.getHistoricalX(i), event.getHistoricalY(i), event.getHistoricalEventTime(i), event.getHistoricalPressure(i), iinkPointerType, pointerId);
          pointerEvents[historySize] = new PointerEvent(PointerEventType.UP, event.getX(pointerIndex), event.getY(pointerIndex), event.getEventTime(), event.getPressure(), iinkPointerType, pointerId);
          editor.pointerEvents(pointerEvents, true);
        }
        else
        {
          editor.pointerUp(event.getX(pointerIndex), event.getY(pointerIndex), event.getEventTime(), event.getPressure(), iinkPointerType, pointerId);
        }
        return true;

      case MotionEvent.ACTION_CANCEL:
        editor.pointerCancel(pointerId);
        return true;

      default:
        return false;
    }
...

Best regards,

Olivier