Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1118)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 12775010: Added the CanvasImageSource interface, which all types that a canvas can draw (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index cc559ea315716c1da91f05c9f0ebf44e86732b90..0ceb06e795bad4937c0186941dfc0dbf0e1998d0 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -889,7 +889,7 @@ class CDataSection extends Text native "*CDATASection" {
@DomName('HTMLCanvasElement')
-class CanvasElement extends Element native "*HTMLCanvasElement" {
+class CanvasElement extends Element implements CanvasImageSource native "*HTMLCanvasElement" {
@DomName('HTMLCanvasElement.HTMLCanvasElement')
@DocsEditable
@@ -1264,9 +1264,10 @@ class CanvasRenderingContext2D extends CanvasRenderingContext native "*CanvasRen
@DocsEditable
CanvasGradient createRadialGradient(num x0, num y0, num r0, num x1, num y1, num r1) native;
+ @JSName('drawImage')
@DomName('CanvasRenderingContext2D.drawImage')
@DocsEditable
- void drawImage(canvas_OR_image_OR_video, num sx_OR_x, num sy_OR_y, [num sw_OR_width, num height_OR_sh, num dx, num dy, num dw, num dh]) native;
+ void $dom_drawImage(canvas_OR_image_OR_video, num sx_OR_x, num sy_OR_y, [num sw_OR_width, num height_OR_sh, num dx, num dy, num dw, num dh]) native;
@DomName('CanvasRenderingContext2D.fill')
@DocsEditable
@@ -1482,6 +1483,25 @@ class CanvasRenderingContext2D extends CanvasRenderingContext native "*CanvasRen
$dom_arc(x, y, radius, startAngle, endAngle, anticlockwise);
}
+ @DomName('CanvasRenderingContext2D.drawImage')
+ void drawImage(CanvasImageSource source, num x, num y) {
+ $dom_drawImage(source, x, y);
+ }
+
+ @DomName('CanvasRenderingContext2D.drawImage')
+ void drawImageAndScale(CanvasImageSource source, num x, num y, num width, num
+ height) {
+ $dom_drawImage(source, x, y, width, height);
+ }
+
+ @DomName('CanvasRenderingContext2D.drawImage')
+ void drawImageAndTransform(CanvasImageSource source, num sourceX, num sourceY,
+ num sourceWidth, num sourceHeight, num destinationX, num destinationY,
+ num destinationWidth, num destinationHeight) {
+ $dom_drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight,
+ destinationX, destinationY, destinationWidth, destinationHeight);
+ }
+
@DomName('CanvasRenderingContext2D.lineDashOffset')
num get lineDashOffset => JS('num',
@@ -13458,9 +13478,8 @@ class ImageData native "*ImageData" {
// BSD-style license that can be found in the LICENSE file.
-@DocsEditable
@DomName('HTMLImageElement')
-class ImageElement extends Element native "*HTMLImageElement" {
+class ImageElement extends Element implements CanvasImageSource native "*HTMLImageElement" {
@DomName('HTMLImageElement.HTMLImageElement')
@DocsEditable
@@ -13527,6 +13546,7 @@ class ImageElement extends Element native "*HTMLImageElement" {
@DomName('HTMLImageElement.y')
@DocsEditable
final int y;
+
}
// 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
@@ -23972,9 +23992,8 @@ class ValidityState native "*ValidityState" {
// BSD-style license that can be found in the LICENSE file.
-@DocsEditable
@DomName('HTMLVideoElement')
-class VideoElement extends MediaElement native "*HTMLVideoElement" {
+class VideoElement extends MediaElement implements CanvasImageSource native "*HTMLVideoElement" {
@DomName('HTMLVideoElement.HTMLVideoElement')
@DocsEditable
@@ -24063,6 +24082,7 @@ class VideoElement extends MediaElement native "*HTMLVideoElement" {
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
void exitFullscreen() native;
+
}
// 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
@@ -29950,6 +29970,12 @@ class _DataAttributeMap implements Map<String, String> {
// BSD-style license that can be found in the LICENSE file.
+abstract class CanvasImageSource {}
+// 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.
+
+
/**
* An object representing the top-level context object for web scripting.
*
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tests/html/canvasrenderingcontext2d_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698