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(
)
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.