Algotec interview question

there is a paint program, how do you implement a undo method?