Radial ColourGradient


Hi Jules,

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



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


A quick example will be much appreciated

Thanks !


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);


Thanks !