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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 11028068: Replacing non-portable CanvasRenderingContext.setFillColor with more portable variants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Integrating latest build. 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 b6d8a84e35c9b8d5665379c29fe65b39ea79c064..0095871aadf66c4fb61b1abc135d402b90561a78 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -7506,9 +7506,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);
@@ -7527,9 +7524,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);
@@ -7553,7 +7547,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" {
@@ -7697,8 +7723,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;
@@ -7711,8 +7735,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;
@@ -7751,6 +7773,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