cracker0dks / whiteboard

Lightweight collaborative Whiteboard / Sketchboard
MIT License
719 stars 198 forks source link

Get ink information #163

Closed nunores closed 1 year ago

nunores commented 1 year ago

Hi! Is there any way that I can obtain the information of the handwritten strokes?

Ultimately I would like to extract the strokes of the drawn data present on the whiteboard (drawn by anyone) in order to export them into a file type like InkML. I would kindly appreciate some insight on where I could find this data stored internally.

InkML files look like this: exp.txt

cracker0dks commented 1 year ago

Hey, I dont know the inkML format this should do the trick: just save (export) the whiteboard as JSON

image

then take a look inside the file. You will see every stroke like this:

image

you would need to read in the JSON file and convert just the pen strokes to your format. good luck :)

nunores commented 1 year ago

I see! I saw that you have undo/redo features and from what I understand you are grouping these mini-strokes into bigger strokes through interpolation, and these are the ones deleted when undoing. Are these groups stored anywhere?

cracker0dks commented 1 year ago

It is only grouped from mouse down to mouse up. What you see in the screenshot above is already a "grouped stroke". We dont have "mini-strokes". The interpolation is only done inside one stroke to make it smooth :)