| 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;
|
| + }
|
| +}
|
|
|