From e9167f3e383f2e1fc03266b93aee580cfa70ffb2 Mon Sep 17 00:00:00 2001 From: MasahideMori-SimpleAppli <59500584+MasahideMori-SimpleAppli@users.noreply.github.com> Date: Fri, 3 Dec 2021 06:29:42 +0900 Subject: [PATCH] [Proposal] Improve Canvas Documentation (flutter/engine#30069) For clarity, the text has been improved over when it was suggested. Fixes https://github.com/flutter/flutter/issues/93190 --- engine/src/flutter/lib/ui/painting.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/src/flutter/lib/ui/painting.dart b/engine/src/flutter/lib/ui/painting.dart index a1b9103824..615d51c6f0 100644 --- a/engine/src/flutter/lib/ui/painting.dart +++ b/engine/src/flutter/lib/ui/painting.dart @@ -3928,12 +3928,20 @@ class Vertices extends NativeFieldWrapperClass1 { /// Creates a set of vertex data for use with [Canvas.drawVertices]. /// /// The [mode] and [positions] parameters must not be null. + /// The [positions] parameter is a list of triangular mesh vertices(xy). /// /// If the [textureCoordinates] or [colors] parameters are provided, they must /// be the same length as [positions]. /// + /// The [textureCoordinates] parameter is used to cutout + /// the image set in the image shader. + /// The cut part is applied to the triangular mesh. + /// Note that the [textureCoordinates] are the coordinates on the image. + /// /// If the [indices] parameter is provided, all values in the list must be /// valid index values for [positions]. + /// + /// e.g. The [indices] parameter for a simple triangle is [0,1,2]. Vertices( VertexMode mode, List positions, { @@ -4674,6 +4682,7 @@ class Canvas extends NativeFieldWrapperClass1 { /// * [new Vertices], which creates a set of vertices to draw on the canvas. /// * [Vertices.raw], which creates the vertices using typed data lists /// rather than unencoded lists. + /// * [paint], Image shaders can be used to draw images on a triangular mesh. void drawVertices(Vertices vertices, BlendMode blendMode, Paint paint) { assert(vertices != null); // vertices is checked on the engine side