How to save the state of canvas and do the undo function the, save () method seems to be of little use.

need to do a picture graffiti function, and then need to undo the function, save () method seems to be useless, checked the data and said that it only saves the state, can not restore the canvas content. no, no, no.
how can I save the operation steps to undo


you need to save the content. You need to save it first.
save is not used to save content, but to save contextual information, such as color, filling, etc.


save () saves only the state of the CanvasRenderingContext2D object and all the properties of the object, excluding the graphics drawn on the object.

give a link to see for yourself https://www.w3cplus.com/canva.

PS: your save and restore codes are not posted, so how can I show you the problem

add:

if you need to implement the function of ctrl + z, ctrl + y, it is impossible to use save/restore.
you can create your own stack, to store your operations. If you need to undo, stack pop, then
rerun again. For performance reasons, when you can rerun base image can not be the initial state, you can
customize several base image

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4997c-43a03.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4997c-43a03.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?