| // 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 $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; |
| } |
| } |