1. @SupportedBrowser(SupportedBrowser.CHROME)
  2. @SupportedBrowser(SupportedBrowser.SAFARI)
  3. @Experimental()
  4. @DomName('Document.getCSSCanvasContext')
CanvasRenderingContext getCssCanvasContext(String contextId, String name, int width, int height)

Gets a CanvasRenderingContext which can be used as the CSS background of an element.

CSS:

background: -webkit-canvas(backgroundCanvas)

Generate the canvas:

var context = document.getCssCanvasContext('2d', 'backgroundCanvas',
    100, 100);
context.fillStyle = 'red';
context.fillRect(0, 0, 100, 100);

See also:

Source

@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
@DomName('Document.getCSSCanvasContext')
CanvasRenderingContext getCssCanvasContext(
    String contextId, String name, int width, int height) {
  throw new UnsupportedError("Not supported");
}