Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Update][Proposal] Improve Canvas Documentation#31153

Merged
fluttergithubbot merged 3 commits intoflutter:mainfrom
MasahideMori-SimpleAppli:proposal-93190-2
Feb 5, 2022
Merged

[Update][Proposal] Improve Canvas Documentation#31153
fluttergithubbot merged 3 commits intoflutter:mainfrom
MasahideMori-SimpleAppli:proposal-93190-2

Conversation

@MasahideMori-SimpleAppli
Copy link
Contributor

This is an additional patch to the previously submitted patch.

Thanks to @flar for suggestions for making it better.

#30069

  • This patch improves the documentation for the Vertices.raw constructor.

Also, this time, when I Fetch upstream from the browser (flutter / engine), I got an Actions error saying "GitHub token env var is not set.", But I haven't solved it.
I'm not sure what this is because I don't use Actions,
Please let me know if you have any problems with this patch.
If the patch is okay, ignore my problem with Actions.
Thank you.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another problem with the docs here in that the colors list says it is RGBA, but the correct format is ARGB. (which is the same format as Color.value)

One more issue which happens with the Canvas.drawVertices call that you also updated with the previous PR - it does not describe how the BlendMode parameter is used. We could say (in the documentation for drawVertices):

The [mode] parameter is used to control how the colors in the [vertices] are combined with the colors in the [paint]. If there are no colors specified in [vertices] then the [mode] has no effect. If there are colors in the [vertices], then the color taken from the [Shader] or [Color] in the [paint] is blended with the colors specified in the [vertices] using the [mode] parameter. For purposes of this blending, the colors from the [paint] are considered the source and the colors from the [vertices] are considered the destination.


/// Creates a set of vertex data for use with [Canvas.drawVertices], directly
/// using the encoding methods of [new Vertices].
/// Note that this constructor uses a raw typed data list,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uses raw typed data lists,

/// Creates a set of vertex data for use with [Canvas.drawVertices], directly
/// using the encoding methods of [new Vertices].
/// Note that this constructor uses a raw typed data list,
/// so it runs faster than Dart list version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faster than the [Vertices()] constructor

(Make sure it links correctly to the regular constructor)

/// using the encoding methods of [new Vertices].
/// Note that this constructor uses a raw typed data list,
/// so it runs faster than Dart list version
/// because it doesn't require any conversion from Dart list.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from Dart lists.

///
/// If the [indices] list is provided, all values in the list must be
/// valid index values for [positions].
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra line here, you are continuing to describe the same parameter as the previous paragrph.

/// The [textureCoordinates] list is interpreted as a list of repeated pairs
/// of x,y coordinates, and must be the same length of [positions] if it
/// is not null.
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra line here, both of these paragraphs describe the same parameter.

///
/// The [positions] list is interpreted as a list of repeated pairs of x,y
/// coordinates. It must not be null.
/// The [positions] parameter is a list of triangular mesh vertices(xy).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 sentences should be combined, such as

The [positions] parameter is a list of triangular mesh vertices and is interpreted as ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(And no need to specify xy twice as the rest of the first sentence also mentions that they are x,y coordinates.)

@MasahideMori-SimpleAppli
Copy link
Contributor Author

Hi @flar,
Thank you for your comment.
I fixed those issues.
Is the position of the description of drawVertices [blendMode] appropriate here?

Your comments were detailed and very helpful to me.
If there are still corrections left, I would appreciate it if you could point them out.
Thank you for your all help in advance.

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Great! Thanks for doing this!

@MasahideMori-SimpleAppli
Copy link
Contributor Author

MasahideMori-SimpleAppli commented Feb 1, 2022

Thank you, too!
I learned a lot from you.

@chinmaygarde
Copy link
Contributor

The linter failure is real. There are couple of trailing whitespaces in this patch:

ERROR: Whitespace check failed. The following files have trailing spaces:
  /b/s/w/ir/cache/builder/src/flutter/lib/ui/painting.dart:3976:  /// so it runs faster than the [Vertices()] constructor 
  /b/s/w/ir/cache/builder/src/flutter/lib/ui/painting.dart:3981:  /// The [positions] parameter is a list of triangular mesh vertices and 

Let's address these nits and land ASAP. Thanks.

@MasahideMori-SimpleAppli
Copy link
Contributor Author

Hi @chinmaygarde

Thank you for always helping me out!
I fixed the problem.

@flar
Copy link
Contributor

flar commented Feb 4, 2022

I think I've seen that failure in the Linux Smoke Tests before. You might have to rebase this PR to the Top of Tree to fix it.

@MasahideMori-SimpleAppli
Copy link
Contributor Author

Hi @flar,
Thank you for your advice!
I tried rebase. Thank you again.

@flar flar added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Feb 5, 2022
@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review if you are already a member or two member reviews if you are not a member before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Feb 5, 2022
@flar flar requested a review from zanderso February 5, 2022 19:38
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants