How Radial Gradients are defined in Juce


#1

Hi there,

I am porting some code written with Quartz and Cairo to Juce I have encountered a difference in the way radial gradients are defined in Juce.

In Cairo or Quartz radial gradients are defined by 6 arguments:
1 - the x coordinate of the center of the first circle
2 - the y coordinate of the center of the first circle
3 - the radius of the first circle
4 - the x coordinate of the center of the second circle
5 - the y coordinate of the center of the second circle
6 - the radius of the second circle

So radial gradients can vary between two circles that could have different centers and radiuses.

So, for instance, this picture shows a radial gradient that
varies between a small, bright red circle and a larger black one:

[attachment=0]cylinder6.gif[/attachment]

In Juce obviously radial gradients are defined differently.

I would like to know if it’s possible to compensate for this difference in a more or less straight forward way or
if in Juce radial gradients needs to be though out in a completely different way, which is not translatable from Quartz or Cairo in any way.

Thanks in advance.

  • Luigi

#2

The juce gradient is simpler, so can’t reproduce these double-circle patterns. Adding a more powerful gradient is one of the things on my to-do-list, but it’s actually quite a complicated job (what on earth is the equation for getting the colour from an (x, y) position in something like your example?? It seems like there are lots of edge-cases to deal with too…)


#3

I’d like to see “transfer functions”, so instead of going linearly from start to end color, it could be quadratic or exponential.