Reputation: 11
I'm having the following problem:
I'm trying to save a content of an application. The content are drawn on a canvas via users. Example:
a user might click on a button to draw an ellipse, etc.
after clicking the button, the drawing will be displayed on a canvas.
I want to save the content drawn by the user on the canvas. Anyone could give me a hint. Is it good if I use the serialization and deserialization?
the code is written in C# using visual studio 2012, windows 8 app
Upvotes: 1
Views: 257
Reputation: 50672
There are several ways of solving this:
Save each action of the user - just like an undo/redo stack. Very flexible but files can get very big. In this case you'd serialize a stack of commands. To load the command would have to be replayed.
Save the logical construction of the drawing - just like Html or SVG. No undo/redo support but smaller files. In this case you'd serialize a document model.
Save each resulting bitmap after an action - easier to implement than 1. and 2. but harder to support editing of elements. No serialization of .NET objects just a lot of bitmaps.
Each approach has its advantages and disadvantages.
Upvotes: 2