Obtains the canvas drawing context. The invoking methods are as follows6+:
var ctx = canvas.getContext(contextType);
var ctx = canvas.getContext(contextType, contextAttributes);
contextType is mandatory and can be set to 2d. contextAttributes is optional and can be set only to enable or disable the anti-aliasing function. By default, the anti-aliasing function is disabled.
The contextType objects are as follows:
2d: The return value is a 2D drawing object that provides specific 2D drawing operations. For details, see section CanvasRenderingContext2D.
This API cannot be called in onInit or onReady.
|