Chromium Code Reviews| 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..2fa52470b78b32a07d4e0490517bfe4b01bdd28c |
| --- /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): Should we pas a list of (color, colorStop) pairs instead? |
|
eseidel
2015/06/08 17:26:57
pas -> pass
Matt Perry
2015/06/08 17:43:53
Done.
|
| + 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; |
| + } |
| +} |