Maintaining history of all actions

Hi,

I am working on a paint application, I am able to draw lines, draw shapes, erase. I need to implement undo and redo functionality. I plan to store history in a bitmap and put it in an array.

My question is whether we can have an alternate solution other using bitmap class. How can I store coordinates of non straight line without using up lot of memory and processor.