提交 71da3d79 编写于 作者: C Chinmay Garde 提交者: GitHub

Ensure that gradient tile mode enum values in Dart match SkShader::TileMode. (#3721)

上级 a808ab9f
...@@ -272,6 +272,7 @@ enum FilterQuality { ...@@ -272,6 +272,7 @@ enum FilterQuality {
/// Styles to use for line endings. /// Styles to use for line endings.
/// ///
/// See [Paint.strokeCap]. /// See [Paint.strokeCap].
// These enum values must be kept in sync with SkPaint::Cap.
enum StrokeCap { enum StrokeCap {
/// Begin and end contours with a flat edge and no extension. /// Begin and end contours with a flat edge and no extension.
butt, butt,
...@@ -288,6 +289,7 @@ enum StrokeCap { ...@@ -288,6 +289,7 @@ enum StrokeCap {
/// Strategies for painting shapes and paths on a canvas. /// Strategies for painting shapes and paths on a canvas.
/// ///
/// See [Paint.style]. /// See [Paint.style].
// These enum values must be kept in sync with SkPaint::Style.
enum PaintingStyle { enum PaintingStyle {
// This list comes from Skia's SkPaint.h and the values (order) should be kept // This list comes from Skia's SkPaint.h and the values (order) should be kept
// in sync. // in sync.
...@@ -833,6 +835,7 @@ class Path extends NativeFieldWrapperClass2 { ...@@ -833,6 +835,7 @@ class Path extends NativeFieldWrapperClass2 {
} }
/// Styles to use for blurs in [MaskFilter] objects. /// Styles to use for blurs in [MaskFilter] objects.
// These enum values must be kept in sync with SkBlurStyle.
enum BlurStyle { enum BlurStyle {
// These mirror SkBlurStyle and must be kept in sync. // These mirror SkBlurStyle and must be kept in sync.
...@@ -968,6 +971,7 @@ abstract class Shader extends NativeFieldWrapperClass2 { } ...@@ -968,6 +971,7 @@ abstract class Shader extends NativeFieldWrapperClass2 { }
/// * [dart:ui.Gradient], the low-level class used when dealing with the /// * [dart:ui.Gradient], the low-level class used when dealing with the
/// [Paint.shader] property directly, with its [new Gradient.linear] and [new /// [Paint.shader] property directly, with its [new Gradient.linear] and [new
/// Gradient.radial] constructors. /// Gradient.radial] constructors.
// These enum values must be kept in sync with SkShader::TileMode.
enum TileMode { enum TileMode {
/// Edge is clamped to the final color. /// Edge is clamped to the final color.
/// ///
...@@ -978,6 +982,16 @@ enum TileMode { ...@@ -978,6 +982,16 @@ enum TileMode {
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_clamp_radial.png) /// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_clamp_radial.png)
clamp, clamp,
/// Edge is repeated from first color to last.
///
/// This is as if the stop points from 0.0 to 1.0 were then repeated from 1.0
/// to 2.0, 2.0 to 3.0, and so forth (and for linear gradients, similarly from
/// -1.0 to 0.0, -2.0 to -1.0, etc).
///
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_repeated_linear.png)
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_repeated_radial.png)
repeated,
/// Edge is mirrored from last color to first. /// Edge is mirrored from last color to first.
/// ///
/// This is as if the stop points from 0.0 to 1.0 were then repeated backwards /// This is as if the stop points from 0.0 to 1.0 were then repeated backwards
...@@ -988,16 +1002,6 @@ enum TileMode { ...@@ -988,16 +1002,6 @@ enum TileMode {
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_mirror_linear.png) /// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_mirror_linear.png)
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_mirror_radial.png) /// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_mirror_radial.png)
mirror, mirror,
/// Edge is repeated from first color to last.
///
/// This is as if the stop points from 0.0 to 1.0 were then repeated from 1.0
/// to 2.0, 2.0 to 3.0, and so forth (and for linear gradients, similarly from
/// -1.0 to 0.0, -2.0 to -1.0, etc).
///
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_repeated_linear.png)
/// ![](https://flutter.github.io/assets-for-api-docs/dart-ui/tile_mode_repeated_radial.png)
repeated,
} }
Int32List _encodeColorList(List<Color> colors) { Int32List _encodeColorList(List<Color> colors) {
...@@ -1146,6 +1150,7 @@ class ImageShader extends Shader { ...@@ -1146,6 +1150,7 @@ class ImageShader extends Shader {
/// Defines how a list of points is interpreted when drawing a set of triangles. /// Defines how a list of points is interpreted when drawing a set of triangles.
/// ///
/// Used by [Canvas.drawVertices]. /// Used by [Canvas.drawVertices].
// These enum values must be kept in sync with SkVertices::VertexMode.
enum VertexMode { enum VertexMode {
/// Draw each sequence of three points as the vertices of a triangle. /// Draw each sequence of three points as the vertices of a triangle.
triangles, triangles,
...@@ -1214,6 +1219,7 @@ class Vertices extends NativeFieldWrapperClass2 { ...@@ -1214,6 +1219,7 @@ class Vertices extends NativeFieldWrapperClass2 {
/// ///
// ignore: deprecated_member_use // ignore: deprecated_member_use
/// Used by [Canvas.drawPoints]. /// Used by [Canvas.drawPoints].
// These enum values must be kept in sync with SkCanvas::PointMode.
enum PointMode { enum PointMode {
/// Draw each point separately. /// Draw each point separately.
/// ///
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册