-
Notifications
You must be signed in to change notification settings - Fork 6k
Support for TwoPointConical gradients #5275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @Hixie for comments on Dart code.
Float64List matrix4 | ||
Float64List matrix4, | ||
Offset focal, | ||
double focalRadius |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh man, we should have used named arguments. this has become sad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah :( but that'd be a a breaking change. I suppose it could be another method and deprecate this one....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could do another method, but as you point out in the commit message, that's got its own problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just do a good job of the framework wrapper, then this particular method won't matter much.
This has broken flutter tests(once this lands in flutter/flutter).
|
Urfh. Will fix but looks like it should be reverted til then. The assertion should also pass if focal is null. |
This reverts commit 919e8c2 as it breaks flutter gradient_test.
Engine side fix for flutter/flutter#17106
This patch updates
Gradient.radial
to support an optional focalOffset
and radius. If these are provided, it the call will instantiate anSkTwoPointConicalGradient
instead of plain oldSkRadialGradient
.Skia fiddle here: https://fiddle.skia.org/c/adc33d57c035fcb8bcbd4c3ad6381c13
Interesting/relevant reading for Skia end: https://skia.org/dev/design/conical
I initially wanted to name this something like
Gradient.conical
(similar to Skia's naming convention), but I'm afraid that will cause confusion for a lot of users who google "conical gradients" and find stuff about planned support for what Skia calls Sweep gradients under that name (in fact, I got a bit muddled myself before realizing that the terms are not being used identically by Skia and the proposed CSS standard/top Google search results). The tiling mode documentation should not need to be changed for this.My primary use case for this is to enable better support of SVG's
<radialGradient>
element, but this is not SVG specific.There'd be a similar update in Flutter SDK to support this in
ui.Gradient.radial
over there.