Add documentation on fragment program API and usage#7902
Add documentation on fragment program API and usage#7902jonahwilliams merged 18 commits intomainfrom
Conversation
| @@ -0,0 +1,228 @@ | |||
| --- | |||
| title: Writing and using Fragment Shaders | |||
There was a problem hiding this comment.
TBD: how do I link this from elsewhere in the website?
There was a problem hiding this comment.
To link TO this page, you would use the following text:
For more information, check out [Writing and using fragment shaders][fragment-shaders]
[fragment-shaders]: {{site.url}}/development/ui/advanced/shaders
| ## Canvas API | ||
|
|
||
| Fragment shaders can be used with most Canvas APIs that accept either solid | ||
| colors or gradients via a [Paint] object. And will cover an area determined |
There was a problem hiding this comment.
Check the first two sentences here. Not sure what they're saying.
There was a problem hiding this comment.
I think what I'm trying to say is:
You can use shaders with most canvas APIs.
The shader works in the same way that a solid color or gradient works when applied to a shape
It doesn't work with certain APIs, like how a LinearGradient is ignored if set on the paint passed to drawImage
There was a problem hiding this comment.
Did you make this change, @jonahwilliams? The suggested text is clearer.
| ### Performance Considerations | ||
|
|
||
| When targeting the Skia backend loading the shader may be expensive, since it | ||
| must be compiled to the appropriate platform specific shader. If you intend to |
There was a problem hiding this comment.
| must be compiled to the appropriate platform specific shader. If you intend to | |
| must be compiled to the appropriate platform specific shader at runtime. If you intend to |
|
|
||
| ``` | ||
|
|
||
| ## Authoring Shaders |
There was a problem hiding this comment.
Maybe frontload pointers to tutorials on writing shaders?
There was a problem hiding this comment.
I believe this will get a generated table of contents
There was a problem hiding this comment.
I'm wondering what kind of tutorials you mean, @zanderso
There was a problem hiding this comment.
The ones listed down under "Other resources". My thought was to make it clear that this doc isn't intended to be a general tutorial on writing shaders.
Co-authored-by: Zachary Anderson <[email protected]>
|
@sfshaza2 PTAL. I'd like to merge this change before the next stable so that I can update some class documentation in the flutter repo to point to it |
sfshaza2
left a comment
There was a problem hiding this comment.
Phew! This one was a doozy!
| @@ -0,0 +1,228 @@ | |||
| --- | |||
| title: Writing and using Fragment Shaders | |||
There was a problem hiding this comment.
To link TO this page, you would use the following text:
For more information, check out [Writing and using fragment shaders][fragment-shaders]
[fragment-shaders]: {{site.url}}/development/ui/advanced/shaders
sfshaza2
left a comment
There was a problem hiding this comment.
Also, as this is a new page, can you add it to the sidenav? To do that, edit src/_data/sidenav.yml.
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
|
@sfshaza2 I've updated this PR with most of your suggestions + a few comments/questions |
Co-authored-by: Loïc Sharma <[email protected]>
sfshaza2
left a comment
There was a problem hiding this comment.
I have a few minor quibbles, but nothing to hold up landing this, when you're ready. LGTM
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
|
Thanks for all of the help on this one @sfshaza2 ! |
Adds documentation on usage of the fragment program API.
Fixes flutter/flutter#107929
Presubmit checklist