This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit 7f464aa
authored
[Impeller] Add rounded superellipse (#56726)
Support rounded superellipse.
Part of flutter/flutter#139321 and
flutter/flutter#13914, also related to
flutter/flutter#91523.
### Open questions
* Alternative names:
* Round**ed**Superellipse
* Squircle
* ContinuousBorderRectangle (or something like this...)
* I chose rounded superellipse because this name, albeit its length,
precisely describe this shape. "Squircle" is not strictly defined but
generally refers any shape intermediate between a rectangle and a
circle.
* Alternative definition for `corner_radius`:
* Currently the `corner_radius` corresponds to SwiftUI parameters. To
make the shape definition more generalized, we can instead define the
`corner_radius` to be the radius of the corner circles, and make the
framework do a look up table.
* The down side is, not only the work to re-calculate the table, but
also that it doesn't completely eliminates the relationship with
SwiftUI, since currently the degree of the superellipse (`n`) is also
mapped from the SwiftUI `cornerRadius`, which is not necessary for the
shape per se.
* To some extent it boils down to the question of whether we'd like this
shape to support anything beyond SwiftUI.
### Demo
https://github.com/user-attachments/assets/806ac0e9-d62f-4b04-ab6a-83436a11f6f3
Low ratio: (900, 900, 445)
<img width="520" alt="image"
src="https://github.com/user-attachments/assets/54087467-85cd-4021-91cc-a948866ab5a8">
Mid ratio: (900, 650, 180)
<img width="508" alt="image"
src="https://github.com/user-attachments/assets/460a4927-0396-462b-948d-0846a781c92c">
High ratio: (900, 650, 17)
<img width="490" alt="image"
src="https://github.com/user-attachments/assets/8d7f625d-8a3b-4aba-b3f9-f292b874b606">
## 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 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].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat1 parent 3a8204a commit 7f464aa
File tree
6 files changed
+530
-0
lines changed- ci/licenses_golden
- impeller
- display_list
- entity
- geometry
6 files changed
+530
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43161 | 43161 | | |
43162 | 43162 | | |
43163 | 43163 | | |
| 43164 | + | |
| 43165 | + | |
43164 | 43166 | | |
43165 | 43167 | | |
43166 | 43168 | | |
| |||
46088 | 46090 | | |
46089 | 46091 | | |
46090 | 46092 | | |
| 46093 | + | |
| 46094 | + | |
46091 | 46095 | | |
46092 | 46096 | | |
46093 | 46097 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
2321 | 2322 | | |
2322 | 2323 | | |
2323 | 2324 | | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
2324 | 2360 | | |
2325 | 2361 | | |
2326 | 2362 | | |
| |||
0 commit comments