1
votes

Can not find python function (either gimp.xxxx() or pdb.gimp_xxxxx() ) that will actually APPLY the gradient selected as current with either

    gimp.gradients_set_active(<gradientName>)  (which seems to have disappeared) or

    pdb.gimp_context_set_gradient(<gradientName>)

I have seemingly spent an eternity browsing the web, s.o., and the gimp procedural database to find something that will actually FILL a LAYER/drawable/selection with a GRADIENT along a PATH with no success.

the pdb fill functions have an option for pattern fill, but no gradient and no stroke path. the pdb stroke functions only apply the current foreground along a path.

everything on the web is about >creating< a gradient -- but I have the gradients - just no way to apply/fill/stroke them from a script.

code: SEE above

2

2 Answers

0
votes

It appears that gimp_edit_blend() is the pdb function to actually fill a drawable with a gradient.

The context gradient must be set before-hand (as in the question). And, it appears that the blend_mode parameter (the second parameter) must be 3, (ie CUSTOM-MODE) ->

    pdb.gimp_edit_blend(drawable, blend_mode, ...)
0
votes

To fill a layer with a gradient, the proper function is pdb.gimp_drawable_edit_gradient_fill().

To use a gradient along path, use pdb.gimp_paintbrush() where the last argument is the "fade" length. Of course this call takes a sequence of straight segments and not a path, but you can transform a path stroke into a sequence of segments using pdb.gimp_vectors_stroke_interpolate().