[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
This commit is contained in:
committed by
GitHub
parent
299cf0138d
commit
e9167f3e38
@@ -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<Offset> 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
|
||||
|
||||
Reference in New Issue
Block a user