Adding linear gradient to the mask feature set

Issue #171 resolved
Hombre created an issue

The goal of the linear gradient tool is to mimic gradient filters that you could set on the lens (to name only one use case). That tool would be added to the masking feature set, in its own section above “zone mask”.

I’d suggest supporting more than one gradient, and maybe later on supporting circular/elliptical gradient.

@agriggio If you’re okay, I can start trying coding that feature.

Comments (20)

  1. agriggio repo owner

    You should be able to emulate both linear and circular gradients with the area mask. If you think that is not enough, can you show an example? Thanks!

  2. Hombre reporter

    In this image, if we want to tweak the blue of the sky (replaced by pink for more visible effect), setting 500px to the global and local blur value lead to a not so wide gradient, really. If one want a gradient across the whole image for visual effect, I don’t see how to do it actually. Emulating gradient with a rectangle is also more cumbersome to set. It also seem something very standard in graphical tool.

  3. agriggio repo owner

    I agree it’s not as quick as a dedicated tool, but if you play with the contrast curve of the area mask you should be able to get a decent result.

  4. Hombre reporter

    I find it very difficult to have a clean predictable result with that curve (just had a try), and it will be 1000px wide, maximum.

  5. agriggio repo owner

    thinking about this some more, I would be ok with having gradients as another kind of shape in the existing area mask. Do you think you could do that?

  6. Paul Matthijsse

    Salut Hombre,

    I’m afraid I don’t understand your problem. With the current Area shape implementation, one can make a fine gradient isn’t it?

  7. Hombre reporter

    @Paul Matthijsse My problem is the user experience and range of capability to create gradient. My goal is to insert the widget from the Gradient tool inside the local editing feature, which will take 10x less time to adjust with a more rational widget (not a workaround).

    @agriggio So it would be a new shape type beside rectangular and freeform, is that waht you mean ? Sure it’s possible to do that.

  8. agriggio repo owner

    Yes, that’s what I meant. If the gradient can be integrated in the existing area mask, I think it would be a nice addition/convenience. If it required another mask type, I would not be so sure…

  9. Anton Rosenfeld

    +1 from me. It is possible to emulate gradients to a fashion at present, but zooming out and drawing a rectangle is cumbersome. A dedicated gradient tool as a new shape in the area mask would be fantastic! Thanks in advance for your work!

  10. Hombre reporter

    @agriggio I have a question about the GUI :

    I was about to reuse the Angle slider that already exist for the Rectangle shape, but it has a range of 0-180° only. My widget will have a StrenghtStart and StrengthEnd slider as well. So if the user want to easily adjust the angle of the slider, we have the choice of :

    1. Convert the existing Angle slider to the 0-360° range, but will it still work with your implementation of the rectangle ?
    2. Add a new Angle slider with the 0-360° range
    3. Reuse your Angle widget and stay in the 0-180 range, but swap the Begin and End strength when crossing bounds. It can be done automatically when using the on preview widget, but it might disturb the user, I don’t know.

    What is your preferred choice ?

    I also wanted to reuse the existing Shape’s feather slider for the Gradient feather, however the existing widget is non linear when using the slider, though the user will adjust that with the on preview widget, so I can live with that.

  11. agriggio repo owner

    my preference would be to have gradient-specific sliders, that only show up when editing a gradient (and are hidden otherwise). Similarly to what happens already for rectangles and polygons.

  12. Hombre reporter

    Showing only the useful sliders is what I planned to do, I wad asking about reusing existing sliders, possibly modified. I’ll create dedicated sliders then.

  13. agriggio repo owner

    I’d say if reusing is easy, go for it. But if it creates more problems than it solves, adding extra sliders is not a big deal imho…

  14. agriggio repo owner

    @Hombre looks great, thanks!

    A couple of points:

    1. the gradient feather seems to be picked up also as the global area feather. To reproduce: set the gradient feather, and reload the arp. You will see that the area mask feather is modified too
    2. I’d prefer this style:
    if (cond1) {
    } else if (cond2) {
    } else {
    }
    

    rather than this:

    if (cond1) {
    }
    else if (cond2) {
    }
    else {
    }
    

    but this is really minor, once 1. is fixed I’ll be happy to merge.

    Thanks again!

  15. Hombre reporter

    @agriggio Bug fixed, and ‘else’ statement rewritten.

    For the record, to simplify the GUI, I’ve created a Feather adjuster in the gradient parameters section, but it reflect the shape’s feather parameter. I shouldn’t have saved it twice. In fact, I overlooked that the ‘n' index wasn’t used for the first saved object, when saving the mask in the arp file.

  16. agriggio repo owner

    Thanks! In retrospect, we should have always used the ‘n’ index for the parameters, for all the masks. I don’t know if it makes sense to change the code now, but indeed it was a bad decision back then…

  17. Log in to comment