Did you know ... Search Documentation:
canvas->restore_state