~eliasnaur/gio

Re: LinearGradient and RadialGradient

Details
Message ID
<CABC=nZz9AmWWWb9xQCzT-t789zyMqdX8cw-5AfkihgODsVCkLw@mail.gmail.com>
DKIM signature
pass
Download raw message
Thanks ,I think he is similar to css's linear-gradient
https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient

qiannian <qianniancn@gmail.com> 于2022年5月3日周二 10:52写道:
>
> Thanks ,I think he is similar to css's linear-gradient
> https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient
>
>
> Egon Elbre <egonelbre@gmail.com> 于2022年5月2日周一 17:06写道:
> >
> > 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
Reply to thread Export thread (mbox)