Search code examples
c#wpfpixelsenseinkcanvas

saving the inkcanvas


In my application the user can create multiple objects (so called drawings) each of which has a SurfaceInkCanvas, very similar with the Photopad (the Photo Paint app)in the SDKSamples(provided by MS Surface SP1 SDK). What would be the best way to save the content of the inkCanvas(the drawing object) given the fact that there may be tens or even hundreds of them created.

After some research, one option popped-out: converting it to an image, jpg or png, but this method doesn't seem that scalable IMO.

Would it be possible to store the points in a database(preferably sqlite)?

The goal is to be able to restore the drawings(contents of the inkCanvas) for further editing upon loading.


Solution

  • there's already a format that microsoft uses to save the strokes in, which is ISF - standing for Ink Serialized format that saves the Strokes collection in an .isf file.

    However in this example each drawing is saved in a separate (but small-size) .isf file that can be easily loaded back for further editing or even converting (exporting) it to bitmap.

    So a good method would be to save each drawing in files(even though this is a bit more expensive, time-wise, than simply storing it in a sqlite db)and save the path of each along with an id in the database to identify each session. Any suggestion for further optimising this method from a scalability point of view?