Here's the language for getContext() -- let me know of any suggestions
before I send it off to hixie:
object getContext(in DOMString contextId, in optional
object attributes)
'contextId' must be a string naming a canvas rendering context to be
returned. This specification only defines one context, with the name
"2d". If getContext() is called with that exact string for its
'contextId' argument, then the UA must return a reference to an object
implementing CanvasRenderingContext2D. Other specifications may define
their own contexts, which would return different objects.
The optional 'attributes' parameter must be either null, or an object
specific to the context being requested. A null or unspecified value
for the 'attributes' parameter is equivalent to requesting default
attributes for the given context.
If getContext() is called multiple times on the same canvas with the
same context ID, it must return the same resulting context object
provided that the attributes are identical to all previous requests for
that context ID. If the attributes are not identical, getContext()
must raise an INVALID_STATE_ERR exception. (XXX is INVALID_STATE the
right thing here? or is SYNTAX_ERR better?)
If getContext() is called with a context ID different from the context
IDs given to any previous successful calls to getContext(), it may
either return a new canvas context that can be used simultaneously with
all previously obtained contexts, or return null to indicate that the
newly requested context cannot be used with the previously obtained
contexts.
If multiple rendering contexts are active, they all render to the same
canvas; they are not layered or otherwise isolated. Changes made to
the canvas with one context must be immediately visible to any other
active contexts on the canvas. It is up to the implementation to
manage synchronization issues associated with rendering with different
contexts to the same canvas.
- Vlad
|