blob: 07140035d376c8419affb4219423053f6c3525ad [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of $LIBRARYNAME;
$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS implements CanvasImageSource$IMPLEMENTS$NATIVESPEC {
$!MEMBERS
/** An API for drawing on this canvas. */
$if DART2JS
CanvasRenderingContext2D get context2D =>
JS('Null|CanvasRenderingContext2D', '#.getContext(#)', this, '2d');
$else
CanvasRenderingContext2D get context2D => getContext('2d');
$endif
@deprecated
CanvasRenderingContext2D get context2d => this.context2D;
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@Experimental()
gl.RenderingContext getContext3d({alpha: true, depth: true, stencil: false,
antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false}) {
var options = {
'alpha': alpha,
'depth': depth,
'stencil': stencil,
'antialias': antialias,
'premultipliedAlpha': premultipliedAlpha,
'preserveDrawingBuffer': preserveDrawingBuffer,
};
var context = getContext('webgl', options);
if (context == null) {
context = getContext('experimental-webgl', options);
}
return context;
}
String toDataUrl([String type = 'image/png', num quality]) =>
$dom_toDataUrl(type, quality);
}