Name
CanvasRenderingContext2D.save( ): save a copy of the current graphics state
Synopsis
void save( )
Description
save( ) pushes a copy of
the current graphics state onto a stack of saved graphics states.
This allows you to temporarily change the graphics state, and then
restore the previous values with a call to restore( ).
The graphics state of a canvas includes all the properties of
the CanvasRenderingContext2D object (except for the read-only
canvas property). It also
includes the transformation matrix that is the result of calls to
rotate( ), scale( ), and translate( ). Additionally, it includes
the clipping path, which is specified with the clip( ) method. Note, however, that the
current path and current position are not part of the graphics state
and are not saved by this method.
Bugs
Firefox 1.5 does not save and restore the strokeStyle property.
See Also
CanvasRenderingContext2D.restore(
)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access