Drawing state
The Canvas 2D context keeps state including fill and stroke styles, line settings, transforms, text settings, clipping regions, and compositing behavior. Changing a property affects later drawing operations. save() records the current state and restore() returns to the most recently saved state, which is useful when a transform or style should apply to only part of a drawing.