elixir-image/image

Add "direction" option for linear gradients

Closed this issue · 2 comments

The linear gradients are very cool but there seems to be no way to direct the rendering script to render the gradient along a linear directionality starting from some origin point. Would it be possible to add to options:

A) direction: an integer representing the direction from origin to render the gradient accross measured in degrees.

I am not quite sure how to optimize that w.r.t the point of origin which changes w.r.t the parent images dimension but I am assuming that vips does this automatically behind the scenes.

Thank you again, the library is so wonderful and I hope these little vignettes aren't too annoying.

It's been a while but I'm going to tackle this over the next couple of days. I think it will something gradient with a rotation number of degrees to start with.

Gradients should have a translation effect too (moving the gradient "up"/"down") but I'll treat that as a second phase.

I found some time to work on this today and I think its feature complete. There is a breaking change in the function signature (noted in the changelog). Primarily to add a keyword list of options and to also allow specifying the dimensions of the gradient image directly.

Turned out to be a fun challenge in geometry!

If you're still interested and will to take it for a test drive, feedback would be warmly welcome before the next release cycle.