implements save canvas state