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

Unified Diff: sky/engine/core/painting/Gradient.dart

Issue 1152963009: Add support for linear gradients, implemented as skia shaders. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: . Created 5 years, 6 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/painting/CanvasGradient.cpp ('k') | sky/engine/core/painting/Gradient.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Gradient.dart
diff --git a/sky/engine/core/painting/Gradient.dart b/sky/engine/core/painting/Gradient.dart
new file mode 100644
index 0000000000000000000000000000000000000000..be919951e11128fbf240bcb4363d0a28acd31031
--- /dev/null
+++ b/sky/engine/core/painting/Gradient.dart
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Extends the generated _Gradient interface via the CustomDart attribute.
+
+class Gradient extends _Gradient {
+ // TODO(mpcomplete): Support other gradient types.
+ // TODO(mpcomplete): Maybe pass a list of (color, colorStop) pairs instead?
+ Gradient.Linear(List<Point> endPoints,
+ List<Color> colors,
+ List<double> colorStops)
+ : super(0, endPoints, colors, _validate(colorStops, colors));
+
+ // TODO(mpcomplete): Figure out a good way to validate arguments.
+ static List<double> _validate(colorStops, colors) {
+ if (colorStops != null && colors.length != colorStops.length) {
+ throw new ArgumentError(
+ "[colors] and [colorStops] parameters must be equal length.");
+ }
+ return colorStops;
+ }
+}
« no previous file with comments | « sky/engine/core/painting/CanvasGradient.cpp ('k') | sky/engine/core/painting/Gradient.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698