I see that LinearGradient doesn't seem to have implemented angle yet.
> type LinearGradientOp struct {> Stop1 f32.Point> Color1 color.NRGBA> Stop2 f32.Point> Color2 color.NRGBA> }
I want to implement RadialGradient, is there any reference material
that I can use?
I'm not quite sure what you mean by `angle` in this context?
For linear gradient it allows to specify start and end,
which don't have to be either horizontal or vertical.
Or in other words, it already supports an angle.
With regards to radial gradients I have a proof of concept at:
https://github.com/egonelbre/gio/tree/radial and discussion
https://github.com/gioui/gio/pull/28.
The basic idea is the same, that you provide the center and a major axis
edge point... + eccentricity (for ellipses). Then use the distance to calculate
the appropriate value.
+ Egon
On Mon, May 2, 2022 at 10:44 AM Elias Naur <mail@eliasnaur.com> wrote:
>> On Sun, 1 May 2022 at 15:14, qiannian <qianniancn@gmail.com> wrote:> >> > I see that LinearGradient doesn't seem to have implemented angle yet.> >> > > type LinearGradientOp struct {> > > Stop1 f32.Point> > > Color1 color.NRGBA> > > Stop2 f32.Point> > > Color2 color.NRGBA> > > }> >> >> > I want to implement RadialGradient, is there any reference material> > that I can use?>> Hi,>> When in doubt about graphics, I ask Egon (CC'ed) or look up anything> by Raph. I'd start with>> https://observablehq.com/@raphlinus/perceptually-smooth-multi-color-linear-gradients> or maybe> https://raphlinus.github.io/color/2021/01/18/oklab-critique.html>> and work from there.>> Elias