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

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

Issue 1180873003: Sky: Small fixes to Gradient interface. Added comments and renamed constructors. (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 | « no previous file | sky/examples/raw/painting.sky » ('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
index bb1b027601827e9fa1aeaba5d1e0a69fa16377ac..eaed84c857d651f7b4e10b864954bbbca36b8e57 100644
--- a/sky/engine/core/painting/Gradient.dart
+++ b/sky/engine/core/painting/Gradient.dart
@@ -4,19 +4,26 @@
part of dart.sky;
+/// Defines what happens at the edge of the gradient.
enum TileMode {
+ /// Edge is clamped to the final color.
clamp,
+ /// Edge is repeated from first color to last.
repeated,
+ /// Edge is mirrored from last color to first.
mirror
}
-// Extends the generated _Gradient interface via the PrivateDart attribute.
+/// Extends the generated _Gradient interface via the PrivateDart attribute.
class Gradient extends _Gradient {
+ /// Creates a linear gradient from [endPoint[0]] to [endPoint[1]]. If
+ /// [colorStops] is provided, [colorStops[i]] is a number from 0 to 1 that
+ /// specifies where [color[i]] begins in the gradient.
// TODO(mpcomplete): Maybe pass a list of (color, colorStop) pairs instead?
- Gradient.Linear(List<Point> endPoints,
+ Gradient.linear(List<Point> endPoints,
List<Color> colors,
- List<double> colorStops,
- [TileMode tileMode = TileMode.clamp])
+ [List<double> colorStops = null,
+ TileMode tileMode = TileMode.clamp])
: super() {
if (endPoints == null || endPoints.length != 2)
throw new ArgumentError("Expected exactly 2 [endPoints].");
@@ -24,11 +31,15 @@ class Gradient extends _Gradient {
this._initLinear(endPoints, colors, colorStops, tileMode);
}
- Gradient.Radial(Point center,
+ /// Creates a radial gradient centered at [center] that ends at [radius]
+ /// distance from the center. If [colorStops] is provided, [colorStops[i]] is
+ /// a number from 0 to 1 that specifies where [color[i]] begins in the
+ /// gradient.
+ Gradient.radial(Point center,
double radius,
List<Color> colors,
- List<double> colorStops,
- [TileMode tileMode = TileMode.clamp])
+ [List<double> colorStops = null,
+ TileMode tileMode = TileMode.clamp])
: super() {
validateColorStops(colors, colorStops);
this._initRadial(center, radius, colors, colorStops, tileMode);
« no previous file with comments | « no previous file | sky/examples/raw/painting.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698