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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 10984055: Replacing non-portable CanvasRenderingContext.setFillColor with more portable variants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Syncing to latest. Created 8 years, 2 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
« no previous file with comments | « no previous file | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/dart2js/html_dart2js.dart
diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart
index 5c98b29e2b9afa8fc284a8ca0cf491bba2c6bf26..8037bc628b68248466220d36a5f1c409fd256f40 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -7679,9 +7679,6 @@ abstract class CanvasRenderingContext2D implements CanvasRenderingContext {
/** @domName CanvasRenderingContext2D.setCompositeOperation */
void setCompositeOperation(String compositeOperation);
- /** @domName CanvasRenderingContext2D.setFillColor */
- void setFillColor(c_OR_color_OR_grayLevel_OR_r, [num alpha_OR_g_OR_m, num b_OR_y, num a_OR_k, num a]);
-
/** @domName CanvasRenderingContext2D.setLineCap */
void setLineCap(String cap);
@@ -7700,9 +7697,6 @@ abstract class CanvasRenderingContext2D implements CanvasRenderingContext {
/** @domName CanvasRenderingContext2D.setShadow */
void setShadow(num width, num height, num blur, [c_OR_color_OR_grayLevel_OR_r, num alpha_OR_g_OR_m, num b_OR_y, num a_OR_k, num a]);
- /** @domName CanvasRenderingContext2D.setStrokeColor */
- void setStrokeColor(c_OR_color_OR_grayLevel_OR_r, [num alpha_OR_g_OR_m, num b_OR_y, num a_OR_k, num a]);
-
/** @domName CanvasRenderingContext2D.setTransform */
void setTransform(num m11, num m12, num m21, num m22, num dx, num dy);
@@ -7726,7 +7720,39 @@ abstract class CanvasRenderingContext2D implements CanvasRenderingContext {
/** @domName CanvasRenderingContext2D.webkitPutImageDataHD */
void webkitPutImageDataHD(ImageData imagedata, num dx, num dy, [num dirtyX, num dirtyY, num dirtyWidth, num dirtyHeight]);
+
+
+ /**
+ * Sets the color used inside shapes.
+ * [r], [g], [b] are 0-255, [a] is 0-1.
+ */
+ void setFillColorRgb(int r, int g, int b, [num a]);
+
+ /**
+ * Sets the color used inside shapes.
+ * [h] is in degrees, 0-360.
+ * [s], [l] are in percent, 0-100.
+ * [a] is 0-1.
+ */
+ void setFillColorHsl(int h, num s, num l, [num a]);
+
+ /**
+ * Sets the color used for stroking shapes.
+ * [r], [g], [b] are 0-255, [a] is 0-1.
+ */
+ void setStrokeColorRgb(int r, int g, int b, [num a]);
+
+ /**
+ * Sets the color used for stroking shapes.
+ * [h] is in degrees, 0-360.
+ * [s], [l] are in percent, 0-100.
+ * [a] is 0-1.
+ */
+ void setStrokeColorHsl(int h, num s, num l, [num a]);
}
+// 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.
class _CanvasRenderingContext2DImpl extends _CanvasRenderingContextImpl implements CanvasRenderingContext2D native "*CanvasRenderingContext2D" {
@@ -7870,8 +7896,6 @@ class _CanvasRenderingContext2DImpl extends _CanvasRenderingContextImpl implemen
void setCompositeOperation(String compositeOperation) native;
- void setFillColor(c_OR_color_OR_grayLevel_OR_r, [num alpha_OR_g_OR_m, num b_OR_y, num a_OR_k, num a]) native;
-
void setLineCap(String cap) native;
void setLineDash(List<num> dash) native;
@@ -7884,8 +7908,6 @@ class _CanvasRenderingContext2DImpl extends _CanvasRenderingContextImpl implemen
void setShadow(num width, num height, num blur, [c_OR_color_OR_grayLevel_OR_r, num alpha_OR_g_OR_m, num b_OR_y, num a_OR_k, num a]) native;
- void setStrokeColor(c_OR_color_OR_grayLevel_OR_r, [num alpha_OR_g_OR_m, num b_OR_y, num a_OR_k, num a]) native;
-
void setTransform(num m11, num m12, num m21, num m22, num dx, num dy) native;
void stroke() native;
@@ -7924,6 +7946,23 @@ class _CanvasRenderingContext2DImpl extends _CanvasRenderingContextImpl implemen
}
void _webkitPutImageDataHD_1(imagedata, dx, dy) native "webkitPutImageDataHD";
void _webkitPutImageDataHD_2(imagedata, dx, dy, num dirtyX, num dirtyY, num dirtyWidth, num dirtyHeight) native "webkitPutImageDataHD";
+
+
+ void setFillColorRgb(int r, int g, int b, [num a = 1]) {
+ this.fillStyle = 'rgba($r, $g, $b, $a)';
+ }
+
+ void setFillColorHsl(int h, num s, num l, [num a = 1]) {
+ this.fillStyle = 'hsla($h, $s%, $l%, $a)';
+ }
+
+ void setStrokeColorRgb(int r, int g, int b, [num a = 1]) {
+ this.strokeStyle = 'rgba($r, $g, $b, $a)';
+ }
+
+ void setStrokeColorHsl(int h, num s, num l, [num a = 1]) {
+ this.strokeStyle = 'hsla($h, $s%, $l%, $a)';
+ }
}
class _CanvasRenderingContextImpl implements CanvasRenderingContext native "*CanvasRenderingContext" {
« no previous file with comments | « no previous file | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698