• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5part of ui;
6
7/// Defines what happens at the edge of the gradient.
8///
9/// A gradient is defined along a finite inner area. In the case of a linear
10/// gradient, it's between the parallel lines that are orthogonal to the line
11/// drawn between two points. In the case of radial gradients, it's the disc
12/// that covers the circle centered on a particular point up to a given radius.
13///
14/// This enum is used to define how the gradient should paint the regions
15/// outside that defined inner area.
16///
17/// See also:
18///
19///  * [painting.Gradient], the superclass for [LinearGradient] and
20///    [RadialGradient], as used by [BoxDecoration] et al, which works in
21///    relative coordinates and can create a [Shader] representing the gradient
22///    for a particular [Rect] on demand.
23///  * [dart:ui.Gradient], the low-level class used when dealing with the
24///    [Paint.shader] property directly, with its [new Gradient.linear] and [new
25///    Gradient.radial] constructors.
26// These enum values must be kept in sync with SkShader::TileMode.
27enum TileMode {
28  /// Edge is clamped to the final color.
29  ///
30  /// The gradient will paint the all the regions outside the inner area with
31  /// the color of the point closest to that region.
32  ///
33  /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_clamp_radial.png)
34  clamp,
35
36  /// Edge is repeated from first color to last.
37  ///
38  /// This is as if the stop points from 0.0 to 1.0 were then repeated from 1.0
39  /// to 2.0, 2.0 to 3.0, and so forth (and for linear gradients, similarly from
40  /// -1.0 to 0.0, -2.0 to -1.0, etc).
41  ///
42  /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_linear.png)
43  /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_radial.png)
44  repeated,
45
46  /// Edge is mirrored from last color to first.
47  ///
48  /// This is as if the stop points from 0.0 to 1.0 were then repeated backwards
49  /// from 2.0 to 1.0, then forwards from 2.0 to 3.0, then backwards again from
50  /// 4.0 to 3.0, and so forth (and for linear gradients, similarly from in the
51  /// negative direction).
52  ///
53  /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_linear.png)
54  /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_radial.png)
55  mirror,
56}
57