WritePadSDK
WritePadSDK copied to clipboard
Shape recognition
Is it possible to learn SDK to recognize shapes? Circle, Square, Arrow, Line, etc..
There is already a basic recognizer of several geometrical shapes in the INK_ API. See Doc.
There is another problem i have met during work with a shape recognition. Documentation says: a function SHAPETYPE INK_RecognizeShape(CGStroke *pStroke, int nStrokeCnt, SHAPETYPE inType) analyzes the stroke. If a geometrical shape is recognized, your pStroke will point on a new array of points representing recognized shape. Also function returns a type of shape.
I may say the function returns a correct type of a recognized shape, but, unfortunately, it doesn't change CGStroke data i have passed as parameter.
By the way, it makes sense to say InkWrapper.h has the same function, but the first parameter is CGStroke stroke, not CGStroke *pStroke.
Right, the INK_RecognizeShape will not return the new stroke data only the type if it is recognized shape, if any. Instead of this method, first use INK_EnableShapeRecognition( ... true ) then use INK_AddStroke(...) it will add a new stroke to INK_DATA object or a shape if it is recognized. To disable ink recognition, use INK_EnableShapeRecognition( ... false )
Thanks. It really works.
Also, i have noticed a shape recognition doesn't work from background threads (INK_RecognizeShape returns SHAPE_UNKNOWN; INK_AddStroke - false). But from the main thread it properly works. Do I need to make this shape recognition asynchronous at all? Or it doesn't load the main thread too much?