Radial ColourGradient


#1

Hi Jules,

Would it be possible that radial ColourGradient support ellipse as well instead of just circles ?

Thanks,


#2

It already does, if you apply a transform to it!


#3

A quick example will be much appreciated

Thanks !


#4

I think you would have to create the circular gradient, create a FillType from it, create an AffineTransform with a stretch, apply it to the FillType and get back the new transformed FillType then use this in your graphics object g.setFillType.

Something like this? (untested)

ColourGradient cg (Colours::black, 0.0f, 0.0f, Colours::white, 50.0f, 50.0f, true); FillType originalFill (cg); FillType newFill (originalFill.transformed (AffineTransform::scale (2.0f, 1.0f))); g.setFillType (newFill);


#5

Thanks !