sigh I guess it was asking too much to expect that a vertical blend would look simple with respect to the bounding rectangle? Anyway, I used Haydxn explanation to jigger up this handy object. I only use vertical blends FYI.
// Simple class to facilitate setting vertical blends
class VerticalGradient : public JUCE_NAMESPACE::ColourGradient
Colour const& startColour,
Colour const& endColour,
Rectangle <int> const& bounds)
: ColourGradient (
startColour, bounds.getX (), bounds.getY () + .5f,
endColour, bounds.getX (), bounds.getBottom () -.5f,
It would be nice if ColourGradient allowed specification of a ‘gamma’ parameter for each color pair, essentially passing the interpolation value t==[0,1] through the function f(t) = pow (t,g) where g is a gamma value, and g=1 gives the identity. This way I could change the speed of my rolloff towards transparency. Right now I’m doing it by adding points but its clunky and it would be better if it was done when generating the lookup table (since it would be easiest there).