use of com.gargoylesoftware.htmlunit.javascript.host.canvas.CanvasRenderingContext2D in project htmlunit by HtmlUnit.
the class HTMLCanvasElement method getContext.
/**
* Gets the context.
* @param contextId the context id
* @return Returns an object that exposes an API for drawing on the canvas,
* or null if the given context ID is not supported
*/
@JsxFunction
public Object getContext(final String contextId) {
if ("2d".equals(contextId)) {
if (context2d_ == null) {
final CanvasRenderingContext2D context = new CanvasRenderingContext2D(this);
context.setParentScope(getParentScope());
context.setPrototype(getPrototype(context.getClass()));
context2d_ = context;
}
return context2d_;
}
return null;
}
Aggregations