Each operation you perform has to be embedded in a semantic command (e.g. "draw point", "draw line") that can perform the operation and also perform the inverse of it (so in case of "draw point" it would restore the state of the environment to exactly what it was before the point was drawn).
Bookmarks