Create a new graphics context object.
The 2D canvas rendering context to wrap.
Private
_contextPrivate
_disposedPrivate
_stateDispose of the resources held by the object.
If the object's dispose
method is called more than once, all
calls made after the first will be a no-op.
It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.
A thin caching wrapper around a 2D canvas rendering context.
Notes
This class is mostly a transparent wrapper around a canvas rendering context which improves performance when writing context state.
For best performance, avoid reading state from the
gc
. Writes are cached based on the previously written value.Unless otherwise specified, the API and semantics of this class are identical to the builtin 2D canvas rendering context: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
The wrapped canvas context should not be manipulated externally until the wrapping
GraphicsContext
object is disposed.